Qt: settings_dialog layout fix (hack)

This commit is contained in:
Megamouse 2017-09-16 21:09:53 +02:00 committed by Ivan
parent c18e71ca29
commit db51779682
2 changed files with 8 additions and 7 deletions

View File

@ -11,6 +11,7 @@
#include <QSpinBox> #include <QSpinBox>
#include <QApplication> #include <QApplication>
#include <QDesktopWidget> #include <QDesktopWidget>
#include <QTimer>
#include "settings_dialog.h" #include "settings_dialog.h"
@ -985,10 +986,10 @@ void settings_dialog::OnApplyStylesheet()
int settings_dialog::exec() int settings_dialog::exec()
{ {
for (int i = 0; i < ui->tabWidget->count(); i++) // singleShot Hack to fix following bug:
{ // If we use setCurrentIndex now we will miraculously see a resize of the dialog as soon as we
ui->tabWidget->setCurrentIndex(i); // switch to the cpu tab after conjuring the settings_dialog with another tab opened first.
} // Weirdly enough this won't happen if we change the tab order so that anything else is at index 0.
ui->tabWidget->setCurrentIndex(m_tab_Index); QTimer::singleShot(0, [=]{ ui->tabWidget->setCurrentIndex(m_tab_Index); });
return QDialog::exec(); return QDialog::exec();
} }

View File

@ -30,7 +30,7 @@
<bool>true</bool> <bool>true</bool>
</property> </property>
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="MinimumExpanding" vsizetype="MinimumExpanding"> <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -46,7 +46,7 @@
<item> <item>
<layout class="QHBoxLayout" name="horizontalLayout_2"> <layout class="QHBoxLayout" name="horizontalLayout_2">
<item> <item>
<layout class="QVBoxLayout" name="verticalLayout_8"> <layout class="QVBoxLayout" name="verticalLayout_8" stretch="0,0,0,1">
<item> <item>
<widget class="QGroupBox" name="ppu"> <widget class="QGroupBox" name="ppu">
<property name="title"> <property name="title">