From 2d505b810f473073feae85c97fa9743b32006990 Mon Sep 17 00:00:00 2001 From: Flavio Tordini Date: Mon, 14 Sep 2015 11:11:11 +0200 Subject: [PATCH] Fixed search widget --- src/exlineedit.cpp | 8 ++++---- src/searchlineedit.cpp | 4 +--- src/searchview.cpp | 11 +++++++---- 3 files changed, 12 insertions(+), 11 deletions(-) diff --git a/src/exlineedit.cpp b/src/exlineedit.cpp index 2742afb..4784c8a 100644 --- a/src/exlineedit.cpp +++ b/src/exlineedit.cpp @@ -27,23 +27,23 @@ void ClearButton::textChanged(const QString &text) { } void ClearButton::enterEvent(QEvent *e) { - Q_UNUSED(e); hovered = true; + QAbstractButton::enterEvent(e); } void ClearButton::leaveEvent(QEvent *e) { - Q_UNUSED(e); hovered = false; + QAbstractButton::leaveEvent(e); } void ClearButton::mousePressEvent(QMouseEvent *e) { - Q_UNUSED(e); mousePressed = true; + QAbstractButton::mousePressEvent(e); } void ClearButton::mouseReleaseEvent(QMouseEvent *e) { - Q_UNUSED(e); mousePressed = false; + QAbstractButton::mouseReleaseEvent(e); } ExLineEdit::ExLineEdit(QWidget *parent) diff --git a/src/searchlineedit.cpp b/src/searchlineedit.cpp index 37ebe29..bbd2fe5 100644 --- a/src/searchlineedit.cpp +++ b/src/searchlineedit.cpp @@ -63,8 +63,8 @@ SearchLineEdit::SearchLineEdit(QWidget *parent) : ExLineEdit(parent), searchButt } void SearchLineEdit::paintEvent(QPaintEvent *e) { + ExLineEdit::paintEvent(e); if (m_lineEdit->text().isEmpty() && !hasFocus() && !inactiveText.isEmpty()) { - ExLineEdit::paintEvent(e); QStyleOptionFrameV2 panel; initStyleOption(&panel); QRect r = style()->subElementRect(QStyle::SE_LineEditContents, &panel, this); @@ -75,8 +75,6 @@ void SearchLineEdit::paintEvent(QPaintEvent *e) { QPainter painter(this); painter.setPen(palette().brush(QPalette::Disabled, QPalette::Text).color()); painter.drawText(lineRect, Qt::AlignLeft | Qt::AlignVCenter, inactiveText); - } else { - ExLineEdit::paintEvent(e); } } diff --git a/src/searchview.cpp b/src/searchview.cpp index 6f3280e..5b9add7 100644 --- a/src/searchview.cpp +++ b/src/searchview.cpp @@ -82,7 +82,6 @@ SearchView::SearchView(QWidget *parent) : View(parent) { QLabel *welcomeLabel = new QLabel("

" + tr("Welcome to %2,") - // .replace("", this); @@ -140,13 +139,14 @@ SearchView::SearchView(QWidget *parent) : View(parent) { #ifdef APP_MAC_SEARCHFIELD queryEdit = new SearchLineEditMac(this); #else - queryEdit = new SearchLineEdit(this); - queryEdit->toWidget()->setFont(biggerFont); + SearchLineEdit *sle = new SearchLineEdit(this); + sle->setFont(biggerFont); + queryEdit = sle; #endif qDebug() << "queryEdit->toWidget()" << (queryEdit->toWidget() == 0) << queryEdit->toWidget(); connect(queryEdit->toWidget(), SIGNAL(search(const QString&)), SLOT(watch(const QString&))); - connect(queryEdit->toWidget(), SIGNAL(textEdited(const QString &)), SLOT(textChanged(const QString &))); + connect(queryEdit->toWidget(), SIGNAL(textChanged(const QString &)), SLOT(textChanged(const QString &))); connect(queryEdit->toWidget(), SIGNAL(suggestionAccepted(Suggestion*)), SLOT(suggestionAccepted(Suggestion*))); youtubeSuggest = new YTSuggester(this); @@ -157,6 +157,9 @@ SearchView::SearchView(QWidget *parent) : View(parent) { searchLayout->addSpacing(10); watchButton = new QPushButton(tr("Watch"), this); +#ifndef APP_MAC + watchButton->setFont(biggerFont); +#endif watchButton->setDefault(true); watchButton->setEnabled(false); watchButton->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); -- 2.39.5