Merge pull request #2087 from Cacodemon345/newqt

qt: Dialog improvements
This commit is contained in:
Miran Grča
2022-02-09 20:42:13 +01:00
committed by GitHub
3 changed files with 10 additions and 1 deletions

View File

@@ -31,6 +31,7 @@ FileField::FileField(QWidget *parent) :
fileName_ = ui->label->text(); fileName_ = ui->label->text();
emit fileSelected(ui->label->text()); emit fileSelected(ui->label->text());
}); });
this->setFixedWidth(this->sizeHint().width() + ui->pushButton->sizeHint().width());
} }
FileField::~FileField() FileField::~FileField()

View File

@@ -35,7 +35,7 @@
<item> <item>
<widget class="QLineEdit" name="label"> <widget class="QLineEdit" name="label">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Preferred"> <sizepolicy hsizetype="Expanding" vsizetype="Preferred">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>

View File

@@ -16,6 +16,9 @@
*/ */
#include "qt_styleoverride.hpp" #include "qt_styleoverride.hpp"
#include <QComboBox>
#include <QAbstractItemView>
int StyleOverride::styleHint( int StyleOverride::styleHint(
StyleHint hint, StyleHint hint,
const QStyleOption *option, const QStyleOption *option,
@@ -44,4 +47,9 @@ void StyleOverride::polish(QWidget* widget)
} }
widget->setWindowFlag(Qt::WindowContextHelpButtonHint, false); widget->setWindowFlag(Qt::WindowContextHelpButtonHint, false);
} }
if (qobject_cast<QComboBox*>(widget)) {
widget->setMinimumWidth(widget->minimumSizeHint().width());
qobject_cast<QComboBox*>(widget)->view()->setMinimumWidth(widget->minimumSizeHint().width());
}
} }