diff --git a/src/qt/pivx/qtutils.cpp b/src/qt/pivx/qtutils.cpp index 43ca66a64800f..23d6629ca5e13 100644 --- a/src/qt/pivx/qtutils.cpp +++ b/src/qt/pivx/qtutils.cpp @@ -20,6 +20,9 @@ Qt::Modifier SHORT_KEY = Qt::ALT; #endif +// forward declaration +bool openDialogWithOpaqueBackgroundImpl(QDialog* widget, PIVXGUI* gui, double posX, int posY, Qt::WindowType windowFlags); + // Open dialog at the bottom bool openDialog(QDialog* widget, QWidget* gui) { @@ -59,7 +62,22 @@ void openDialogFullScreen(QWidget* parent, QWidget* dialog) bool openDialogWithOpaqueBackgroundY(QDialog* widget, PIVXGUI* gui, double posX, int posY) { - widget->setWindowFlags(Qt::CustomizeWindowHint); + return openDialogWithOpaqueBackgroundImpl(widget, gui, posX, posY, Qt::CustomizeWindowHint); +} + +bool openDialogWithOpaqueBackground(QDialog* widget, PIVXGUI* gui, double posX) +{ + return openDialogWithOpaqueBackgroundY(widget, gui, posX, 5); +} + +bool openDialogWithOpaqueBackground(QDialog* widget, PIVXGUI* gui, Qt::WindowType windowFlags, double posX) +{ + return openDialogWithOpaqueBackgroundImpl(widget, gui, posX, 5, windowFlags); +} + +bool openDialogWithOpaqueBackgroundImpl(QDialog* widget, PIVXGUI* gui, double posX, int posY, Qt::WindowType windowFlags) +{ + widget->setWindowFlags(windowFlags); widget->setAttribute(Qt::WA_TranslucentBackground, true); QPropertyAnimation* animation = new QPropertyAnimation(widget, "pos"); animation->setDuration(300); @@ -74,11 +92,6 @@ bool openDialogWithOpaqueBackgroundY(QDialog* widget, PIVXGUI* gui, double posX, return res; } -bool openDialogWithOpaqueBackground(QDialog* widget, PIVXGUI* gui, double posX) -{ - return openDialogWithOpaqueBackgroundY(widget, gui, posX, 5); -} - bool openDialogWithOpaqueBackgroundFullScreen(QDialog* widget, PIVXGUI* gui) { widget->setWindowFlags(Qt::CustomizeWindowHint); diff --git a/src/qt/pivx/qtutils.h b/src/qt/pivx/qtutils.h index eaa432efa3631..1d659ef1856dd 100644 --- a/src/qt/pivx/qtutils.h +++ b/src/qt/pivx/qtutils.h @@ -37,6 +37,7 @@ void closeDialog(QDialog* widget, PIVXGUI* gui); void openDialogFullScreen(QWidget* parent, QWidget* dialog); bool openDialogWithOpaqueBackgroundY(QDialog* widget, PIVXGUI* gui, double posX = 3, int posY = 5); bool openDialogWithOpaqueBackground(QDialog* widget, PIVXGUI* gui, double posX = 3); +bool openDialogWithOpaqueBackground(QDialog* widget, PIVXGUI* gui, Qt::WindowType windowFlags, double posX = 3); bool openDialogWithOpaqueBackgroundFullScreen(QDialog* widget, PIVXGUI* gui); // diff --git a/src/qt/pivx/topbar.cpp b/src/qt/pivx/topbar.cpp index 2b9e9f02a8394..3f56a93ad79bf 100644 --- a/src/qt/pivx/topbar.cpp +++ b/src/qt/pivx/topbar.cpp @@ -334,7 +334,7 @@ void TopBar::onBtnReceiveClicked() showHideOp(true); ReceiveDialog *receiveDialog = new ReceiveDialog(window); receiveDialog->updateQr(addressStr); - if (openDialogWithOpaqueBackground(receiveDialog, window)) { + if (openDialogWithOpaqueBackground(receiveDialog, window, Qt::Popup)) { inform(tr("Address Copied")); } receiveDialog->deleteLater();