-rw-r--r-- | library/lightstyle.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/library/lightstyle.cpp b/library/lightstyle.cpp index c5073ca..3d5adfb 100644 --- a/library/lightstyle.cpp +++ b/library/lightstyle.cpp @@ -361,115 +361,115 @@ void LightStyle::drawButton(QPainter *p, int x, int y, int w, int h, p->drawPoint(x + w - 2, y + 1); p->drawPoint(x + w - 2, y + h - 2); // bevel if (sunken) p->setPen(g.mid()); else p->setPen(g.light()); p->drawLine(x + 1, y + 2, x + 1, y + h - 3); // left p->drawLine(x + 2, y + 1, x + w - 3, y + 1); // top if (sunken) p->setPen(g.light()); else p->setPen(g.mid()); p->drawLine(x + w - 2, y + 2, x + w - 2, y + h - 3); // right + 1 p->drawLine(x + 2, y + h - 2, x + w - 3, y + h - 2); // bottom + 1 p->restore(); } void LightStyle::drawBevelButton(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, const QBrush *fill) { drawButton(p, x, y, w, h, g, sunken, fill); } -void LightStyle::getButtonShift(int &x, int &y) const +void LightStyle::getButtonShift(int &x, int &y) { x = y = 0; } void LightStyle::drawComboButton(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool, bool editable, bool, const QBrush *fill) { drawButton(p, x, y, w, h, g, FALSE, fill); if (editable) { QRect r = comboButtonRect(x, y, w, h); qDrawShadePanel(p, r.x() - 1, r.y() - 1, r.width() + defaultFrameWidth(), r.height() + defaultFrameWidth(), g, TRUE); } int indent = ((y + h) / 2) - 3; int xpos = x; #if QT_VERSION >= 0x030000 if( QApplication::reverseLayout() ) xpos += indent; else #endif xpos += w - indent - 5; drawArrow(p, Qt::DownArrow, TRUE, xpos, indent, 5, 5, g, TRUE, fill); } -QRect LightStyle::comboButtonRect( int x, int y, int w, int h ) const +QRect LightStyle::comboButtonRect( int x, int y, int w, int h ) { QRect r(x + 3, y + 3, w - 6, h - 6); int indent = ((y + h) / 2) - 3; r.setRight(r.right() - indent - 10); #if QT_VERSION >= 0x030000 if( QApplication::reverseLayout() ) r.moveBy( indent + 10, 0 ); #endif return r; } -QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h ) const +QRect LightStyle::comboButtonFocusRect(int x, int y, int w, int h ) { return comboButtonRect(x, y, w, h); } void LightStyle::drawPanel(QPainter *p, int x, int y, int w, int h, const QColorGroup &g, bool sunken, int lw, const QBrush *fill) { if (lw >= 2) { if ( fill ) p->fillRect(x + 2, y + 2, w - 4, h - 4, *fill); QPen oldpen = p->pen(); // frame p->setPen(g.dark()); p->drawLine(x, y + 2, x, y + h - 3); // left p->drawLine(x + 2, y, x + w - 3, y); // top p->drawLine(x + w - 1, y + 2, x + w - 1, y + h - 3); // right p->drawLine(x + 2, y + h - 1, x + w - 3, y + h - 1); // bottom p->drawPoint(x + 1, y + 1); p->drawPoint(x + 1, y + h - 2); p->drawPoint(x + w - 2, y + 1); p->drawPoint(x + w - 2, y + h - 2); // bevel if (sunken) p->setPen(g.mid()); else p->setPen(g.light()); @@ -772,65 +772,65 @@ void LightStyle::drawSlider(QPainter *p, int x, int y, int w, int h, if (orientation == Horizontal) { if (above && below) { drawArrow(p, Qt::UpArrow, FALSE, x + 1, y + 1, w, h / 2, g, TRUE); drawArrow(p, Qt::DownArrow, FALSE, x + 1, y + (h / 2) - 1, w, h / 2, g, TRUE); } else drawArrow(p, (above) ? Qt::UpArrow : Qt::DownArrow, FALSE, x + 1, y, w, h, g, TRUE); } else { if (above && below) { drawArrow(p, Qt::LeftArrow, FALSE, x + 1, y, w / 2, h, g, TRUE); drawArrow(p, Qt::RightArrow, FALSE, x + (w / 2) - 2, y, w / 2, h, g, TRUE); } else drawArrow(p, (above) ? Qt::LeftArrow : Qt::RightArrow, FALSE, x, y, w, h, g, TRUE); } } void LightStyle::drawSliderGroove(QPainter *p, int x, int y, int w, int h, const QColorGroup& g, QCOORD c, Qt::Orientation orientation) { if (orientation == Horizontal) drawButton(p, x, y+c - 3, w, 6, g, TRUE, &g.brush(QColorGroup::Mid)); else drawButton(p, x+c - 3, y, 6, h, g, TRUE, &g.brush(QColorGroup::Mid)); } void LightStyle::scrollBarMetrics(const QScrollBar *scrollbar, int &sliderMin, int &sliderMax, - int &sliderLength, int &buttonDim) const + int &sliderLength, int &buttonDim) { int maxLength; int length = ((scrollbar->orientation() == Horizontal) ? scrollbar->width() : scrollbar->height()); int extent = ((scrollbar->orientation() == Horizontal) ? scrollbar->height() : scrollbar->width()); extent--; if (length > (extent + defaultFrameWidth() - 1) * 2 + defaultFrameWidth()) buttonDim = extent - defaultFrameWidth(); else buttonDim = (length - defaultFrameWidth()) / 2 - 1; sliderMin = buttonDim; maxLength = length - buttonDim * 3; if (scrollbar->maxValue() != scrollbar->minValue()) { uint range = scrollbar->maxValue() - scrollbar->minValue(); sliderLength = (scrollbar->pageStep() * maxLength) / (range + scrollbar->pageStep()); if (sliderLength < buttonDim || range > INT_MAX / 2) sliderLength = buttonDim; if (sliderLength > maxLength) sliderLength = maxLength; } else sliderLength = maxLength; sliderMax = sliderMin + maxLength - sliderLength; } |