October 21, 2010

syedasadalibs03 syedasadalib..
Lab Rat
5 posts

QT Newbie ( how to open widget from mainwindow )


I am a Newbie in Qt and i want to know that “how to open widget from mainwindow” Can any one provide the code
i have write some code but widget are not disp—layed.

Thanks in Advance


MainWindow::MainWindow(QWidget *parent) : QMainWindow(parent), ui(new Ui::MainWindow)
{ ui->setupUi(this);

QLabel *label = new QLabel(“Name:”); //QLineEdit *lineEdit = new QLineEdit(); QHBoxLayout *layout = new QHBoxLayout(); layout->addWidget(label , 0, 0); this->setLayout(layout);

void MainWindow::open(){
AnotherMainWindow * w2 = new AnotherMainWindow(this);

//MainWindow.h( i have added in .h)
public slots : void open() ;



1 reply

October 21, 2010

Deleted Member # 4a2 Deleted Member # 4a2
Ant Farmer
1274 posts

hi syed,
there are a whole bunch of examples in the Qt installation folder with sources, try to run one of them and walk through the code, you will be able to solve this on your own :)
Also can you markup your code by enclosing them within @ tags, easier to read

  ‹‹ QFtp strange behavior on ARM (angstrom)      Phonon and mp3-support on embedded device ››

You must log in to post a reply. Not a member yet? Register here!