//mainwindow.h QWidget *widget;
QPushButton *button; QTextEdit *edit1; QFormLayout *formL; MainWindow::MainWindow(QWidget *parent):QMainWindow(parent) { setGeometry(0,0,800,600); widget = new QWidget(this); widget->resize(size()); button = new QPushButton("Click me!!",widget); button->setGeometry(5,5,100,25); button->setFixedSize(100,25); button->show(); edit1 = new QTextEdit(widget); edit1->setGeometry(5,35,widget->width()-10, widget->height()-40); edit1->show(); formL = new QFormLayout(widget); formL->addWidget(button); formL->addWidget(edit1); widget->setLayout(formL); widget->show(); } With this code, my textedit(edit1) is not moving vertically, although it's moving horizontally when resizing the mainwindow. Edit1's initial height is also less. I want the initial height of the edit should be 5 unit less from the bottom and 35 units less from the top as there's a pushbutton for 25 units at the top. And edit1 should also resize vertically. Pushbutton is working fine I have set it to be fixed size so it is ok. Edit1 should be resizing according to the mainwindow both vertically and horizontally. Sent: Tuesday, May 08, 2012 1:53 PM To: Sujan Dasmahapatra Cc: interest@qt-project.org Subject: Re: [Interest] QTextEdit not resizing with QFormLayout Use layouts, not absolute positioning. Read the docs about it. On Tue, May 8, 2012 at 11:13 AM, Sujan Dasmahapatra <s...@lmwindpower.com> wrote: Please check this code snippet, with this when I resize the mainwindow, my textedit is not resizing. What could be the problem pls help. //mainwindow.h QPushButton *button; QTextEdit *edit; QFormLayout *formL; //mainwindow.cpp MainWindow::MainWindow(QWidget *parent):QMainWindow(parent) { setGeometry(0,0,800,600); button = new QPushButton("Click me!!",this); button->setGeometry(5,5,100,25); button->show(); edit1 = new QTextEdit(this); edit1->setGeometry(5, 35, width()-10, height()-40); edit1->show(); formL = new QFormLayout; formL->addRow(("&Name:"), edit1); setLayout(formL); } Thanks sujan _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest
_______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest