Stylesheets: Fix file chooser buttons not displaying dots
This commit is contained in:
@@ -668,7 +668,6 @@ FileChooser::FileChooser ( QWidget * parent )
|
||||
completer->setModel( fs_model );
|
||||
lineEdit->setCompleter( completer );
|
||||
|
||||
layout->addWidget( lineEdit );
|
||||
|
||||
connect(lineEdit, &QLineEdit::textChanged, this, &FileChooser::fileNameChanged);
|
||||
connect(lineEdit, &QLineEdit::editingFinished, this, &FileChooser::editingFinished);
|
||||
@@ -679,7 +678,8 @@ FileChooser::FileChooser ( QWidget * parent )
|
||||
button->setAttribute(Qt::WA_LayoutUsesWidgetRect); // layout size from QMacStyle was not correct
|
||||
#endif
|
||||
|
||||
layout->addWidget(button);
|
||||
layout->addWidget(lineEdit, 1);
|
||||
layout->addWidget(button, -1);
|
||||
|
||||
connect(button, &QPushButton::clicked, this, &FileChooser::chooseFile);
|
||||
|
||||
@@ -690,7 +690,6 @@ FileChooser::~FileChooser() = default;
|
||||
|
||||
void FileChooser::resizeEvent(QResizeEvent* e)
|
||||
{
|
||||
button->setFixedWidth(e->size().height());
|
||||
button->setFixedHeight(e->size().height());
|
||||
}
|
||||
|
||||
@@ -815,12 +814,12 @@ void FileChooser::setFilter ( const QString& filter )
|
||||
/**
|
||||
* Sets the browse button's text to \a txt.
|
||||
*/
|
||||
void FileChooser::setButtonText( const QString& txt )
|
||||
void FileChooser::setButtonText(const QString& txt)
|
||||
{
|
||||
button->setText( txt );
|
||||
button->setText(txt);
|
||||
int w1 = 2 * QtTools::horizontalAdvance(button->fontMetrics(), txt);
|
||||
int w2 = 2 * QtTools::horizontalAdvance(button->fontMetrics(), QLatin1String(" ... "));
|
||||
button->setFixedWidth( (w1 > w2 ? w1 : w2) );
|
||||
button->setMinimumWidth(std::max(w1, w2));
|
||||
Q_EMIT buttonTextChanged(txt);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user