use setWindowFlags() instead of setWindowFlag on Qt<5.9

Fixes:
src/gui/CloneDialog.cpp:32:5: error: use of undeclared identifier 'setWindowFlag'
    setWindowFlag(Qt::WindowContextHelpButtonHint, false);
    ^

void QWidget::setWindowFlag(Qt::WindowType flag, bool on = true)
--> This function was introduced in Qt 5.9.
This commit is contained in:
tenzap 2023-05-02 10:04:37 +02:00 committed by Jonathan White
parent eddd97fbab
commit d5d9a4c08c
3 changed files with 12 additions and 0 deletions

View File

@ -29,7 +29,11 @@ CloneDialog::CloneDialog(DatabaseWidget* parent, Database* db, Entry* entry)
m_ui->setupUi(this); m_ui->setupUi(this);
window()->layout()->setSizeConstraint(QLayout::SetFixedSize); window()->layout()->setSizeConstraint(QLayout::SetFixedSize);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
setWindowFlag(Qt::WindowContextHelpButtonHint, false); setWindowFlag(Qt::WindowContextHelpButtonHint, false);
#else
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
#endif
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close())); connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));

View File

@ -36,7 +36,11 @@ DatabaseOpenDialog::DatabaseOpenDialog(QWidget* parent)
{ {
setWindowTitle(tr("Unlock Database - KeePassXC")); setWindowTitle(tr("Unlock Database - KeePassXC"));
setWindowFlags(Qt::Dialog); setWindowFlags(Qt::Dialog);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
setWindowFlag(Qt::WindowContextHelpButtonHint, false); setWindowFlag(Qt::WindowContextHelpButtonHint, false);
#else
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
#endif
#ifdef Q_OS_LINUX #ifdef Q_OS_LINUX
// Linux requires this to overcome some Desktop Environments (also no Quick Unlock) // Linux requires this to overcome some Desktop Environments (also no Quick Unlock)
setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint); setWindowFlags(windowFlags() | Qt::WindowStaysOnTopHint);

View File

@ -29,7 +29,11 @@ TotpSetupDialog::TotpSetupDialog(QWidget* parent, Entry* entry)
{ {
m_ui->setupUi(this); m_ui->setupUi(this);
setAttribute(Qt::WA_DeleteOnClose); setAttribute(Qt::WA_DeleteOnClose);
#if QT_VERSION >= QT_VERSION_CHECK(5, 9, 0)
setWindowFlag(Qt::WindowContextHelpButtonHint, false); setWindowFlag(Qt::WindowContextHelpButtonHint, false);
#else
setWindowFlags(windowFlags() & ~Qt::WindowContextHelpButtonHint);
#endif
setFixedSize(sizeHint()); setFixedSize(sizeHint());
connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close())); connect(m_ui->buttonBox, SIGNAL(rejected()), SLOT(close()));