[Qt-interest] What's the deal with centralWidgets (Qmainwindow) and QLayouts

S. Aguinaga sa_jr at yahoo.com
Wed Jan 14 18:19:46 CET 2009



To design a central widget consisting of 3 vhboxlayouts what is the right way to set the 
layout?  I have tried using QVBoxes inside of QHBoxes, QGrids, an GroupBoxes, and I get the same 
error message when the window opens.  I'm sure I'm missing something fundamental.


I have widgets (pusbuttons, labels, &c. ) on 3 diff vboxes, then one QHBoxLayout that I 
want to add the vboxes, but I keep getting a warning when I run the program I get:

"QLayout: Attempting to add QLayout "" to ToneAudWindow "", which already has a layout"

and I haven't found a useful answer.

[code]
ToneWindow::ToneWindow() {  
  createDockingPanels();  //these are fine
  createCentralWidget();
}
void ToneWindow::createCentralWidget() {
  QGroupBox   *groupBox = new QGroupBox(tr("G1"));
    
    freqLCD        = new QLCDNumber(5);
    freqLCD->setSegmentStyle(QLCDNumber::Filled);
    freqLCD->display( 400 );
    vbox_c0 = new QVBoxLayout(this); // here I have only one Vertical group box
    vbox_c0->addWidget(new QLabel(tr("Frequency")));
    vbox_c0->addWidget(freqLCD);
    groupBox->setLayout(vbox_c0);
    setCentralWidget(groupBox);
}
[/code]

Reference: 
http://lists.trolltech.com/qt-interest/2008-06/thread00514-0.html

Please, any help will be appreciated.

// Sal


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20090114/0e81778f/attachment.html 


More information about the Qt-interest-old mailing list