[Qt-interest] Adding status bar to dialog

Wm. G. Urquhart wgu at wurquhart.co.uk
Wed Apr 14 19:54:49 CEST 2010


On 14/04/2010 18:46, Anders Bakken wrote:
> On Wed, Apr 14, 2010 at 06:41:30PM +0100, Wm. G. Urquhart wrote:
>> Hi,
>>
>> How can I add a QStatusBar to a QDialog's layout, as created by Designer
>> using "Layout in a form layout". Or indeed any other way.
>>
>> What I've tried either displays my showMessage(...) entries in the
>> middle of the dialog or complains that I already have a layout. Any help
>> would be greatly appreciated.
>>
> Just create a QVBoxLayout on the dialog. Then add the statusbar to the
> bottom of this and your form layout on the top.

Thanks Anders,

But how do I get a 'handle' to the existing layout?

This is what I have so far:

setAttribute(Qt::WA_DeleteOnClose) ;
layout = new QVBoxLayout(this) ;
layout->setObjectName("StatusBar") ;
infoBar = new QStatusBar ;
layout->addWidget(infoBar) ;
layout->setMargin(0) ;
layout->setSpacing(0) ;
setLayout(layout) ;

-- 
William



More information about the Qt-interest-old mailing list