[Qt-interest] Frame ?

Bradley Smith bradley at baysmith.com
Thu Nov 19 07:26:53 CET 2009


An actual QFrame doesn't have text on its line. For that, use a
QGroupBox. Here is example code.

#include <QtGui>

#define FRAME_WITH_TITLE 1

int main(int argc, char *argv[])
{
    QApplication app(argc, argv);

#if !FRAME_WITH_TITLE
    QFrame frame;
#else
    QGroupBox frame;
    frame.setTitle("Frame Title");
#endif

    QVBoxLayout *layout = new QVBoxLayout(&frame);
    frame.setLayout(layout);

    QPushButton *button1 = new QPushButton("Button 1", &frame);
    layout->addWidget(button1);

    QPushButton *button2 = new QPushButton("Button 2", &frame);
    layout->addWidget(button2);

    QPushButton *button3 = new QPushButton("Button 3", &frame);
    layout->addWidget(button3);

    frame.show();

    return app.exec();
}



More information about the Qt-interest-old mailing list