[Interest] resizing child window with parent window

Andre Haupt andre at bitwigglers.org
Mon May 7 16:20:40 CEST 2012


On Mon, May 07, 2012 at 03:49:45PM +0200, Sujan Dasmahapatra wrote:
> Please give me some idea on resizing the child window. I have parent
> widget, when resizing this parent widget, I want all my other child
> widgets should also resize accordingly.
> 
>  
> 
> I have tried with QFormLayout, with formlayout, the widget's size is
> changing, e.g a pushbutton is coming horizontally as long as the parent
> widget, although I am specifying a size for 100,25 width and height.
> 
>  
> 
> Please give me some suggestion. Check this snippet.
> 
>  
> 
> CSheet::CSheet(QWidget *parent):QWidget(parent)
> 
> {
> 
>    setGeometry(0,0,600,400);
> 
>    QPushButton *button = new QPushButton("Add chart", this);
> 
>    button->setGeometry(5,5,100,25);
> 
>    button->show();
> 
>  
> 
>   QTextEdit *edit = new QTextEdit(this);
> 
>   edit->setGeometry(5, 35, width()-10, height()-40);
> 
>   edit->show();
> 
> }

CSheet::CSheet(QWiget *parent) : QWigdet(parent)
{
    QPushButton *button = new QPushButton("Add foo", this);
    QTextEdit *edit = new QTextEdit(this);

    QVBoxLayout *layout = new QVBoxLayout(this);
    layout->addWidget(button);
    layout->addWidget(edit);
}




More information about the Interest mailing list