void MyDialog::on_btnLeft_clicked( void ){ QRect g = geometry(); if (frmRight->isVisible()) { g.setWidth(width() - frmRight->width()); frmRight->setVisible(false); btnLeft->setText("Show right"); } else { g.setWidth(width() + frmRight->width()); setMinimumWidth(minimumWidth()); frmRight->setVisible(true); btnLeft->setText("Hide right"); } setGeometry(g);}
void MyDialog::on_btnLeft_clicked(){ if(frmRight->isVisible()) { frmRight->setVisible(false); btnLeft->setText("Show right"); loMain->setColumnStretch(1,0); QRect g = geometry(); g.setWidth(m_old_width); setGeometry(g); adjustSize(); } else { QRect g = geometry(); m_old_width = g.width(); loMain->setColumnStretch(1,1); frmRight->setVisible(true); btnLeft->setText("Hide right"); }}
void MyDialog::on_btnLeft_clicked(){ QRect g = geometry(); int left, top, right, bottom, spacing; loMain->getContentsMargins(&left, &top, &right, &bottom); spacing = loMain->spacing(); if (frmRight->isVisible()) { g.setWidth(frmLeft->width() + spacing + left + right ); setMinimumWidth(frmLeft->minimumWidth()); setGeometry(g); frmRight->setVisible(false); btnLeft->setText("Show right"); } else { g.setWidth( frmLeft->width() + frmRight->width() + spacing + left + right ); setGeometry(g); setMinimumWidth( frmLeft->minimumWidth() + frmRight->width() + spacing + left + right ); frmRight->setVisible(true); btnLeft->setText("Hide right"); }}