Always activate DatabaseOpenDialog on Windows

Fixes #5390
This commit is contained in:
Janek Bevendorff 2020-12-30 15:22:54 +01:00
parent 66f5a8736a
commit 49d2b87889

View File

@ -20,12 +20,19 @@
#include "DatabaseWidget.h" #include "DatabaseWidget.h"
#include "core/Database.h" #include "core/Database.h"
#ifdef Q_OS_WIN
#include <QtPlatformHeaders/QWindowsWindowFunctions>
#endif
DatabaseOpenDialog::DatabaseOpenDialog(QWidget* parent) DatabaseOpenDialog::DatabaseOpenDialog(QWidget* parent)
: QDialog(parent) : QDialog(parent)
, m_view(new DatabaseOpenWidget(this)) , m_view(new DatabaseOpenWidget(this))
{ {
setWindowTitle(tr("Unlock Database - KeePassXC")); setWindowTitle(tr("Unlock Database - KeePassXC"));
setWindowFlags(Qt::Dialog | Qt::WindowStaysOnTopHint); setWindowFlags(Qt::Dialog | Qt::WindowStaysOnTopHint);
#ifdef Q_OS_WIN
QWindowsWindowFunctions::setWindowActivationBehavior(QWindowsWindowFunctions::AlwaysActivateWindow);
#endif
connect(m_view, SIGNAL(dialogFinished(bool)), this, SLOT(complete(bool))); connect(m_view, SIGNAL(dialogFinished(bool)), this, SLOT(complete(bool)));
auto* layout = new QVBoxLayout(); auto* layout = new QVBoxLayout();
layout->setMargin(0); layout->setMargin(0);