]> git.sur5r.net Git - minitube/commitdiff
Fixed search widget
authorFlavio Tordini <flavio.tordini@gmail.com>
Mon, 14 Sep 2015 09:11:11 +0000 (11:11 +0200)
committerFlavio Tordini <flavio.tordini@gmail.com>
Mon, 14 Sep 2015 09:11:11 +0000 (11:11 +0200)
src/exlineedit.cpp
src/searchlineedit.cpp
src/searchview.cpp

index 2742afbded2f87cc41258aa7bc925c91469f655e..4784c8a524c5ad7e03985d843394aa87bcb3c6e5 100644 (file)
@@ -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)
index 37ebe2988d8d5fc583ce9d2f57baff7ab8ac1656..bbd2fe59e67bcec474aebb2e83722498380e2fda 100644 (file)
@@ -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);
     }
 }
 
index 6f3280e7e515b98e578e212f4a4e54181b8214a2..5b9add75cdcdcc5d1e96f6f68fc3ba63a1761a2e 100644 (file)
@@ -82,7 +82,6 @@ SearchView::SearchView(QWidget *parent) : View(parent) {
     QLabel *welcomeLabel =
             new QLabel("<h1 style='font-weight:100'>" +
                        tr("Welcome to <a href='%1'>%2</a>,")
-                       // .replace("<a ", "<a style='color:palette(text)'")
                        .replace("<a ", "<a style='text-decoration:none; color:palette(text);font-weight:normal' ")
                        .arg(Constants::WEBSITE, Constants::NAME)
                        + "</h1>", 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);