From d8af6e36bde49d5b2be0f5e95d7c3ea31e04043f Mon Sep 17 00:00:00 2001 From: Mark Liversedge Date: Sat, 2 Mar 2013 16:57:37 +0000 Subject: [PATCH] UI Nits: QSplitter cosmetics .. prettified on a Mac. .. still need to work on icons --- src/GcCalendar.cpp | 4 ++-- src/GcScopeBar.cpp | 20 ++++++++++------- src/GcSideBarItem.cpp | 50 +++++++++++++++++++++++++++++-------------- src/GcSideBarItem.h | 3 ++- 4 files changed, 50 insertions(+), 27 deletions(-) diff --git a/src/GcCalendar.cpp b/src/GcCalendar.cpp index 7fe89ccf4..86ce3e826 100644 --- a/src/GcCalendar.cpp +++ b/src/GcCalendar.cpp @@ -526,7 +526,7 @@ GcLabel::paintEvent(QPaintEvent *e) // adjust for emboss setContentsMargins(x+xoff,y+yoff,w,l); QPalette r; - r.setColor(QPalette::WindowText, QColor(127,127,127,160)); + r.setColor(QPalette::WindowText, QColor(220,220,220,160)); setPalette(r); QLabel::paintEvent(e); @@ -536,7 +536,7 @@ GcLabel::paintEvent(QPaintEvent *e) } QPalette r; // want gray - r.setColor(QPalette::WindowText, QColor(127,127,127,160)); + r.setColor(QPalette::WindowText, QColor(0,0,0,200)); setPalette(r); QLabel::paintEvent(e); } diff --git a/src/GcScopeBar.cpp b/src/GcScopeBar.cpp index 084c87340..d34fd5e5a 100644 --- a/src/GcScopeBar.cpp +++ b/src/GcScopeBar.cpp @@ -93,20 +93,24 @@ GcScopeBar::paintEvent (QPaintEvent *event) void GcScopeBar::paintBackground(QPaintEvent *) { - static QPixmap active = QPixmap(":images/mac/scope-active.png"); - static QPixmap inactive = QPixmap(":images/scope-inactive.png"); - - // setup a painter and the area to paint QPainter painter(this); painter.save(); - - // background light gray for now? QRect all(0,0,width(),height()); - painter.drawTiledPixmap(all, isActiveWindow() ? active : inactive); + + // fill with a linear gradient + int shade = isActiveWindow() ? 178 : 225; + QLinearGradient linearGradient(0, 0, 0, height()); + linearGradient.setColorAt(0.0, QColor(shade,shade,shade, 100)); + linearGradient.setColorAt(0.5, QColor(shade,shade,shade, 180)); + linearGradient.setColorAt(1.0, QColor(shade,shade,shade, 255)); + linearGradient.setSpread(QGradient::PadSpread); + painter.setPen(Qt::NoPen); + painter.fillRect(all, linearGradient); + QPen black(QColor(100,100,100)); painter.setPen(black); - painter.drawLine(0,height()-1,width()-1,height()-1); + painter.drawLine(0,height()-1, width()-1, height()-1); painter.restore(); } diff --git a/src/GcSideBarItem.cpp b/src/GcSideBarItem.cpp index 704bf76a2..3cb9f3e34 100644 --- a/src/GcSideBarItem.cpp +++ b/src/GcSideBarItem.cpp @@ -149,13 +149,22 @@ GcSplitterHandle::GcSplitterHandle(QString title, GcSplitterItem *widget, Qt::Or titleLayout->setContentsMargins(0,0,0,0); titleLayout->setSpacing(2); - titleLabel = new QLabel(title, this); + titleLabel = new GcLabel(title, this); + titleLabel->setXOff(1); + + QFont font; #ifdef Q_OS_MAC titleLabel->setFixedHeight(16); - titleLabel->setFont(QFont("Helvetica", 11, QFont::Normal)); + titleLabel->setYOff(2); + font.setFamily("Lucida Grande"); + font.setPointSize(11); #else - titleLabel->setFont(QFont("Helvetica", 10, QFont::Normal)); + titleLabel->setYOff(1); + font.setFamily("Helvetica"); + font.setPointSize(10); #endif + font.setWeight(QFont::Black); + titleLabel->setFont(font); showHide = new QPushButton(this); showHide->setStyleSheet("QPushButton {color : blue;background: transparent}"); @@ -219,17 +228,23 @@ GcSplitterHandle::paintEvent(QPaintEvent *event) void GcSplitterHandle::paintBackground(QPaintEvent *) { - static QPixmap active = QPixmap(":images/mac/scope-active.png"); - static QPixmap inactive = QPixmap(":images/scope-inactive.png"); - // setup a painter and the area to paint QPainter painter(this); - // background light gray for now? painter.save(); QRect all(0,0,width(),height()); - painter.drawTiledPixmap(all, isActiveWindow() ? active : inactive); - QPen black(QColor(100,100,100)); + + // fill with a linear gradient + int shade = isActiveWindow() ? 178 : 225; + QLinearGradient linearGradient(0, 0, 0, height()); + linearGradient.setColorAt(0.0, QColor(shade,shade,shade, 100)); + linearGradient.setColorAt(0.5, QColor(shade,shade,shade, 180)); + linearGradient.setColorAt(1.0, QColor(shade,shade,shade, 255)); + linearGradient.setSpread(QGradient::PadSpread); + painter.setPen(Qt::NoPen); + painter.fillRect(all, linearGradient); + + QPen black(QColor(100,100,100,200)); painter.setPen(black); painter.drawLine(0,height()-1, width()-1, height()-1); painter.restore(); @@ -238,8 +253,6 @@ GcSplitterHandle::paintBackground(QPaintEvent *) void GcSplitterHandle::setExpanded(bool expanded) { - //XXX static QPixmap *hide = new QPixmap(":images/mac/hide.png"); - //XXX static QPixmap *show = new QPixmap(":images/mac/show.png"); state = expanded; if (expanded == false) { @@ -286,15 +299,20 @@ GcSplitterControl::paintEvent(QPaintEvent *event) void GcSplitterControl::paintBackground(QPaintEvent *) { - static QPixmap active = QPixmap(":images/mac/scope-active.png"); - static QPixmap inactive = QPixmap(":images/scope-inactive.png"); + QRect all(0,0,width(),height()); // setup a painter and the area to paint QPainter painter(this); - // background light gray for now? - QRect all(0,0,width(),height()); - painter.drawTiledPixmap(all, isActiveWindow() ? active : inactive); + // fill with a linear gradient + int shade = isActiveWindow() ? 178 : 225; + QLinearGradient linearGradient(0, 0, 0, height()); + linearGradient.setColorAt(0.0, QColor(shade,shade,shade, 100)); + linearGradient.setColorAt(0.5, QColor(shade,shade,shade, 180)); + linearGradient.setColorAt(1.0, QColor(shade,shade,shade, 255)); + linearGradient.setSpread(QGradient::PadSpread); + painter.setPen(Qt::NoPen); + painter.fillRect(all, linearGradient); } void diff --git a/src/GcSideBarItem.h b/src/GcSideBarItem.h index e8701badd..10fbf5cbd 100644 --- a/src/GcSideBarItem.h +++ b/src/GcSideBarItem.h @@ -26,6 +26,7 @@ class GcSubSplitter; class GcSplitterControl; class GcSplitterItem; +class GcLabel; class GcSplitter : public QWidget { @@ -106,7 +107,7 @@ private: GcSplitterItem *widget; QHBoxLayout *titleLayout; - QLabel *titleLabel; + GcLabel *titleLabel; QToolBar *titleToolbar; QPushButton *showHide;