[Qt-interest] How to get a QStatusBar into the Visual StudioIntegration Toolbox?

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Tue Dec 9 20:01:54 CET 2008


Niels wrote:

> Can someone please tell me how to drag-and-drop a QStatusBar 
> onto a dialog, 
> using the toolbox from Qt4 Visual Studio Integration? (Or 
> from Qt4 Designer, 
> if necessary.)  Or is there some other place where I should ask?

Hi Niels, 

The QStatusBar doc says its usually associated with QMainWindow - but it
doesn't explicitly say if it can, or cannot, be used anywhere else. 

In Designer (and I assume VS Integration), when you select a new main window
form, it shows the default status bar already present. Right-clicking
anywhere except the menu, has option 'Remove Status Bar'. 

> Note: this is a repost, as I wrote on November 28:
> >
> > How can I add a standard Qt 4.4.3 widget to the Qt Toolbox 
> that comes
> > with Visual Studio Integration 1.4.3?  Would I have to write my own
> > wrapper plugin, or is it just a matter of a few mouse clicks?

I believe there are Qt Designer interfaces that allow a designer plugin to
change the toolbox. 

I myself would like to know if there is an easier way to reorder the widgets
/ groups in the toolbox?

> > My dialog is designed using Qt Visual Studio Integration 1.4.3, it's
> > derived from QDialog.  Now I would like to add a QStatusBar, doing
> > drag-n-drop within the IDE, but it's not in the Qt Toolbox.  The Qt4
> > Designer doesn't have it in its Widget Box either.

I suggest you change to a QMainWindow based form, and copy and paste the
contents across from your existing one. 

> > It used to be very easy in the Designer of Qt 3, doing "Edit Custom
> > Widgets" from the Tools menu, and entering "QStatusBar" as class
> > name, and "qstatusbar.h" as headerfile.  How to achieve the same in
> > Qt 4?

I don't know Qt 3, but Qt 4 has two related actions: 

- You can add any existing widgets as placeholders for your own, and then
'promote' them to your type. This will ask you for the class name and header
file. The promoted class and header will then be written into the .h file
instead by the UIC program. In order to change the properties, it makes
sense to use the base class of your private widget. 

- You can create a plugin to add your own widgets to the toolbox. You must
do this, if your widget has properties that must be set in the designer.
This isn't too hard, though the doco is pretty sparse - especially the
'isContainer' and 'xml' properties. The example 'clock widget' only shows
how to add a single widget, which unfortunately, is a slightly different
process to adding multiple widgets. The plugin then supplies the header file
and base class details. 

Hope that helps, 

Tony Rietwyk





More information about the Qt-interest-old mailing list