mirror of
https://github.com/strawberrymusicplayer/strawberry
synced 2025-01-20 21:00:46 +01:00
Make search field clear buttons follow icon size settings
This commit is contained in:
parent
e747c2e263
commit
558e392234
@ -149,6 +149,7 @@ void CollectionFilterWidget::ReloadSettings() {
|
||||
int iconsize = s.value(AppearanceSettingsPage::kIconSizeConfigureButtons, 20).toInt();
|
||||
s.endGroup();
|
||||
ui_->options->setIconSize(QSize(iconsize, iconsize));
|
||||
ui_->filter->setIconSize(iconsize);
|
||||
|
||||
}
|
||||
|
||||
|
@ -250,6 +250,7 @@ void InternetSearchView::ReloadSettings() {
|
||||
int iconsize = s.value(AppearanceSettingsPage::kIconSizeConfigureButtons, 20).toInt();
|
||||
s.endGroup();
|
||||
ui_->settings->setIconSize(QSize(iconsize, iconsize));
|
||||
ui_->search->setIconSize(iconsize);
|
||||
|
||||
}
|
||||
|
||||
|
@ -234,15 +234,16 @@ void PlaylistContainer::ReloadSettings() {
|
||||
|
||||
QSettings s;
|
||||
s.beginGroup(AppearanceSettingsPage::kSettingsGroup);
|
||||
int iconsize_playlist_buttons = s.value(AppearanceSettingsPage::kIconSizePlaylistButtons, 20).toInt();
|
||||
int iconsize = s.value(AppearanceSettingsPage::kIconSizePlaylistButtons, 20).toInt();
|
||||
s.endGroup();
|
||||
|
||||
ui_->create_new->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
ui_->load->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
ui_->save->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
ui_->clear->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
ui_->undo->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
ui_->redo->setIconSize(QSize(iconsize_playlist_buttons, iconsize_playlist_buttons));
|
||||
ui_->create_new->setIconSize(QSize(iconsize, iconsize));
|
||||
ui_->load->setIconSize(QSize(iconsize, iconsize));
|
||||
ui_->save->setIconSize(QSize(iconsize, iconsize));
|
||||
ui_->clear->setIconSize(QSize(iconsize, iconsize));
|
||||
ui_->undo->setIconSize(QSize(iconsize, iconsize));
|
||||
ui_->redo->setIconSize(QSize(iconsize, iconsize));
|
||||
ui_->filter->setIconSize(iconsize);
|
||||
|
||||
bool playlist_clear = settings_.value("playlist_clear", true).toBool();
|
||||
if (playlist_clear) {
|
||||
|
@ -12,30 +12,32 @@ class QSearchField : public QWidget {
|
||||
Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true)
|
||||
Q_PROPERTY(QString placeholderText READ placeholderText WRITE setPlaceholderText)
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit QSearchField(QWidget *parent);
|
||||
|
||||
void setIconSize(const int iconsize);
|
||||
|
||||
QString text() const;
|
||||
QString placeholderText() const;
|
||||
void setFocus(Qt::FocusReason);
|
||||
|
||||
public slots:
|
||||
public slots:
|
||||
void setText(const QString &text);
|
||||
void setPlaceholderText(const QString &text);
|
||||
void clear();
|
||||
void selectAll();
|
||||
void setFocus();
|
||||
|
||||
signals:
|
||||
signals:
|
||||
void textChanged(const QString &text);
|
||||
void editingFinished();
|
||||
void returnPressed();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
void resizeEvent(QResizeEvent*) override;
|
||||
bool eventFilter(QObject*, QEvent*) override;
|
||||
|
||||
private:
|
||||
private:
|
||||
friend class QSearchFieldPrivate;
|
||||
QPointer <QSearchFieldPrivate> pimpl;
|
||||
};
|
||||
|
@ -167,6 +167,8 @@ QSearchField::QSearchField(QWidget *parent) : QWidget(parent) {
|
||||
[pool drain];
|
||||
}
|
||||
|
||||
void QSearchField::setIconSize(const int iconsize) {}
|
||||
|
||||
void QSearchField::setText(const QString &text) {
|
||||
Q_ASSERT(pimpl);
|
||||
if (!pimpl) return;
|
||||
|
@ -73,7 +73,7 @@ QSearchField::QSearchField(QWidget *parent) : QWidget(parent) {
|
||||
QIcon clearIcon(IconLoader::Load("edit-clear-locationbar-ltr"));
|
||||
|
||||
clearbutton->setIcon(clearIcon);
|
||||
clearbutton->setIconSize(QSize(16, 16));
|
||||
clearbutton->setIconSize(QSize(20, 20));
|
||||
clearbutton->setStyleSheet("border: none; padding: 0px;");
|
||||
clearbutton->resize(clearbutton->sizeHint());
|
||||
|
||||
@ -96,6 +96,19 @@ QSearchField::QSearchField(QWidget *parent) : QWidget(parent) {
|
||||
|
||||
}
|
||||
|
||||
void QSearchField::setIconSize(const int iconsize) {
|
||||
|
||||
pimpl->clearbutton_->setIconSize(QSize(iconsize, iconsize));
|
||||
pimpl->clearbutton_->resize(pimpl->clearbutton_->sizeHint());
|
||||
|
||||
pimpl->lineedit_->setStyleSheet(QString("QLineEdit { padding-left: %1px; } ").arg(pimpl->clearbutton_->width()));
|
||||
const int frame_width = pimpl->lineedit_->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
const int width = frame_width + qMax(pimpl->lineedit_->minimumSizeHint().width(), pimpl->clearButtonPaddedWidth());
|
||||
const int height = frame_width + qMax(pimpl->lineedit_->minimumSizeHint().height(), pimpl->clearButtonPaddedHeight());
|
||||
pimpl->lineedit_->setMinimumSize(width, height);
|
||||
|
||||
}
|
||||
|
||||
void QSearchField::setText(const QString &text) {
|
||||
|
||||
Q_ASSERT(pimpl && pimpl->clearbutton_ && pimpl->lineedit_);
|
||||
|
Loading…
Reference in New Issue
Block a user