[texworks] HELP: Integrated Tw LaTeX2e Help dialogue

Stefan Löffler st.loeffler at gmail.com
Sun Jul 4 09:40:32 CEST 2010


Am 2010-07-04 03:59, schrieb Paul A Norman:
>> Paul, that's very cool indeed! One thing: if you use Qt's Layout mechanism in the window, it'll >handle cross-platform differences and resizing better. (When I first tried it, many button labels >were clipped.)
> Are you wanting me to change the QDialog's .sizePolicy?  to which
> setting ..... ?

No, that wouldn't help, I think. Right now, you have simply put all
widgets into the dialog directly. This way, Qt doesn't know how you want
them layouted (does this word exist?) and simply puts them all at the
position you specified at the size you gave them. What Jonathan (and I)
suggested was to use Qt layouts (such as GridLayout). That way, you
specify how much space should be allocated for each, e.g., row and col,
and Qt takes care of realizing that, no matter how the user resizes the
You can set a top-level layout for the whole dialog, e.g. by
right-clicking on "Dialog" in the Qt designer object sidebar and
selecting a layout. BTW, layouts can also be nested. For a how-to on
splitters, see, e.g.,
So, what I'd suggest to try is the following:
Start with two vertical layouts, one for the left part of the dialog,
one for the right one. In the left one, stack the browser, the input
field, the "get selection" button, and the label (and possibly a
fixed-size vertical spacer for alignment). In the right one, stack the
content area, a gridlayout with the buttons (using a spacer to separate
left and right buttons; note that you can make widgets span multiple
cells by simply resizing it appropriately), and the dialog's button box.
Finally, select both layouts and lay them out in a splitter.

> (I'm flying blind not being able to see what is happening cross-platform.)

This should be the same on Windows. Just resize your dialog and see what
happens (the widgets should stay fixed and don't resize with the dialog).

> Currently the setting is `prefereed' for Horiz and Vertical Policy,
> and 0 for Horiz and Vert Stretch

AFAIK, size policies and stretch only work inside of layouts.

>> I also think this would be better as a non-modal Window rather than a Dialog, though I haven't >experimented to know whether that's actually possible yet.
> For completeness, as I understand from Stefan's posts that you have
> already done in this in C++, nonetheless can I set this as either
> .windowModality =
>  1.  windowModal  or 2. ApplicationModal    or do you not mind which?

Currently, C++ just overrides whatever you set in the .ui file for the
sake of security (avoiding crashes). In C++, it's set to
ApplicationModal. WindowModal didn't work for me on Linux, probably
because the TeXDocument is not set as parent in the call to
createUIFromString(). BTW: why don't you use createUI(filename, parent)
with the .ui file (parent is optional, and defaults to a global dialog)?
This should be easier and faster than manually reading the content of
the file in the script.


More information about the texworks mailing list