Qt-jambi-interest Archive, September 2007
unable to reproduce Qt example imageviewer/MainWindowUI using designer
Message 1 in thread
I'm creating a simple app which will display images. As a starting
point, I looked at the imageviewer example which came with Qt Jambi
(linux32-gpl-4.3.1_01).
I then fired up Qt Jambi's designer and I'm unable to reproduce that
layout from scratch.
The problem is that attempting to add a widget to a QMainWindow
results in it getting added to the 'centralwidget' that is built into
QMainWindow. If you look at the Object inspector for the imageviewer
MainWindow example, you'll see that MainWindow has the following
children:
- centralwidget
- menubar
- statusbar
- treeDock
- tableDock
- effectsDock
- toolBar_2
However I've been unable to find a way to add docks (or any form of
widget besides a toolbar) to a QMainWindow without it being
automatically placed as a child of centralwidget.
Did you guys actually use Qt Jambi's designer to create this example,
or is this a hand-made fake??
regards,
Valient
Message 2 in thread
Hi, Valient.
Valient Gough wrote:
> However I've been unable to find a way to add docks (or any form of
> widget besides a toolbar) to a QMainWindow without it being
> automatically placed as a child of centralwidget.
>
This does unfortunately seem to be a bug in the Qt Jambi Designer. The
example in question was in fact created using Designer, but the bug has
snuck into a later revision.
The usual way of creating dock widgets in Designer is to drop a
QDockWidget from the widget box onto the QMainWindow and then set its
"docked" property to true. Unfortunately, due to the bug, the "docked"
property is not available in Qt Jambi Designer, making it impossible to
create dock widgets for Jambi applications in Designer.
I've registered the bug in our task tracking system, so it should
hopefully be fixed for the next release of Qt Jambi.
In the mean time, two possible work arounds are:
1. Make the contents of your dock widgets as separate .jui files (based
on QWidget) and then add them manually to the main window in code when
you run the application. This is obviously less convenient, but the code
for binding the two together should not be very long.
2. If you wish, you can also add the dock widgets as children of the
central widget, then manually edit the .jui file to fix the dock widgets
and continue editing it with Designer afterwards. You will need to find
the QDockWidget in the XML first. It will be a node inside the node for
the central widget. You will have to move it out so it's no longer a
child of the central widget. You should then remove the node for the
"geometry" property, as this is not needed. Finally, you need to add a
docking area for the dock widget, like this:
<attribute name="dockWidgetArea" >
<number>1</number>
</attribute>
The number should be a binary combination of the values in the following
table:
http://doc.trolltech.com/4.3/qt.html#DockWidgetArea-enum
In the example above, the number is 1, so the docking area is Left.
Place the <attribute> tag as a child to the dock widget's <widget> tag.
This should be a one time exercise, meaning that once you have your dock
widgets in place, you should be able to use Designer as normal with the
form, dropping widgets into the dock widget etc. We apologize for the
inconvenience, and hope either of these work arounds suit you while you
wait for the actual fix.
-- Eskil
Message 3 in thread
Thanks, I'll give the workaround a try.
I had been trying to get creative with Designer to see if I could
trick it into doing what I wanted, but I found a bug.
Here's how to reproduce it:
1. open designer, create a 'Main Window' widget.
2. add a DockWidget
3. set DockWidget's 'float' property to true.
4. right-click the dockwidget in the object tree view
Setting DockWidget 'float' to true seems to be causing the
instability, because I had lots of other crashes whenever I did that,
but this was the simplest way to reproduce it.
Java will crash at that point.. If you like, here is a crash report:
http://arg0.net/users/vgough/hs_err_pid8528.log
regards,
Valient
Message 4 in thread
Hi, Valient.
Valient Gough wrote:
> 1. open designer, create a 'Main Window' widget.
> 2. add a DockWidget
> 3. set DockWidget's 'float' property to true.
> 4. right-click the dockwidget in the object tree view
>
>
Yes, I can reproduce this. Thank you very much for the report =)
-- Eskil