QT按钮显示和隐藏

来源:互联网 发布:淘宝哪里有贷款 编辑:程序博客网 时间:2024/05/21 21:37

//创建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();
}


0 0
原创粉丝点击