From cbb775322752c20d47ac7ec5401f455a89cac3fd Mon Sep 17 00:00:00 2001 From: Megamouse Date: Thu, 6 Jul 2017 12:38:53 +0200 Subject: [PATCH] msg_dialog_frame: hidpi fixes for m_dialog move spacings up --- rpcs3/rpcs3qt/msg_dialog_frame.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/rpcs3/rpcs3qt/msg_dialog_frame.cpp b/rpcs3/rpcs3qt/msg_dialog_frame.cpp index 71db2ca92d..e6e95e60a2 100644 --- a/rpcs3/rpcs3qt/msg_dialog_frame.cpp +++ b/rpcs3/rpcs3qt/msg_dialog_frame.cpp @@ -9,6 +9,9 @@ inline QString qstr(const std::string& _in) { return QString::fromUtf8(_in.data( void msg_dialog_frame::Create(const std::string& msg) { + static const auto& barWidth = [](){return QLabel("This is the very length of the progressbar due to hidpi reasons.").sizeHint().width();}; + static const auto& horizontalSpacing = []() {return QLabel("Ora").sizeHint().width(); }; + static const auto& verticalSpacing = []() {return QLabel("Ora Ora").sizeHint().width(); }; static int dialog_nr; static int dialog_count; ++dialog_count; @@ -37,7 +40,7 @@ void msg_dialog_frame::Create(const std::string& msg) text = new QLabel("", m_dialog); bar = new QProgressBar(m_dialog); bar->setRange(0, m_gauge_max); - bar->setFixedWidth(300); + bar->setFixedWidth(barWidth()); bar->setAlignment(Qt::AlignCenter); QHBoxLayout* barLayout = new QHBoxLayout; @@ -132,8 +135,8 @@ void msg_dialog_frame::Create(const std::string& msg) const int max_x = screensize.width() - min_x; const int min_y = screensize.height() / 10; const int max_y = screensize.height() - min_y; - const int s_width = 30 + m_dialog->frameSize().width(); - const int s_height = 60 + m_dialog->frameSize().height(); + const int s_width = horizontalSpacing() + m_dialog->frameSize().width(); + const int s_height = verticalSpacing() + m_dialog->frameSize().height(); const int max_dialogs_x = std::max(1, (max_x - min_x) / s_width); const int max_dialogs_y = std::max(1, (max_y - min_y) / s_height); int dialogs_x = std::min(max_dialogs_x, thread_count); @@ -187,6 +190,7 @@ void msg_dialog_frame::Create(const std::string& msg) dialog_nr = 0; } + m_dialog->layout()->setSizeConstraint(QLayout::SetFixedSize); m_dialog->show(); #ifdef _WIN32