Stylesheets: Fix file chooser buttons not displaying dots

This commit is contained in:
Kacper Donat
2025-07-14 20:46:32 +02:00
parent 4db029776b
commit cd87823ca7
2 changed files with 12 additions and 14 deletions

View File

@@ -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);
}

View File

@@ -223,7 +223,6 @@ QStatusBar QLabel {
}
QStatusBar QPushButton {
min-width: 0;
padding-left: 8px;
padding-right: 8px;
}
@@ -1160,14 +1159,17 @@ QPushButton {
border: 1px solid @ButtonBorderColor;
border-radius: @InputFieldBorderRadius;
padding: 3px 12px;
min-width: 64px;
}
#CreateNewRow > QPushButton {
/* Reset min width to default */
min-width: -1;
border-radius: @InputFieldBorderRadius;
}
Gui--FileChooser QPushButton {
min-width: 0;
}
QPushButton:disabled {
background-color: @GeneralDisabledBackgroundColor;
color: @TextDisabledColor;
@@ -1598,8 +1600,7 @@ QSint--ActionGroup QFrame[class="content"] QToolButton:pressed {
}
QFrame[class="panel"] QPushButton {
padding: 3px;
min-width: 0px;
padding: 3px;
}
/* QSlider ----------------------------------------------------------------
@@ -2599,7 +2600,7 @@ QGroupBox[objectName="matOpsGrpBox"] QPushButton {
QToolBar > Gui--WorkbenchComboBox QAbstractItemView {
min-width: 180px;
margin-left: 30px;
}
}
/* Below is a fix for indentation in properties*/
@@ -2619,11 +2620,9 @@ QMainWindow QListView {
/* border-radius: 3px; */}
QTableView QPushButton {
min-width: 0px;
padding: 2px;
}
QTableView QPushButton:hover {
min-width: 0px;
background-color: @GeneralBackgroundHoverColor;
border: 1px solid @GeneralBorderColor;
}