16 QGroupBox* pgr =
new QGroupBox(pstyle->metaObject()->className());
17 QScrollBar* psbr =
new QScrollBar(Qt::Horizontal);
18 QCheckBox* pchk =
new QCheckBox(
"&Check Box");
19 QSlider* psld =
new QSlider(Qt::Horizontal);
20 QRadioButton* prad =
new QRadioButton(
"&Radio Button");
21 QPushButton* pcmd =
new QPushButton(
"&Push Button");
24 QVBoxLayout* pvbxLayout =
new QVBoxLayout;
25 pvbxLayout->addWidget(psbr);
26 pvbxLayout->addWidget(pchk);
27 pvbxLayout->addWidget(psld);
28 pvbxLayout->addWidget(prad);
29 pvbxLayout->addWidget(pcmd);
30 pgr->setLayout(pvbxLayout);
32 QList<QWidget*> pwgtList = pgr->findChildren<QWidget*>();
33 foreach(QWidget* pwgt, pwgtList) {
34 pwgt->setStyle(pstyle);
40 int main(
int argc,
char** argv)
42 QApplication app(argc, argv);
46 QHBoxLayout* phbxLayout =
new QHBoxLayout;
47 foreach (QString str, QStyleFactory::keys()) {
48 phbxLayout->addWidget(
styledWidget(QStyleFactory::create(str)));
50 wgt.setLayout(phbxLayout);
QWidget * styledWidget(QStyle *pstyle)
int main(int argc, char **argv)