mirror of
https://github.com/clementine-player/Clementine
synced 2025-01-18 20:40:43 +01:00
Make the new non-mac search fields look the same as the old LineEdit
based search fields.
This commit is contained in:
parent
3fbf65f679
commit
3ca45f8100
18
3rdparty/qocoa/qsearchfield_nonmac.cpp
vendored
18
3rdparty/qocoa/qsearchfield_nonmac.cpp
vendored
@ -21,6 +21,7 @@ THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#include "qsearchfield.h"
|
||||
#include "../../src/ui/iconloader.h"
|
||||
|
||||
#include <QApplication>
|
||||
#include <QEvent>
|
||||
@ -62,19 +63,22 @@ QSearchField::QSearchField(QWidget *parent) : QWidget(parent)
|
||||
connect(lineEdit, SIGNAL(textChanged(QString)),
|
||||
this, SLOT(setText(QString)));
|
||||
|
||||
QIcon clearIcon(IconLoader::Load("edit-clear-locationbar-ltr"));
|
||||
|
||||
QToolButton *clearButton = new QToolButton(this);
|
||||
QPixmap clearIcon(QString(":/Qocoa/qsearchfield_nonmac.png"));
|
||||
clearButton->setIcon(QIcon(clearIcon));
|
||||
clearButton->setIconSize(clearIcon.size());
|
||||
clearButton->setFixedSize(clearIcon.size());
|
||||
clearButton->setStyleSheet("border: none;");
|
||||
clearButton->setIcon(clearIcon);
|
||||
clearButton->setIconSize(QSize(16, 16));
|
||||
clearButton->setStyleSheet("border: none; padding: 0px;");
|
||||
clearButton->resize(clearButton->sizeHint());
|
||||
connect(clearButton, SIGNAL(clicked()), this, SLOT(clear()));
|
||||
|
||||
pimpl = new QSearchFieldPrivate(this, lineEdit, clearButton);
|
||||
|
||||
const int frame_width = lineEdit->style()->pixelMetric(QStyle::PM_DefaultFrameWidth);
|
||||
|
||||
lineEdit->setStyleSheet(QString("QLineEdit { padding-left: %1px; } ").arg(clearButton->width()));
|
||||
const int width = qMax(lineEdit->minimumSizeHint().width(), pimpl->clearButtonPaddedWidth());
|
||||
const int height = qMax(lineEdit->minimumSizeHint().height(), pimpl->clearButtonPaddedHeight());
|
||||
const int width = frame_width + qMax(lineEdit->minimumSizeHint().width(), pimpl->clearButtonPaddedWidth());
|
||||
const int height = frame_width + qMax(lineEdit->minimumSizeHint().height(), pimpl->clearButtonPaddedHeight());
|
||||
lineEdit->setMinimumSize(width, height);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout(this);
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 603 B |
@ -291,7 +291,6 @@
|
||||
<file>providers/songkick.png</file>
|
||||
<file>providers/twitter.png</file>
|
||||
<file>providers/wikipedia.png</file>
|
||||
<file>Qocoa/qsearchfield_nonmac.png</file>
|
||||
<file>sample.mood</file>
|
||||
<file>schema/device-schema.sql</file>
|
||||
<file>schema/jamendo.sql</file>
|
||||
|
Loading…
Reference in New Issue
Block a user