[Qt-interest] how to use layouts

Ramesh ramesh.bs at robosoftin.com
Thu Mar 11 13:13:36 CET 2010


Hey.. alex..
One more quest..
I checked ur sample its fine.. running well.. 

What if I want to move my toolbar just above menu.. still I am able to see
some spaces between menu and tool bar.
What if I want to draw menu just little above the menubar?

And if I remove the addstreach the buttons are coming in the center not at
upper part of widget..
What do I hv to do in these cases..

I just want to knw how can I customize some more?

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of alexander golks
Sent: Thursday, March 11, 2010 5:15 PM
To: qt-interest at trolltech.com
Subject: [Qt-interest] how to use layouts

you're possibly searching for the ::addStretch(int) method:

  QWidget* w=new QWidget();
  QVBoxLayout* vl=new QVBoxLayout();
  QToolBar* tb=new QToolBar();
  tb->addAction("action1");
  tb->addAction("action2");
  vl->addWidget(new QPushButton("button1"));
  vl->addWidget(new QPushButton("button2"));
  vl->addStretch(0);	// creates an spacer item, which will expand to
maximum available space
                        // thus letting the toolbar hover at the bottom of
the widget
  vl->addWidget(tb);
  w->setLayout(vl);

in designer search for the spacers.

alex

-- 
/*
 *printk(KERN_ERR "happy meal: Eieee, rx config register gets greasy
fries.\n");
 *  linux-2.6.19/drivers/net/sunhme.c
 */

-----------------------------------------------
Robosoft Technologies - Come home to Technology

Disclaimer: This email may contain confidential material. If you were not an intended recipient, please notify the sender and delete all copies. Emails to and from our network may be logged and monitored. This email and its attachments are scanned for virus by our scanners and are believed to be safe. However, no warranty is given that this email is free of malicious content or virus.



More information about the Qt-interest-old mailing list