1. 这里的可扩展的对话框指的是可以通过按钮、命令去控制对话框其中一部分显示、隐藏。
如下:
扩展部分显示:
2. 如何实现
(1)设计窗口及布局
(2)实现扩展的窗口必须设定为不可拖拽大小的:
//设置窗口不可改变大小
layout()->setSizeConstraint(QLayout::SetFixedSize);
(3)实现槽函数,通过按钮控制扩展部分的显隐:
void MainWindow::on_ExtendButton_clicked(bool checked)
{
if(ui->ExtendBox->isVisible())
{
ui->ExtendBox->hide();
ui->ExtendButton->setText("扩展信息>>>");
}
else
{
ui->ExtendBox->show();
ui->ExtendButton->setText("扩展信息<<<");
}
}