您好,感谢浏览本贴。
有一个dialog窗体,我想将他最小化到系统托盘,代码如下:
void Dialog::changeEvent(QEvent *e)
{
QDialog::changeEvent(e);
switch (e->type()) {
case QEvent::LanguageChange:
ui->retranslateUi(this);
break;
case QEvent::WindowStateChange:
if(isMinimized())
{
QTimer::singleShot(0, this, SLOT(hide()));
}
default:
break;
}
}
OK,能成功实现。
然后想将其恢复显示,右键menu里的restore,代码如下:
restoreAction = new QAction(tr("&Restore"), this);
connect(restoreAction, SIGNAL(triggered()), this, SLOT(shownormal()));
参考的是Qt的demo,现在的问题是,窗口重新弹出后,一片漆黑,什么也看不到。用了各种方法无济于事,求达人指点,拜谢。