[Qt-interest] What's the deal with centralWidgets (Qmainwindow) and QLayouts
Alexandre Beraud
aberaud at infflux.com
Wed Jan 14 18:54:07 CET 2009
Hi,
Replace line:
vbox_c0 = new QVBoxLayout(this);
with:
vbox_c0 = new QVBoxLayout;
Regards,
Alex
S. Aguinaga a écrit :
>
> 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
> <http://lists.trolltech.com/qt-interest/2008-06/thread00514-0.html>
>
> Please, any help will be appreciated.
>
> // Sal
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at trolltech.com
> http://lists.trolltech.com/mailman/listinfo/qt-interest
>
--
BERAUD Alexandre
Ingénieur Développement
Infflux - Informatique & Flux
Tel: 01 49 57 92 00 - Fax : 01 49 57 92 01
Mail: aberaud at infflux.com
Visitez notre site : www.infflux.com
More information about the Qt-interest-old
mailing list