本文整理汇总了C++中QMessageBox::checkBox方法的典型用法代码示例。如果您正苦于以下问题:C++ QMessageBox::checkBox方法的具体用法?C++ QMessageBox::checkBox怎么用?C++ QMessageBox::checkBox使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QMessageBox
的用法示例。
在下文中一共展示了QMessageBox::checkBox方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: open
void WindowsManager::open(BookmarksItem *bookmark, OpenHints hints)
{
if (!bookmark)
{
return;
}
Window *window = m_mainWindow->getWorkspace()->getActiveWindow();
if (hints == DefaultOpen && ((window && Utils::isUrlEmpty(window->getUrl())) || SettingsManager::getValue(QLatin1String("Browser/ReuseCurrentTab")).toBool()))
{
hints = CurrentTabOpen;
}
switch (static_cast<BookmarksModel::BookmarkType>(bookmark->data(BookmarksModel::TypeRole).toInt()))
{
case BookmarksModel::UrlBookmark:
open(QUrl(bookmark->data(BookmarksModel::UrlRole).toUrl()), hints);
break;
case BookmarksModel::RootBookmark:
case BookmarksModel::FolderBookmark:
{
const QList<QUrl> urls = bookmark->getUrls();
bool canOpen = true;
if (urls.count() > 1 && SettingsManager::getValue(QLatin1String("Choices/WarnOpenBookmarkFolder")).toBool())
{
QMessageBox messageBox;
messageBox.setWindowTitle(tr("Question"));
messageBox.setText(tr("You are about to open %n bookmark(s).", "", urls.count()));
messageBox.setInformativeText(tr("Do you want to continue?"));
messageBox.setIcon(QMessageBox::Question);
messageBox.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
messageBox.setDefaultButton(QMessageBox::Yes);
messageBox.setCheckBox(new QCheckBox(tr("Do not show this message again")));
if (messageBox.exec() == QMessageBox::Cancel)
{
canOpen = false;
}
SettingsManager::setValue(QLatin1String("Choices/WarnOpenBookmarkFolder"), !messageBox.checkBox()->isChecked());
}
if (urls.isEmpty() || !canOpen)
{
return;
}
open(urls.at(0), hints);
for (int i = 1; i < urls.count(); ++i)
{
open(urls.at(i), ((hints == DefaultOpen || hints.testFlag(CurrentTabOpen)) ? NewTabOpen : hints));
}
}
break;
default:
break;
}
}
示例2: acceptNavigationRequest
cancel = !dialog.isAccepted();
warn = !dialog.getCheckBoxState();
}
else
{
QMessageBox dialog;
dialog.setWindowTitle(tr("Question"));
dialog.setText(tr("Are you sure that you want to send form data again?"));
dialog.setInformativeText(tr("Do you want to resend data?"));
dialog.setIcon(QMessageBox::Question);
dialog.setStandardButtons(QMessageBox::Yes | QMessageBox::Cancel);
dialog.setDefaultButton(QMessageBox::Cancel);
dialog.setCheckBox(new QCheckBox(tr("Do not show this message again")));
cancel = (dialog.exec() == QMessageBox::Cancel);
warn = !dialog.checkBox()->isChecked();
}
SettingsManager::setValue(QLatin1String("Choices/WarnFormResend"), warn);
if (cancel)
{
return false;
}
}
return QWebPage::acceptNavigationRequest(frame, request, type);
}
bool QtWebKitWebPage::javaScriptConfirm(QWebFrame *frame, const QString &message)
{
示例3: config
QSharedPointer<CompositeKey> DatabaseOpenWidget::databaseKey()
{
auto masterKey = QSharedPointer<CompositeKey>::create();
if (m_ui->checkPassword->isChecked()) {
masterKey->addKey(QSharedPointer<PasswordKey>::create(m_ui->editPassword->text()));
}
#ifdef WITH_XC_TOUCHID
// check if TouchID is available and enabled for unlocking the database
if (m_ui->checkTouchID->isChecked() && TouchID::getInstance().isAvailable()
&& m_ui->editPassword->text().isEmpty()) {
// clear empty password from composite key
masterKey->clear();
// try to get, decrypt and use PasswordKey
QSharedPointer<QByteArray> passwordKey = TouchID::getInstance().getKey(m_filename);
if (passwordKey != NULL) {
// check if the user cancelled the operation
if (passwordKey.isNull())
return QSharedPointer<CompositeKey>();
masterKey->addKey(PasswordKey::fromRawKey(*passwordKey));
}
}
#endif
QHash<QString, QVariant> lastKeyFiles = config()->get("LastKeyFiles").toHash();
QHash<QString, QVariant> lastChallengeResponse = config()->get("LastChallengeResponse").toHash();
if (m_ui->checkKeyFile->isChecked()) {
auto key = QSharedPointer<FileKey>::create();
QString keyFilename = m_ui->comboKeyFile->currentText();
QString errorMsg;
if (!key->load(keyFilename, &errorMsg)) {
m_ui->messageWidget->showMessage(tr("Failed to open key file: %1").arg(errorMsg), MessageWidget::Error);
return {};
}
if (key->type() != FileKey::Hashed && !config()->get("Messages/NoLegacyKeyFileWarning").toBool()) {
QMessageBox legacyWarning;
legacyWarning.setWindowTitle(tr("Legacy key file format"));
legacyWarning.setText(tr("You are using a legacy key file format which may become\n"
"unsupported in the future.\n\n"
"Please consider generating a new key file."));
legacyWarning.setIcon(QMessageBox::Icon::Warning);
legacyWarning.addButton(QMessageBox::Ok);
legacyWarning.setDefaultButton(QMessageBox::Ok);
legacyWarning.setCheckBox(new QCheckBox(tr("Don't show this warning again")));
connect(legacyWarning.checkBox(), &QCheckBox::stateChanged, [](int state) {
config()->set("Messages/NoLegacyKeyFileWarning", state == Qt::CheckState::Checked);
});
legacyWarning.exec();
}
masterKey->addKey(key);
lastKeyFiles[m_filename] = keyFilename;
} else {
lastKeyFiles.remove(m_filename);
}
if (m_ui->checkChallengeResponse->isChecked()) {
lastChallengeResponse[m_filename] = true;
} else {
lastChallengeResponse.remove(m_filename);
}
if (config()->get("RememberLastKeyFiles").toBool()) {
config()->set("LastKeyFiles", lastKeyFiles);
}
#ifdef WITH_XC_YUBIKEY
if (config()->get("RememberLastKeyFiles").toBool()) {
config()->set("LastChallengeResponse", lastChallengeResponse);
}
if (m_ui->checkChallengeResponse->isChecked()) {
int selectionIndex = m_ui->comboChallengeResponse->currentIndex();
int comboPayload = m_ui->comboChallengeResponse->itemData(selectionIndex).toInt();
// read blocking mode from LSB and slot index number from second LSB
bool blocking = comboPayload & 1;
int slot = comboPayload >> 1;
auto key = QSharedPointer<YkChallengeResponseKey>(new YkChallengeResponseKey(slot, blocking));
masterKey->addChallengeResponseKey(key);
}