[Qt-interest] Two questions regarding QStatusBar

Tony Rietwyk tony.rietwyk at rightsoft.com.au
Tue Jul 7 01:57:11 CEST 2009


Hi Patric, 
 
What is it that you don't understand about the methods?  The inserts fall
back to appends if the index is invalid.  Permanent widgets go to the right
of non-permanent ones. 
 
I think QStatusBar uses a layout internally.  It looks to me that the two
widgets have been laid out evenly, but because of the maximum size, the
progress bar floats in the center of its allocated space.  I suggest
changing the size policy of the label - maybe horizontal minimum expanding,
or with a horizontal weight (eg 1).  You might also use the stretch
parameter of the add/insert functions that you mentioned. 
 
To understand the layout process better, place the two widgets into a
horizontal layout in designer, then fiddle with the layout settings until
you get the look you require.  Then change your code to apply the same
settings to the status bar widgets. 
 
Hope that helps, 
 
Tony.
 
 
 

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Patric
Sent: Tuesday, 7 July 2009 08:46
To: qt-interest at trolltech.com
Subject: [Qt-interest] Two questions regarding QStatusBar


Hello, 
I have two simple questions here. 
The first one is for the difference between addWidget and insertWidget. I
didn't found a difference when I tested them in my code. 
The second one is about the attached file. I need to add two widgets, one
QLabel and one QProgress bar in my status bar. 
Unfortunately, the QProgressBar is added with some strange space after it...
(the red circle)
 
Any ideas what might be the reason ? Here is my code : 

// setup the status bar progress widget

statusBarProgressBar = new QProgressBar();

statusBarProgressBar->setMaximumSize(85, 14);

ui->statusBar->addPermanentWidget(statusBarProgressBar);

 



// setup the status bar IP widget

statusBarIPLabel = new QLabel();

ui->statusBar->addPermanentWidget(statusBarIPLabel );

 

http://doc.trolltech.com/4.5/qstatusbar.html#addPermanentWidget

 

Thank you very much in advance. :)

 

Best regards, 

Patric

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090707/5ad631ec/attachment.html 


More information about the Qt-interest-old mailing list