From: <> Date: Wed, 4 Aug 2010 12:48:22 +0000 (+0200) Subject: Background color on the Mac X-Git-Tag: 1.2~24 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=66438ab6e427fd93331bc0b8002fc6d21d132c60;p=minitube Background color on the Mac --- diff --git a/src/SearchView.cpp b/src/SearchView.cpp index 99efdb6..98e2c74 100644 --- a/src/SearchView.cpp +++ b/src/SearchView.cpp @@ -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 +} diff --git a/src/SearchView.h b/src/SearchView.h index 6ad912d..c32db4b 100644 --- a/src/SearchView.h +++ b/src/SearchView.h @@ -37,6 +37,9 @@ public slots: signals: void search(QString query); +protected: + void paintEvent(QPaintEvent *); + private slots: void watch(); void textChanged(const QString &text);