hemrajn
21st April 2009, 11:57
hi all,
i am new to QT programming, i want to create a Dockwidget and it contain some label and text box layout, for that i create a QDockwidget object and i create QGridLayout object and addWidget as label and text box.
while setting the layout to dockwidget it not showing the layout.
here my code:
dwidget = new QDockWidget(tr("&Name"), this);
dwidget->setAllowedAreas(Qt::AllDockWidgetAreas);
dwidget->setFeatures(QDockWidget::DockWidgetMovable|QDockWi dget::AllDockWidgetFeatures);
dwidget->setObjectName("NEW Widget");
dwidget->setWindowTitle("NewDock");
label1 = new QLabel("Name: ");
txtEdit = new QLineEdit;
mainLayout = new QGridLayout();
mainLayout->addWidget(label1, 0, 0);
mainLayout->addWidget(txtEdit, 0, 1);
dwidget->setLayout(mainLayout);
addDockWidget(Qt::RightDockWidgetArea, dwidget);
it complies success but while running the program its not showing any layout on dockwidget.
is there any solution for this?
Regards.
hemraj
i am new to QT programming, i want to create a Dockwidget and it contain some label and text box layout, for that i create a QDockwidget object and i create QGridLayout object and addWidget as label and text box.
while setting the layout to dockwidget it not showing the layout.
here my code:
dwidget = new QDockWidget(tr("&Name"), this);
dwidget->setAllowedAreas(Qt::AllDockWidgetAreas);
dwidget->setFeatures(QDockWidget::DockWidgetMovable|QDockWi dget::AllDockWidgetFeatures);
dwidget->setObjectName("NEW Widget");
dwidget->setWindowTitle("NewDock");
label1 = new QLabel("Name: ");
txtEdit = new QLineEdit;
mainLayout = new QGridLayout();
mainLayout->addWidget(label1, 0, 0);
mainLayout->addWidget(txtEdit, 0, 1);
dwidget->setLayout(mainLayout);
addDockWidget(Qt::RightDockWidgetArea, dwidget);
it complies success but while running the program its not showing any layout on dockwidget.
is there any solution for this?
Regards.
hemraj