how to place QWidget widget in the center of QHboxlayout



  •   QVBoxLayout* vlayout = new QVBoxLayout;
      QHBoxLayout* hlayout = new QHBoxLayout;
      textBrowser_1 = new QTextEdit;
      textBrowser_2 = new QTextEdit;
      QWidget* widget = new QWidget; 
      splitter =new QSplitter(Qt::Horizontal,this);
      splitter->addWidget(textBrowser_1); 
      splitter->addWidget(textBrowser_2); 
    
      button1 = new QPushButton("OK");
      button2 = new QPushButton("Cancel");
      hlayout->addWidget(button1);
      hlayout->addWidget(button2);
      widget->setLayout(hlayout);
      widget->setMaximumWidth(200);
    
      vlayout->addWidget(splitter);
      vlayout->addWidget(widget);
      button1->setMaximumHeight(40);
      button1->setMaximumHeight(40);
      button1->setMaximumWidth(75);
      button1->setMaximumWidth(75);
    
      button2->setMaximumHeight(40);
      button2->setMaximumHeight(40);
      button2->setMaximumWidth(75);
      button2->setMaximumWidth(75);
    

    basically I want to place the two buttons ate the center of my Widget how to do that ?



  • hlayout->addStretch();
    hlayout->addWidget(button1);
    hlayout->addWidget(button2);
    hlayout->addStretch();
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.