Fix macOS button layout in property editor
The size of the "..." button calculated by QMacStyle was not correct, causing other widgets in the layout to be clipped. Also, set the size of all "..." buttons the same way.
This commit is contained in:
committed by
Yorik van Havre
parent
9d81b1ec7b
commit
991573f1fc
@@ -867,6 +867,9 @@ LabelButton::LabelButton (QWidget * parent)
|
||||
layout->addWidget(label);
|
||||
|
||||
button = new QPushButton(QLatin1String("..."), this);
|
||||
#if defined (Q_OS_MAC)
|
||||
button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // layout size from QMacStyle was not correct
|
||||
#endif
|
||||
layout->addWidget(button);
|
||||
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(browse()));
|
||||
@@ -880,6 +883,7 @@ LabelButton::~LabelButton()
|
||||
void LabelButton::resizeEvent(QResizeEvent* e)
|
||||
{
|
||||
button->setFixedWidth(e->size().height());
|
||||
button->setFixedHeight(e->size().height());
|
||||
}
|
||||
|
||||
QLabel *LabelButton::getLabel() const
|
||||
@@ -1298,7 +1302,9 @@ LabelEditor::LabelEditor (QWidget * parent)
|
||||
this, SLOT(validateText(const QString &)));
|
||||
|
||||
button = new QPushButton(QLatin1String("..."), this);
|
||||
button->setFixedWidth(2*button->fontMetrics().width(QLatin1String(" ... ")));
|
||||
#if defined (Q_OS_MAC)
|
||||
button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // layout size from QMacStyle was not correct
|
||||
#endif
|
||||
layout->addWidget(button);
|
||||
|
||||
connect(button, SIGNAL(clicked()), this, SLOT(changeText()));
|
||||
@@ -1310,6 +1316,12 @@ LabelEditor::~LabelEditor()
|
||||
{
|
||||
}
|
||||
|
||||
void LabelEditor::resizeEvent(QResizeEvent* e)
|
||||
{
|
||||
button->setFixedWidth(e->size().height());
|
||||
button->setFixedHeight(e->size().height());
|
||||
}
|
||||
|
||||
QString LabelEditor::text() const
|
||||
{
|
||||
return this->plainText;
|
||||
|
||||
Reference in New Issue
Block a user