解决索引提示弹窗会挡住模态窗口的问题

This commit is contained in:
iaom 2023-04-24 17:36:37 +08:00
parent e5e62cd3f7
commit e7676c887a
2 changed files with 19 additions and 9 deletions

View File

@ -105,10 +105,10 @@ MainWindow::~MainWindow() {
delete m_askDialog;
m_askDialog = NULL;
}
if(m_askTimer) {
delete m_askTimer;
m_askTimer = NULL;
}
// if(m_askTimer) {
// delete m_askTimer;
// m_askTimer = NULL;
// }
if(m_searchGsettings) {
delete m_searchGsettings;
m_searchGsettings = NULL;
@ -312,9 +312,19 @@ double MainWindow::getTransparentData() {
}
void MainWindow::initTimer() {
m_askTimer = new QTimer;
m_askTimer = new QTimer(this);
m_askTimer->setInterval(ASK_INDEX_TIME);
connect(m_askTimer, &QTimer::timeout, this, [ = ]() {
QWindow *modal = QGuiApplication::modalWindow();
if(modal) {
m_askTimer->stop();
connect(modal, &QWindow::visibleChanged, this, [ & ](bool visible){
if(!visible) {
m_askTimer->start();
}
}, Qt::UniqueConnection);
return;
}
if(this->isVisible()) {
m_isAskDialogVisible = true;
kdk::UkuiStyleHelper::self()->removeHeader(m_askDialog);

View File

@ -92,11 +92,11 @@ void FileSearchPlugin::openAction(int actionkey, QString key, int type)
case 0:
if(FileUtils::openFile(key) == -1) {
QMessageBox msgBox(m_detailPage);
msgBox.setWindowModality(Qt::WindowModal);
msgBox.setModal(true);
msgBox.addButton(tr("Yes"), QMessageBox::YesRole);
msgBox.setIcon(QMessageBox::Information);
msgBox.setText(tr("Can not get a default application for opening %1.").arg(key));
msgBox.exec();
msgBox.open();
}
break;
case 1:
@ -203,11 +203,11 @@ void FileSearchPlugin::initDetailPage()
connect(m_actionLabel1, &ActionLabel::actionTriggered, [ & ](){
if(FileUtils::openFile(m_currentActionKey) == -1) {
QMessageBox msgBox(m_detailPage);
msgBox.setWindowModality(Qt::WindowModal);
msgBox.setModal(true);
msgBox.addButton(tr("Yes"), QMessageBox::YesRole);
msgBox.setIcon(QMessageBox::Information);
msgBox.setText(tr("Can not get a default application for opening %1.").arg(m_currentActionKey));
msgBox.exec();
msgBox.open();
}
});
connect(m_actionLabel2, &ActionLabel::actionTriggered, [ & ](){