]> git.sur5r.net Git - minitube/commitdiff
Background color on the Mac
author <> <>
Wed, 4 Aug 2010 12:48:22 +0000 (14:48 +0200)
committerFlavio <flavio@guodil.local>
Wed, 4 Aug 2010 12:48:22 +0000 (14:48 +0200)
src/SearchView.cpp
src/SearchView.h

index 99efdb67c7f86a79084cc961b111e5a4e9996e6c..98e2c74e00bdca9081be50318eb856092e67b515 100644 (file)
@@ -14,6 +14,19 @@ SearchView::SearchView(QWidget *parent) : QWidget(parent) {
     QFont biggerFont = FontUtils::big();
     QFont smallerFont = FontUtils::smallBold();
 
+    /*
+    QPalette palette = QPalette();
+    palette.setColor(QPalette::Active, QPalette::Window, QColor(0xdd, 0xe4, 0xeb));
+    setPalette(palette);
+    setAutoFillBackground(true);
+    */
+
+#ifdef Q_WS_MAC
+    // speedup painting since we'll paint the whole background
+    // by ourselves anyway in paintEvent()
+    setAttribute(Qt::WA_OpaquePaintEvent);
+#endif
+
     QBoxLayout *mainLayout = new QVBoxLayout();
     mainLayout->setMargin(PADDING);
     mainLayout->setSpacing(0);
@@ -194,3 +207,16 @@ void SearchView::gotNewVersion(QString version) {
     message->show();
     if (updateChecker) delete updateChecker;
 }
+
+void SearchView::paintEvent(QPaintEvent * /*event*/) {
+#ifdef APP_MAC
+    QBrush brush;
+    if (window()->isActiveWindow()) {
+        brush = QBrush(QColor(0xdd, 0xe4, 0xeb));
+    } else {
+        brush = palette().window();
+    }
+    QPainter painter(this);
+    painter.fillRect(0, 0, width(), height(), brush);
+#endif
+}
index 6ad912d0321e1d41d02f70a7028861a915c7911d..c32db4b5bb2adbb662785750110febab0b51327b 100644 (file)
@@ -37,6 +37,9 @@ public slots:
 signals:
     void search(QString query);
 
+protected:
+    void paintEvent(QPaintEvent *);
+
 private slots:
     void watch();
     void textChanged(const QString &text);