Adjust the global search widget's style a bit

This commit is contained in:
David Sansome 2011-09-17 14:04:34 +01:00
parent 99a25f9d1e
commit 02257d8b37
3 changed files with 17 additions and 12 deletions

View File

@ -20,8 +20,13 @@
font-size: 7.5pt;
}
#search:disabled {
color: rgba(255, 255, 255, 75%);
}
#search {
border: 1px groove rgba(128, 128, 128, 60%);
border-radius: 4px 4px;
background-color: rgba(0, 0, 0, 20%)
}
@ -46,18 +51,11 @@ QToolButton:pressed {
</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QLabel" name="label">
<property name="text">
<string>Search &lt;b&gt;ALL THE THINGS&lt;/b&gt; in your library, connected devices and on the Internet.</string>
</property>
<property name="wordWrap">
<bool>true</bool>
</property>
</widget>
</item>
<item>
<widget class="LineEdit" name="search">
<property name="hint" stdset="0">
<string>Global search</string>
</property>
</widget>
</item>
<item>

View File

@ -31,7 +31,8 @@ ExtendedEditor::ExtendedEditor(QWidget* widget, int extra_right_padding,
clear_button_(new QToolButton(widget)),
reset_button_(new QToolButton(widget)),
extra_right_padding_(extra_right_padding),
draw_hint_(draw_hint)
draw_hint_(draw_hint),
font_point_size_(widget->font().pointSizeF() - 1)
{
clear_button_->setIcon(IconLoader::Load("edit-clear-locationbar-ltr"));
clear_button_->setIconSize(QSize(16, 16));
@ -102,7 +103,8 @@ void ExtendedEditor::Paint(QPaintDevice* device) {
QFont font;
font.setItalic(true);
font.setPointSize(font.pointSize()-1);
font.setBold(false);
font.setPointSizeF(font_point_size_);
QFontMetrics m(font);
const int kBorder = (device->height() - m.height()) / 2;

View File

@ -66,6 +66,9 @@ public:
bool has_reset_button() const;
void set_reset_button(bool visible);
qreal font_point_size() const { return font_point_size_; }
void set_font_point_size(qreal size) { font_point_size_ = size; }
protected:
void Paint(QPaintDevice* device);
void Resize();
@ -82,12 +85,14 @@ protected:
int extra_right_padding_;
bool draw_hint_;
qreal font_point_size_;
};
class LineEdit : public QLineEdit,
public ExtendedEditor {
Q_OBJECT
Q_PROPERTY(QString hint READ hint WRITE set_hint);
Q_PROPERTY(qreal font_point_size READ font_point_size WRITE set_font_point_size);
Q_PROPERTY(bool has_clear_button READ has_clear_button WRITE set_clear_button);
Q_PROPERTY(bool has_reset_button READ has_reset_button WRITE set_reset_button);