QT按钮显示和隐藏

//创建GroupBox,将按钮放置进去

ui.groupBox->setGeometry(100, 100, 150, 50);

// int x=ui.groupBox->geometry().x();
// int y=ui.groupBox->geometry().y();
// qDebug() << x;
// qDebug() << y;
//layout->setGeometry(QRect(0, 0, 10 ,10));
ui.groupBox->setVisible(false);
ui.oneButton->setGeometry(QRect(0,0, 50, 50));
ui.twoButton->setGeometry(QRect(50, 0, 50, 50));
ui.threeButton->setGeometry(QRect(100, 0, 50, 50));
ui.showButton->setGeometry(QRect(250, 100, 50, 50));
connect(ui.oneButton, SIGNAL(clicked()), this, SLOT(hideGroup()));

connect(ui.showButton, SIGNAL(clicked()), this, SLOT(showGroup()));

//槽函数

void myButton1::hideGroup()
{
ui.groupBox->hide();
}
void myButton1::showGroup()
{
ui.groupBox->show();
}


你可能感兴趣的:(QT)