bool DialogMsg::ShowUIOKDoNotShowOption( const QString& title,const QString& msg ) { QCheckBox * checkBox = new QCheckBox( tr( "do not show this dialog again" ),this ) ; this->setFixedSize( 270,110 ) ; checkBox->setGeometry( 30,40,251,31 ) ; m_ui->label->setGeometry( 10,10,251,31 ) ; m_ui->label->setFixedSize( m_ui->label->size() ) ; m_ui->pbOk->setGeometry( 100,70,75,31 ) ; m_ui->pbYes->setHidden( true ) ; m_ui->pbNo->setHidden( true ) ; m_ui->pbOk->setHidden( false ) ; this->HideLabels() ; this->ShowUI( title,msg ) ; bool st = checkBox->isChecked() ; checkBox->deleteLater() ; return st ; }
void Notepadqq::showQtVersionWarning(bool showCheckBox, QWidget *parent) { QSettings settings; QString dir = QDir::toNativeSeparators(QDir::homePath() + "/Qt"); QString altDir = "/opt/Qt"; QMessageBox msgBox(parent); msgBox.setWindowTitle(QCoreApplication::applicationName()); msgBox.setIcon(QMessageBox::Warning); msgBox.setText("<h3>" + QObject::tr("You are using an old version of Qt (%1)").arg(qVersion()) + "</h3>"); msgBox.setInformativeText("<html><body>" "<p>" + QObject::tr("Notepadqq will try to do its best, but <b>some things will not work properly</b>.") + "</p>" + QObject::tr( "Install a newer Qt version (≥ %1) from the official repositories " "of your distribution.<br><br>" "If it's not available, download Qt (≥ %1) from %2 and install it to \"%3\" or to \"%4\"."). arg("5.3"). arg("<nobr><a href=\"http://qt-project.org/\">http://qt-project.org/</a></nobr>"). arg("<nobr>" + dir + "</nobr>"). arg("<nobr>" + altDir + "</nobr>") + "</body></html>"); QCheckBox *chkDontShowAgain; if (showCheckBox) { chkDontShowAgain = new QCheckBox(); chkDontShowAgain->setText(QObject::tr("Don't show me this warning again")); msgBox.setCheckBox(chkDontShowAgain); } msgBox.exec(); if (showCheckBox) { settings.setValue("checkQtVersionAtStartup", !chkDontShowAgain->isChecked()); chkDontShowAgain->deleteLater(); } }