diff --git qt5/style/qtcurve.cpp qt5/style/qtcurve.cpp
index 1e17882..38c5152 100644
|
|
|
98 | 98 | |
99 | 99 | namespace QtCurve { |
100 | 100 | |
| 101 | static inline void setPainterPen(QPainter *p, const QColor &colour, const qreal width=1.0) |
| 102 | { |
| 103 | QPen pen(colour, width); |
| 104 | p->setPen(pen); |
| 105 | } |
| 106 | |
101 | 107 | static Style::Icon |
102 | 108 | pix2Icon(QStyle::StandardPixmap pix) |
103 | 109 | { |
… |
… |
Style::drawFadedLine(QPainter *p, const QRect &r, const QColor &col, |
1193 | 1199 | if(fadeSizeEnd>=0 && fadeSizeEnd<=1.0) |
1194 | 1200 | grad.setColorAt(1.0-fadeSizeEnd, col); |
1195 | 1201 | grad.setColorAt(1, fadeEnd && opts.fadeLines ? fade : col); |
1196 | | p->setPen(QPen(QBrush(grad), 1)); |
| 1202 | p->setPen(QPen(QBrush(grad), QPenWidth1)); |
1197 | 1203 | } |
1198 | 1204 | else |
1199 | 1205 | p->setPen(col); |
… |
… |
void Style::drawLines(QPainter *p, const QRect &r, bool horiz, int nLines, int o |
1211 | 1217 | x2(r.x()+r.width()-1), |
1212 | 1218 | y2(r.y()+r.height()-1), |
1213 | 1219 | i; |
1214 | | QPen dp(cols[dark], 1), |
1215 | | lp(cols[0], 1); |
| 1220 | QPen dp(cols[dark], QPenWidth1), |
| 1221 | lp(cols[0], QPenWidth1); |
1216 | 1222 | |
1217 | 1223 | if(opts.fadeLines && (horiz ? r.width() : r.height())>16) |
1218 | 1224 | { |
… |
… |
void Style::drawLines(QPainter *p, const QRect &r, bool horiz, int nLines, int o |
1225 | 1231 | grad.setColorAt(0.6, cols[dark]); |
1226 | 1232 | grad.setColorAt(1, fade); |
1227 | 1233 | |
1228 | | dp=QPen(QBrush(grad), 1); |
| 1234 | dp=QPen(QBrush(grad), QPenWidth1); |
1229 | 1235 | |
1230 | 1236 | if(LINE_FLAT!=type) |
1231 | 1237 | { |
… |
… |
void Style::drawLines(QPainter *p, const QRect &r, bool horiz, int nLines, int o |
1236 | 1242 | grad.setColorAt(0.4, cols[0]); |
1237 | 1243 | grad.setColorAt(0.6, cols[0]); |
1238 | 1244 | grad.setColorAt(1, fade); |
1239 | | lp=QPen(QBrush(grad), 1); |
| 1245 | lp=QPen(QBrush(grad), QPenWidth1); |
1240 | 1246 | } |
1241 | 1247 | } |
1242 | 1248 | |
… |
… |
Style::drawLightBevelReal(QPainter *p, const QRect &rOrig, |
1770 | 1776 | bool horizontal((horiz && WIDGET_SB_BUTTON!=w)|| (!horiz && WIDGET_SB_BUTTON==w)), |
1771 | 1777 | thin(WIDGET_SB_BUTTON==w || WIDGET_SPIN==w || ((horiz ? r.height() : r.width())<16)); |
1772 | 1778 | |
1773 | | p->setPen(m_mouseOverCols[MO_PLASTIK_DARK(w)]); |
| 1779 | setPainterPen(p, m_mouseOverCols[MO_PLASTIK_DARK(w)], QPenWidth1); |
1774 | 1780 | if(horizontal) |
1775 | 1781 | { |
1776 | 1782 | drawAaLine(p, r.x()+1, r.y()+1, r.x()+r.width()-2, r.y()+1); |
… |
… |
Style::drawLightBevelReal(QPainter *p, const QRect &rOrig, |
1783 | 1789 | } |
1784 | 1790 | if(!thin) |
1785 | 1791 | { |
1786 | | p->setPen(m_mouseOverCols[MO_PLASTIK_LIGHT(w)]); |
| 1792 | setPainterPen(p, m_mouseOverCols[MO_PLASTIK_LIGHT(w)], QPenWidth1); |
1787 | 1793 | if(horizontal) |
1788 | 1794 | { |
1789 | 1795 | drawAaLine(p, r.x()+1, r.y()+2, r.x()+r.width()-2, r.y()+2); |
… |
… |
Style::drawLightBevelReal(QPainter *p, const QRect &rOrig, |
1889 | 1895 | } |
1890 | 1896 | |
1891 | 1897 | if (!colouredMouseOver && lightBorder) { |
1892 | | p->setPen(cols[LIGHT_BORDER(app)]); |
| 1898 | setPainterPen(p, cols[LIGHT_BORDER(app)], QPenWidth1); |
1893 | 1899 | p->drawPath(buildPath(r, w, round, |
1894 | 1900 | qtcGetRadius(&opts, r.width(), |
1895 | 1901 | r.height(), w, RADIUS_INTERNAL))); |
… |
… |
Style::drawLightBevelReal(QPainter *p, const QRect &rOrig, |
1901 | 1907 | buildSplitPath(r, round, qtcGetRadius(&opts, r.width(), r.height(), w, RADIUS_INTERNAL), |
1902 | 1908 | innerTlPath, innerBrPath); |
1903 | 1909 | |
1904 | | p->setPen(border[colouredMouseOver ? MO_STD_LIGHT(w, sunken) : (sunken ? dark : 0)]); |
| 1910 | setPainterPen(p, border[colouredMouseOver ? MO_STD_LIGHT(w, sunken) : (sunken ? dark : 0)], QPenWidth1); |
1905 | 1911 | p->drawPath(innerTlPath); |
1906 | 1912 | if(colouredMouseOver || bevelledButton || draw3dfull) |
1907 | 1913 | { |
1908 | | p->setPen(border[colouredMouseOver ? MO_STD_DARK(w) : (sunken ? 0 : dark)]); |
| 1914 | setPainterPen(p, border[colouredMouseOver ? MO_STD_DARK(w) : (sunken ? 0 : dark)], QPenWidth1); |
1909 | 1915 | p->drawPath(innerBrPath); |
1910 | 1916 | } |
1911 | 1917 | } |
… |
… |
void Style::drawGlow(QPainter *p, const QRect &r, EWidget w, const QColor *cols) |
1967 | 1973 | col.setAlphaF(GLOW_ALPHA(defShade)); |
1968 | 1974 | p->setBrush(Qt::NoBrush); |
1969 | 1975 | p->setRenderHint(QPainter::Antialiasing, true); |
1970 | | p->setPen(col); |
| 1976 | setPainterPen(p, col, QPenWidth1); |
1971 | 1977 | p->drawPath(buildPath(r, w, ROUNDED_ALL, qtcGetRadius(&opts, r.width(), r.height(), w, RADIUS_ETCH))); |
1972 | 1978 | p->setRenderHint(QPainter::Antialiasing, QPAINTER_ANTIALIAS_MAYBE_ON); |
1973 | 1979 | } |
… |
… |
void Style::drawEtch(QPainter *p, const QRect &r, const QWidget *widget, EWidge |
1986 | 1992 | col.setAlphaF(USE_CUSTOM_ALPHAS(opts) ? opts.customAlphas[ALPHA_ETCH_DARK] : ETCH_TOP_ALPHA); |
1987 | 1993 | p->setBrush(Qt::NoBrush); |
1988 | 1994 | p->setRenderHint(QPainter::Antialiasing, true); |
1989 | | p->setPen(col); |
| 1995 | setPainterPen(p, col, QPenWidth1); |
1990 | 1996 | |
1991 | 1997 | if(!raised && WIDGET_SLIDER!=w) |
1992 | 1998 | { |
… |
… |
void Style::drawEtch(QPainter *p, const QRect &r, const QWidget *widget, EWidge |
1995 | 2001 | { |
1996 | 2002 | QColor col(Qt::white); |
1997 | 2003 | col.setAlphaF(USE_CUSTOM_ALPHAS(opts) ? opts.customAlphas[ALPHA_ETCH_LIGHT] : ETCH_BOTTOM_ALPHA); // 0.25); |
1998 | | p->setPen(col); |
| 2004 | setPainterPen(p, col, QPenWidth1); |
1999 | 2005 | } |
2000 | 2006 | else |
2001 | | p->setPen(getLowerEtchCol(widget)); |
| 2007 | setPainterPen(p, getLowerEtchCol(widget), QPenWidth1); |
2002 | 2008 | } |
2003 | 2009 | |
2004 | 2010 | p->drawPath(br); |
… |
… |
void Style::drawBgndRing(QPainter &painter, int x, int y, int size, int size2, b |
2012 | 2018 | QColor col(Qt::white); |
2013 | 2019 | |
2014 | 2020 | col.setAlphaF(RINGS_INNER_ALPHA(isWindow ? opts.bgndImage.type : opts.menuBgndImage.type)); |
| 2021 | if (width == 1) { |
| 2022 | width = QPenWidth1; |
| 2023 | } |
2015 | 2024 | painter.setPen(QPen(col, width)); |
2016 | 2025 | painter.drawEllipse(QRectF(x+width2, y+width2, size-width, size-width)); |
2017 | 2026 | |
2018 | 2027 | if(IMG_BORDERED_RINGS==(isWindow ? opts.bgndImage.type : opts.menuBgndImage.type)) |
2019 | 2028 | { |
2020 | 2029 | col.setAlphaF(RINGS_OUTER_ALPHA); |
2021 | | painter.setPen(QPen(col, 1)); |
| 2030 | painter.setPen(QPen(col, QPenWidth1)); |
2022 | 2031 | painter.drawEllipse(QRectF(x, y, size, size)); |
2023 | 2032 | if(size2) |
2024 | 2033 | painter.drawEllipse(QRectF(x+width, y+width, size2, size2)); |
… |
… |
QPixmap Style::drawStripes(const QColor &color, int opacity) const |
2048 | 2057 | if(100!=opacity) |
2049 | 2058 | { |
2050 | 2059 | col2.setAlphaF(opacity/100.0); |
2051 | | pixPainter.setPen(col); |
| 2060 | pixPainter.setPen(QPen(col, QPenWidth1)); |
2052 | 2061 | for(int i=0; i<pix.height(); i+=4) |
2053 | 2062 | pixPainter.drawLine(0, i, pix.width()-1, i); |
2054 | 2063 | } |
2055 | 2064 | else |
2056 | 2065 | pixPainter.fillRect(pix.rect(), col); |
2057 | | pixPainter.setPen(QColor((3*col.red()+col2.red())/4, |
| 2066 | pixPainter.setPen(QPen(QColor((3*col.red()+col2.red())/4, |
2058 | 2067 | (3*col.green()+col2.green())/4, |
2059 | 2068 | (3*col.blue()+col2.blue())/4, |
2060 | | 100!=opacity ? col2.alpha() : 255)); |
| 2069 | 100!=opacity ? col2.alpha() : 255), QPenWidth1)); |
2061 | 2070 | |
2062 | 2071 | for(int i=1; i<pix.height(); i+=4) |
2063 | 2072 | { |
2064 | 2073 | pixPainter.drawLine(0, i, pix.width()-1, i); |
2065 | 2074 | pixPainter.drawLine(0, i+2, pix.width()-1, i+2); |
2066 | 2075 | } |
2067 | | pixPainter.setPen(col2); |
| 2076 | pixPainter.setPen(QPen(col2, QPenWidth1)); |
2068 | 2077 | for(int i=2; i<pix.height()-1; i+=4) |
2069 | 2078 | pixPainter.drawLine(0, i, pix.width()-1, i); |
2070 | 2079 | |
… |
… |
Style::drawBorder(QPainter *p, const QRect &r, const QStyleOption *option, |
2554 | 2563 | |
2555 | 2564 | buildSplitPath(inner, round, qtcGetRadius(&opts, inner.width(), inner.height(), w, RADIUS_INTERNAL), topPath, botPath); |
2556 | 2565 | |
2557 | | p->setPen((enabled || BORDER_SUNKEN==borderProfile) /*&& |
| 2566 | setPainterPen(p, (enabled || BORDER_SUNKEN==borderProfile) /*&& |
2558 | 2567 | (BORDER_RAISED==borderProfile || BORDER_LIGHT==borderProfile || hasFocus || APPEARANCE_FLAT!=app)*/ |
2559 | 2568 | ? tl |
2560 | | : option->palette.background().color()); |
| 2569 | : option->palette.background().color(), QPenWidth1); |
2561 | 2570 | p->drawPath(topPath); |
2562 | 2571 | if(WIDGET_SCROLLVIEW==w || // Because of list view headers, need to draw dark line on right! |
2563 | 2572 | (! ( (WIDGET_ENTRY==w && !hasFocus && !hasMouseOver) || |
2564 | 2573 | (WIDGET_ENTRY!=w && doBlend && BORDER_SUNKEN==borderProfile) ) ) ) |
2565 | 2574 | { |
2566 | 2575 | if(!hasFocus && !hasMouseOver && BORDER_LIGHT!=borderProfile && WIDGET_SCROLLVIEW!=w) |
2567 | | p->setPen(/*WIDGET_SCROLLVIEW==w && !hasFocus |
| 2576 | setPainterPen(p, /*WIDGET_SCROLLVIEW==w && !hasFocus |
2568 | 2577 | ? checkColour(option, QPalette::Window) |
2569 | 2578 | : WIDGET_ENTRY==w && !hasFocus |
2570 | 2579 | ? checkColour(option, QPalette::Base) |
2571 | 2580 | : */enabled && (BORDER_SUNKEN==borderProfile || hasFocus || /*APPEARANCE_FLAT!=app ||*/ |
2572 | 2581 | WIDGET_TAB_TOP==w || WIDGET_TAB_BOT==w) |
2573 | 2582 | ? br |
2574 | | : checkColour(option, QPalette::Window)); |
| 2583 | : checkColour(option, QPalette::Window), QPenWidth1); |
2575 | 2584 | p->drawPath(botPath); |
2576 | 2585 | } |
2577 | 2586 | } |
… |
… |
Style::drawBorder(QPainter *p, const QRect &r, const QStyleOption *option, |
2586 | 2595 | |
2587 | 2596 | col.setAlphaF(LOWER_BORDER_ALPHA); |
2588 | 2597 | buildSplitPath(r, round, qtcGetRadius(&opts, r.width(), r.height(), w, RADIUS_EXTERNAL), topPath, botPath); |
2589 | | p->setPen(/*enabled ? */border/* : col*/); |
| 2598 | p->setPen(QPen(/*enabled ? */border/* : col*/, QPenWidth1)); |
2590 | 2599 | p->drawPath(topPath); |
2591 | 2600 | // if(enabled) |
2592 | 2601 | p->setPen(col); |
… |
… |
Style::drawBorder(QPainter *p, const QRect &r, const QStyleOption *option, |
2594 | 2603 | } |
2595 | 2604 | else |
2596 | 2605 | { |
2597 | | p->setPen(border); |
| 2606 | p->setPen(QPen(border, QPenWidth1)); |
2598 | 2607 | p->drawPath(buildPath(r, w, round, qtcGetRadius(&opts, r.width(), r.height(), w, RADIUS_EXTERNAL))); |
2599 | 2608 | } |
2600 | 2609 | |
diff --git qt5/style/qtcurve_api.cpp qt5/style/qtcurve_api.cpp
index f418d10..7a555f0 100644
|
|
void Style::drawComplexControl(ComplexControl control, const QStyleOptionComplex |
5309 | 5309 | |
5310 | 5310 | grad.setColorAt(0, dark); |
5311 | 5311 | grad.setColorAt(1, m_backgroundCols[QTC_STD_BORDER]); |
5312 | | painter->setPen(QPen(QBrush(grad), 1)); |
| 5312 | painter->setPen(QPen(QBrush(grad), QPenWidth1)); |
5313 | 5313 | painter->drawLine(r.x(), start.y(), r.x(), end.y()); |
5314 | 5314 | painter->drawLine(r.x()+r.width()-1, start.y(), r.x()+r.width()-1, end.y()); |
5315 | 5315 | |
… |
… |
void Style::drawComplexControl(ComplexControl control, const QStyleOptionComplex |
5317 | 5317 | { |
5318 | 5318 | grad.setColorAt(0, light); |
5319 | 5319 | grad.setColorAt(1, m_backgroundCols[0]); |
5320 | | painter->setPen(QPen(QBrush(grad), 1)); |
| 5320 | painter->setPen(QPen(QBrush(grad), QPenWidth1)); |
5321 | 5321 | painter->drawLine(r.x()+1, start.y(), r.x()+1, end.y()); |
5322 | 5322 | } |
5323 | 5323 | } |
diff --git qt5/style/qtcurve_p.h qt5/style/qtcurve_p.h
index 6f2ee31..7f38291 100644
|
|
void adjustToolbarButtons(const QWidget *widget, const QToolBar *toolbar, |
284 | 284 | int &bottomAdjust, int &round); |
285 | 285 | bool isA(const QObject *w, const char *type); |
286 | 286 | |
| 287 | // test: avoid a pen width of exactly 1 as Qt5 (tends to) disrespect(s) anti-alias settings for that width |
| 288 | static const qreal QPenWidth1 = 1; |
287 | 289 | } |
288 | 290 | |
289 | 291 | #define QPAINTER_ANTIALIAS_MAYBE_ON true |
diff --git qt5/style/qtcurve_primitive.cpp qt5/style/qtcurve_primitive.cpp
index c014df8..51698bc 100644
|
|
|
48 | 48 | #endif |
49 | 49 | |
50 | 50 | namespace QtCurve { |
| 51 | |
| 52 | static inline void setPainterPen(QPainter *p, const QColor &colour, const qreal width=1.0) |
| 53 | { |
| 54 | QPen pen(colour); |
| 55 | pen.setWidthF(width); |
| 56 | p->setPen(pen); |
| 57 | } |
| 58 | |
51 | 59 | bool |
52 | 60 | Style::drawPrimitiveIndicatorTabClose(PrimitiveElement, |
53 | 61 | const QStyleOption*option, |
… |
… |
Style::drawPrimitiveFrameGroupBox(PrimitiveElement, |
493 | 501 | col.setAlphaF(0.0); |
494 | 502 | grad.setColorAt(1, col); |
495 | 503 | painter->setRenderHint(QPainter::Antialiasing, true); |
496 | | painter->setPen(QPen(QBrush(grad), 1)); |
| 504 | painter->setPen(QPen(QBrush(grad), QPenWidth1)); |
497 | 505 | painter->drawPath(path); |
498 | 506 | } |
499 | 507 | if (opts.gbLabel & (GB_LBL_INSIDE | GB_LBL_OUTSIDE)) { |
… |
… |
Style::drawPrimitiveButton(PrimitiveElement element, const QStyleOption *option, |
1234 | 1242 | path.lineTo(xd + offset + etchOffset, yd + offset + 6 + etchOffset); |
1235 | 1243 | path.lineTo(xd + offset + etchOffset, yd + offset + etchOffset); |
1236 | 1244 | painter->setBrush(cols[isDown ? 0 : 4]); |
1237 | | painter->setPen(cols[isDown ? 0 : 4]); |
| 1245 | setPainterPen(painter, cols[isDown ? 0 : 4], QPenWidth1); |
1238 | 1246 | painter->setRenderHint(QPainter::Antialiasing, true); |
1239 | 1247 | painter->drawPath(path); |
1240 | 1248 | painter->setRenderHint(QPainter::Antialiasing, QPAINTER_ANTIALIAS_MAYBE_ON); |
… |
… |
Style::drawPrimitiveIndicatorRadioButton(PrimitiveElement, |
1580 | 1588 | painter->setRenderHint(QPainter::Antialiasing, true); |
1581 | 1589 | if (coloredMo) { |
1582 | 1590 | painter->setBrush(Qt::NoBrush); |
1583 | | painter->setPen(use[CR_MO_FILL]); |
| 1591 | setPainterPen(painter, use[CR_MO_FILL], QPenWidth1); |
1584 | 1592 | painter->drawArc(QRectF(x + 1, y + 1, opts.crSize - 2, |
1585 | 1593 | opts.crSize - 2), 0, 360 * 16); |
1586 | 1594 | painter->drawArc(QRectF(x + 2, y + 2, opts.crSize - 4, |
… |
… |
Style::drawPrimitiveIndicatorRadioButton(PrimitiveElement, |
1593 | 1601 | if (!glow) { |
1594 | 1602 | topCol.setAlphaF(ETCH_RADIO_TOP_ALPHA); |
1595 | 1603 | } |
1596 | | painter->setPen(topCol); |
| 1604 | setPainterPen(painter, topCol, QPenWidth1); |
1597 | 1605 | painter->drawArc(QRectF(x - 0.5, y - 0.5, opts.crSize + 1, |
1598 | 1606 | opts.crSize + 1), 45 * 16, 180 * 16); |
1599 | 1607 | if (!glow) { |
… |
… |
Style::drawPrimitiveIndicatorRadioButton(PrimitiveElement, |
1602 | 1610 | painter->drawArc(QRectF(x - 0.5, y - 0.5, opts.crSize + 1, |
1603 | 1611 | opts.crSize + 1), 225 * 16, 180 * 16); |
1604 | 1612 | } |
1605 | | painter->setPen(use[BORDER_VAL(state & State_Enabled)]); |
| 1613 | setPainterPen(painter, use[BORDER_VAL(state & State_Enabled)], QPenWidth1); |
1606 | 1614 | painter->drawArc(QRectF(x + 0.25, y + 0.25, opts.crSize - 0.5, |
1607 | 1615 | opts.crSize - 0.5), 0, 360 * 16); |
1608 | 1616 | if (!coloredMo) { |
1609 | | painter->setPen(btn[state & State_MouseOver ? 3 : 4]); |
| 1617 | setPainterPen(painter, btn[state & State_MouseOver ? 3 : 4], QPenWidth1); |
1610 | 1618 | painter->drawArc(QRectF(x + 0.75, y + 0.75, opts.crSize - 1.5, |
1611 | 1619 | opts.crSize - 1.5), |
1612 | 1620 | lightBorder ? 0 : 45 * 16, |
… |
… |
Style::drawPrimitiveIndicatorCheckBox(PrimitiveElement element, |
1661 | 1669 | if (r == QRect(0, 0, 14, 15)) { // OO.o 3.2 =14x15? |
1662 | 1670 | rect.adjust(-1, -1, -1, -1); |
1663 | 1671 | } |
1664 | | painter->setPen(option ? option->palette.text().color() : |
1665 | | QApplication::palette().text().color()); |
| 1672 | setPainterPen(painter, option ? option->palette.text().color() : |
| 1673 | QApplication::palette().text().color(), QPenWidth1); |
1666 | 1674 | drawRect(painter, r); |
1667 | 1675 | // LibreOffice its 15x15 - and arrow is not centred, so adjust this... |
1668 | 1676 | if (r == QRect(0, 0, 15, 15)) { |
… |
… |
Style::drawPrimitiveIndicatorCheckBox(PrimitiveElement element, |
1721 | 1729 | |
1722 | 1730 | if (opts.coloredMouseOver != MO_NONE && !glow && mo) { |
1723 | 1731 | painter->setRenderHint(QPainter::Antialiasing, true); |
1724 | | painter->setPen(use[CR_MO_FILL]); |
| 1732 | setPainterPen(painter, use[CR_MO_FILL], QPenWidth1); |
1725 | 1733 | drawAaRect(painter, rect.adjusted(1, 1, -1, -1)); |
1726 | 1734 | painter->setRenderHint(QPainter::Antialiasing, QPAINTER_ANTIALIAS_MAYBE_ON); |
1727 | 1735 | } else { |
1728 | | painter->setPen(midColor(state & State_Enabled ? |
| 1736 | setPainterPen(painter, midColor(state & State_Enabled ? |
1729 | 1737 | palette.base().color() : |
1730 | | palette.background().color(), use[3])); |
| 1738 | palette.background().color(), use[3]), QPenWidth1); |
1731 | 1739 | if (lightBorder) { |
1732 | 1740 | drawRect(painter, rect.adjusted(1, 1, -1, -1)); |
1733 | 1741 | } else { |
… |
… |
Style::drawPrimitiveIndicatorCheckBox(PrimitiveElement element, |
1762 | 1770 | // tri-state |
1763 | 1771 | int x(rect.center().x()), y(rect.center().y()); |
1764 | 1772 | |
1765 | | painter->setPen(checkRadioCol(option)); |
| 1773 | setPainterPen(painter, checkRadioCol(option), QPenWidth1); |
1766 | 1774 | painter->drawLine(x - 3, y, x + 3, y); |
1767 | 1775 | painter->drawLine(x - 3, y + 1, x + 3, y + 1); |
1768 | 1776 | } |