QGroupBox problem

I'm just plpaying with the examples and some code I found at QT to make group boxes. I've just edited the sample 'Scene Information Panel' whilst I figure things out.

Anyway, this code partly works, but for some reason is not showing the frame or the title, see screenshot.

Here's the segment of my code...

Any thoughts ? The inserted code is taken directly from an example in the QT docs.

 

	QGroupBox *groupBox = new QGroupBox(tr("Exclusive Radio Buttons"));	QRadioButton *radio1 = new QRadioButton(tr("&Radio button 1"));	QRadioButton *radio2 = new QRadioButton(tr("R&adio button 2"));	QRadioButton *radio3 = new QRadioButton(tr("Ra&dio button 3"));	radio1->setChecked(true);	// Define the layout for the pane	QVBoxLayout *mainLyt = new QVBoxLayout();	mainLyt->setMargin( margin );	mainLyt->setSpacing( margin );		mainLyt->addWidget(radio1);	mainLyt->addWidget(radio2);	mainLyt->addWidget(radio3);	mainLyt->addStretch(1);	groupBox->setLayout(mainLyt);	// Use a text browser for the output window - this supports basic html/rtf formatting	m_output = new QTextBrowser();	m_output->setObjectName( "SceneInfoTxtBrwsr" );	m_output->setMinimumSize( c_minWidth, c_minHeight );	mainLyt->addWidget( m_output );		// Set the layout for the pane	setLayout( mainLyt );

 

Comments

  • Widdershins StudioWiddershins Studio Posts: 539
    edited November 2015

    After a bit of fiddling I found a solution. For anyone else...

     

    QGroupBox *groupBox = new QGroupBox(tr("Exclusive Radio Buttons"));QRadioButton *radio1 = new QRadioButton(tr("&Radio button 1"));QRadioButton *radio2 = new QRadioButton(tr("R&adio button 2"));QRadioButton *radio3 = new QRadioButton(tr("Ra&dio button 3"));radio1->setChecked(true);QGridLayout *gLay = new QGridLayout(groupBox);gLay->addWidget(radio1);gLay->addWidget(radio2);gLay->addWidget(radio3);

     

     

    Then just add groupBox to your layout.

     

    myLayout->addWidget(groupBox);

     

    Post edited by Widdershins Studio on
Sign In or Register to comment.