UI Nits: QSplitter cosmetics

.. prettified on a Mac.
.. still need to work on icons
This commit is contained in:
Mark Liversedge
2013-03-02 16:57:37 +00:00
parent be58a768ed
commit d8af6e36bd
4 changed files with 50 additions and 27 deletions

View File

@@ -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);
}

View File

@@ -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();
}

View File

@@ -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

View File

@@ -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;