| 1 | /* LED class adapted from KDE to use under QT |
| 2 | * |
| 3 | Copyright (C) 1998 Jörg Habenicht ([email protected]) |
| 4 | Copyright (C) 2010 Christoph Feck <[email protected]> |
| 5 | Copyright (C) 2011 Mario Stephan <[email protected]> |
| 6 | |
| 7 | This library is free software; you can redistribute it and/or |
| 8 | modify it under the terms of the GNU Library General Public |
| 9 | License as published by the Free Software Foundation; either |
| 10 | version 2 of the License, or (at your option) any later version. |
| 11 | |
| 12 | This library is distributed in the hope that it will be useful, |
| 13 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | Library General Public License for more details. |
| 16 | |
| 17 | You should have received a copy of the GNU Library General Public License |
| 18 | along with this library; see the file COPYING.LIB. If not, write to |
| 19 | the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, |
| 20 | Boston, MA 02110-1301, USA. |
| 21 | */ |
| 22 | |
| 23 | #include "qled.h"cxx . . $ `<file>/src/qled.h`/ |
| 24 | |
| 25 | #include <QStyle> |
| 26 | #include <QStyleOption> |
| 27 | #include <QtGui/QImage> |
| 28 | #include <QtGui/QPainter> |
| 29 | |
| 30 | class QLedcxx . . $ QLed#::Privatecxx . . $ QLed#Private# { |
| 31 | public: |
| 32 | Privatecxx . . $ QLed#Private#Private(49f6e7a06ebc5aa8).() |
| 33 | : darkFactorcxx . . $ QLed#Private#darkFactor.(300) |
| 34 | , statecxx . . $ QLed#Private#state.(Oncxx . . $ QLed#On.) |
| 35 | , lookcxx . . $ QLed#Private#look.(Raisedcxx . . $ QLed#Raised.) |
| 36 | , shapecxx . . $ QLed#Private#shape.(Circularcxx . . $ QLed#Circular.) |
| 37 | { |
| 38 | } |
| 39 | |
| 40 | int darkFactorcxx . . $ QLed#Private#darkFactor.; |
| 41 | QColorcxx . . $ QColor# colorcxx . . $ QLed#Private#color.; |
| 42 | Statecxx . . $ QLed#State# statecxx . . $ QLed#Private#state.; |
| 43 | Lookcxx . . $ QLed#Look# lookcxx . . $ QLed#Private#look.; |
| 44 | Shapecxx . . $ QLed#Shape# shapecxx . . $ QLed#Private#shape.; |
| 45 | QPixmapcxx . . $ QPixmap# cachedPixmapcxx . . $ QLed#Private#cachedPixmap.[2]; // for both states |
| 46 | QStylecxx . . $ QStyle#::ControlElementcxx . . $ QStyle#ControlElement# ce_indicatorLedCircularcxx . . $ QLed#Private#ce_indicatorLedCircular.; |
| 47 | QStylecxx . . $ QStyle#::ControlElementcxx . . $ QStyle#ControlElement# ce_indicatorLedRectangularcxx . . $ QLed#Private#ce_indicatorLedRectangular.; |
| 48 | }; |
| 49 | |
| 50 | QLedcxx . . $ QLed#::QLedcxx . . $ QLed#QLed(108f35f7aa7f3cf9).(QWidgetcxx . . $ QWidget#* parent) |
| 51 | : QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent) |
| 52 | , dcxx . . $ QLed#d.(new Privatecxx . . $ QLed#Private#Private(49f6e7a06ebc5aa8).) |
| 53 | { |
| 54 | setColorcxx . . $ QLed#setColor(129a55e114526ad3).(Qtcxx . . $ QColor#QColor(408ec4d5924bfb00).::greencxx . . $ Qt/green.); |
| 55 | } |
| 56 | |
| 57 | QLedcxx . . $ QLed#::QLedcxx . . $ QLed#QLed(3c3dcce02bc111f4).(const QColorcxx . . $ QColor#& color, QWidgetcxx . . $ QWidget#* parent) |
| 58 | : QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent) |
| 59 | , dcxx . . $ QLed#d.(new Privatecxx . . $ QLed#Private#Private(49f6e7a06ebc5aa8).) |
| 60 | { |
| 61 | setColorcxx . . $ QLed#setColor(129a55e114526ad3).(color); |
| 62 | } |
| 63 | |
| 64 | QLedcxx . . $ QLed#::QLedcxx . . $ QLed#QLed(e547b56e2f5d3887).(const QColorcxx . . $ QColor#& color, Statecxx . . $ QLed#State# state, Lookcxx . . $ QLed#Look# look, Shapecxx . . $ QLed#Shape# shape, |
| 65 | QWidgetcxx . . $ QWidget#* parent) |
| 66 | : QWidgetcxx . . $ QWidget#QWidget(872e7b0c281abd8d).(parent) |
| 67 | , dcxx . . $ QLed#d.(new Privatecxx . . $ QLed#Private#Private(49f6e7a06ebc5aa8).) |
| 68 | { |
| 69 | dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state. = (state == Offcxx . . $ QLed#Off. ? Offcxx . . $ QLed#Off. : Oncxx . . $ QLed#On.); |
| 70 | dcxx . . $ QLed#d.->lookcxx . . $ QLed#Private#look. = look; |
| 71 | dcxx . . $ QLed#d.->shapecxx . . $ QLed#Private#shape. = shape; |
| 72 | setColorcxx . . $ QLed#setColor(129a55e114526ad3).(color); |
| 73 | } |
| 74 | |
| 75 | QLedcxx . . $ QLed#::~cxx . . $ QLed#`~QLed`(ced63f7c635d850d).QLedcxx . . $ QLed#() |
| 76 | { |
| 77 | delete dcxx . . $ QLed#d.; |
| 78 | } |
| 79 | |
| 80 | void QLedcxx . . $ QLed#::paintEventcxx . . $ QLed#paintEvent(f239c9e85d61a220).(QPaintEventcxx . . $ QPaintEvent#*) |
| 81 | { |
| 82 | switch (dcxx . . $ QLed#d.->shapecxx . . $ QLed#Private#shape.) { |
| 83 | case Rectangularcxx . . $ QLed#Rectangular.: |
| 84 | switch (dcxx . . $ QLed#d.->lookcxx . . $ QLed#Private#look.) { |
| 85 | case Sunkencxx . . $ QLed#Sunken.: |
| 86 | paintRectFramecxx . . $ QLed#paintRectFrame(b45ddcbc8423892c).(false); |
| 87 | break; |
| 88 | case Raisedcxx . . $ QLed#Raised.: |
| 89 | paintRectFramecxx . . $ QLed#paintRectFrame(b45ddcbc8423892c).(true); |
| 90 | break; |
| 91 | case Flatcxx . . $ QLed#Flat.: |
| 92 | paintRectcxx . . $ QLed#paintRect(49f6e7a06ebc5aa8).(); |
| 93 | break; |
| 94 | } |
| 95 | break; |
| 96 | case Circularcxx . . $ QLed#Circular.: |
| 97 | switch (dcxx . . $ QLed#d.->lookcxx . . $ QLed#Private#look.) { |
| 98 | case Flatcxx . . $ QLed#Flat.: |
| 99 | paintFlatcxx . . $ QLed#paintFlat(49f6e7a06ebc5aa8).(); |
| 100 | break; |
| 101 | case Raisedcxx . . $ QLed#Raised.: |
| 102 | paintRaisedcxx . . $ QLed#paintRaised(49f6e7a06ebc5aa8).(); |
| 103 | break; |
| 104 | case Sunkencxx . . $ QLed#Sunken.: |
| 105 | paintSunkencxx . . $ QLed#paintSunken(49f6e7a06ebc5aa8).(); |
| 106 | break; |
| 107 | } |
| 108 | break; |
| 109 | } |
| 110 | } |
| 111 | |
| 112 | int QLedcxx . . $ QLed#::ledWidthcxx . . $ QLed#ledWidth(455f465bc33b4cdf).() const |
| 113 | { |
| 114 | // Make sure the LED is round! |
| 115 | int size = qMincxx . . $ qMin(2a338fce5842aa6a).(widthcxx . . $ QWidget#width(455f465bc33b4cdf).(), heightcxx . . $ QWidget#height(455f465bc33b4cdf).()); |
| 116 | |
| 117 | // leave one pixel border |
| 118 | size -= 2; |
| 119 | |
| 120 | return qMaxcxx . . $ qMax(2a338fce5842aa6a).(0, size); |
| 121 | } |
| 122 | |
| 123 | bool QLedcxx . . $ QLed#::paintCachedPixmapcxx . . $ QLed#paintCachedPixmap(c9857a73d68e59ba).() |
| 124 | { |
| 125 | if (dcxx . . $ QLed#d.->cachedPixmapcxx . . $ QLed#Private#cachedPixmap.[dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state.].isNullcxx . . $ QPixmap#isNull(50ce9a9e25b4a850).()) { |
| 126 | return false; |
| 127 | } |
| 128 | QPaintercxx . . $ QPainter# paintercxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(this); |
| 129 | painter.drawPixmapcxx . . $ QPainter#drawPixmap(c906314a67120896).(1, 1, dcxx . . $ QLed#d.->cachedPixmapcxx . . $ QLed#Private#cachedPixmap.[dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state.]); |
| 130 | return true; |
| 131 | } |
| 132 | |
| 133 | void QLedcxx . . $ QLed#::paintFlatcxx . . $ QLed#paintFlat(49f6e7a06ebc5aa8).() |
| 134 | { |
| 135 | paintLedcxx . . $ QLed#paintLed(2b1357a7fabc35f1).(Circularcxx . . $ QLed#Circular., Flatcxx . . $ QLed#Flat.); |
| 136 | } |
| 137 | |
| 138 | void QLedcxx . . $ QLed#::paintRaisedcxx . . $ QLed#paintRaised(49f6e7a06ebc5aa8).() |
| 139 | { |
| 140 | paintLedcxx . . $ QLed#paintLed(2b1357a7fabc35f1).(Circularcxx . . $ QLed#Circular., Raisedcxx . . $ QLed#Raised.); |
| 141 | } |
| 142 | |
| 143 | void QLedcxx . . $ QLed#::paintSunkencxx . . $ QLed#paintSunken(49f6e7a06ebc5aa8).() |
| 144 | { |
| 145 | paintLedcxx . . $ QLed#paintLed(2b1357a7fabc35f1).(Circularcxx . . $ QLed#Circular., Sunkencxx . . $ QLed#Sunken.); |
| 146 | } |
| 147 | |
| 148 | void QLedcxx . . $ QLed#::paintRectcxx . . $ QLed#paintRect(49f6e7a06ebc5aa8).() |
| 149 | { |
| 150 | paintLedcxx . . $ QLed#paintLed(2b1357a7fabc35f1).(Rectangularcxx . . $ QLed#Rectangular., Flatcxx . . $ QLed#Flat.); |
| 151 | } |
| 152 | |
| 153 | void QLedcxx . . $ QLed#::paintRectFramecxx . . $ QLed#paintRectFrame(b45ddcbc8423892c).(bool raised) |
| 154 | { |
| 155 | paintLedcxx . . $ QLed#paintLed(2b1357a7fabc35f1).(Rectangularcxx . . $ QLed#Rectangular., raised ? Raisedcxx . . $ QLed#Raised. : Sunkencxx . . $ QLed#Sunken.); |
| 156 | } |
| 157 | |
| 158 | QLedcxx . . $ QLed#::Statecxx . . $ QLed#State# QLedcxx . . $ QLed#::statecxx . . $ QLed#state(97a9ec340be2cb70).() const |
| 159 | { |
| 160 | return dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state.; |
| 161 | } |
| 162 | |
| 163 | QLedcxx . . $ QLed#::Shapecxx . . $ QLed#Shape# QLedcxx . . $ QLed#::shapecxx . . $ QLed#shape(ef43cf604775b195).() const |
| 164 | { |
| 165 | return dcxx . . $ QLed#d.->shapecxx . . $ QLed#Private#shape.; |
| 166 | } |
| 167 | |
| 168 | QColorcxx . . $ QColor# QLedcxx . . $ QLed#::colorcxx . . $ QLed#color(6d62b116d5d1b12f).() const |
| 169 | { |
| 170 | return dcxx . . $ QColor#QColor(c396aab421781ee8).->colorcxx . . $ QLed#Private#color.; |
| 171 | } |
| 172 | |
| 173 | QLedcxx . . $ QLed#::Lookcxx . . $ QLed#Look# QLedcxx . . $ QLed#::lookcxx . . $ QLed#look(5c4af37df4ab5c90).() const |
| 174 | { |
| 175 | return dcxx . . $ QLed#d.->lookcxx . . $ QLed#Private#look.; |
| 176 | } |
| 177 | |
| 178 | void QLedcxx . . $ QLed#::setStatecxx . . $ QLed#setState(c3814832606d3bfb).(Statecxx . . $ QLed#State# state) |
| 179 | { |
| 180 | if (dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state. == state) |
| 181 | return; |
| 182 | |
| 183 | dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state. = (state == Offcxx . . $ QLed#Off. ? Offcxx . . $ QLed#Off. : Oncxx . . $ QLed#On.); |
| 184 | updateCachedPixmapcxx . . $ QLed#updateCachedPixmap(49f6e7a06ebc5aa8).(); |
| 185 | } |
| 186 | |
| 187 | void QLedcxx . . $ QLed#::setShapecxx . . $ QLed#setShape(c349c718748204da).(Shapecxx . . $ QLed#Shape# shape) |
| 188 | { |
| 189 | if (dcxx . . $ QLed#d.->shapecxx . . $ QLed#Private#shape. == shape) |
| 190 | return; |
| 191 | |
| 192 | dcxx . . $ QLed#d.->shapecxx . . $ QLed#Private#shape. = shape; |
| 193 | updateCachedPixmapcxx . . $ QLed#updateCachedPixmap(49f6e7a06ebc5aa8).(); |
| 194 | } |
| 195 | |
| 196 | void QLedcxx . . $ QLed#::setColorcxx . . $ QLed#setColor(129a55e114526ad3).(const QColorcxx . . $ QColor#& color) |
| 197 | { |
| 198 | if (dcxx . . $ QLed#d.->colorcxx . . $ QLed#Private#color. ==cxx . . $ QColor#`operator==`(8df5130dab4f572b). color) |
| 199 | return; |
| 200 | |
| 201 | dcxx . . $ QLed#d.->colorcxx . . $ QLed#Private#color. =cxx . . $ QColor#`operator=`(a3db1be773b26671). color; |
| 202 | updateCachedPixmapcxx . . $ QLed#updateCachedPixmap(49f6e7a06ebc5aa8).(); |
| 203 | } |
| 204 | |
| 205 | void QLedcxx . . $ QLed#::setDarkFactorcxx . . $ QLed#setDarkFactor(d4f767463ce0a6b3).(int darkFactor) |
| 206 | { |
| 207 | if (dcxx . . $ QLed#d.->darkFactorcxx . . $ QLed#Private#darkFactor. == darkFactor) |
| 208 | return; |
| 209 | |
| 210 | dcxx . . $ QLed#d.->darkFactorcxx . . $ QLed#Private#darkFactor. = darkFactor; |
| 211 | updateCachedPixmapcxx . . $ QLed#updateCachedPixmap(49f6e7a06ebc5aa8).(); |
| 212 | } |
| 213 | |
| 214 | int QLedcxx . . $ QLed#::darkFactorcxx . . $ QLed#darkFactor(455f465bc33b4cdf).() const |
| 215 | { |
| 216 | return dcxx . . $ QLed#d.->darkFactorcxx . . $ QLed#Private#darkFactor.; |
| 217 | } |
| 218 | |
| 219 | void QLedcxx . . $ QLed#::setLookcxx . . $ QLed#setLook(fdc459d8768250a7).(Lookcxx . . $ QLed#Look# look) |
| 220 | { |
| 221 | if (dcxx . . $ QLed#d.->lookcxx . . $ QLed#Private#look. == look) |
| 222 | return; |
| 223 | |
| 224 | dcxx . . $ QLed#d.->lookcxx . . $ QLed#Private#look. = look; |
| 225 | updateCachedPixmapcxx . . $ QLed#updateCachedPixmap(49f6e7a06ebc5aa8).(); |
| 226 | } |
| 227 | |
| 228 | void QLedcxx . . $ QLed#::togglecxx . . $ QLed#toggle(49f6e7a06ebc5aa8).() |
| 229 | { |
| 230 | dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state. = (dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state. == Oncxx . . $ QLed#On. ? Offcxx . . $ QLed#Off. : Oncxx . . $ QLed#On.); |
| 231 | updateCachedPixmapcxx . . $ QLed#updateCachedPixmap(49f6e7a06ebc5aa8).(); |
| 232 | } |
| 233 | |
| 234 | void QLedcxx . . $ QLed#::oncxx . . $ QLed#on(49f6e7a06ebc5aa8).() |
| 235 | { |
| 236 | setStatecxx . . $ QLed#setState(c3814832606d3bfb).(Oncxx . . $ QLed#On.); |
| 237 | } |
| 238 | |
| 239 | void QLedcxx . . $ QLed#::offcxx . . $ QLed#off(49f6e7a06ebc5aa8).() |
| 240 | { |
| 241 | setStatecxx . . $ QLed#setState(c3814832606d3bfb).(Offcxx . . $ QLed#Off.); |
| 242 | } |
| 243 | |
| 244 | void QLedcxx . . $ QLed#::resizeEventcxx . . $ QLed#resizeEvent(eeeec21cf8dc0387).(QResizeEventcxx . . $ QResizeEvent#*) |
| 245 | { |
| 246 | updateCachedPixmapcxx . . $ QLed#updateCachedPixmap(49f6e7a06ebc5aa8).(); |
| 247 | } |
| 248 | |
| 249 | QSizecxx . . $ QSize# QLedcxx . . $ QLed#::sizeHintcxx . . $ QLed#sizeHint(4b3b776e5ee2b367).() const |
| 250 | { |
| 251 | QStyleOptioncxx . . $ QStyleOption# optioncxx . . $ QStyleOption#QStyleOption(3e454b8ccf442868).; |
| 252 | option.initFromcxx . . $ QStyleOption#initFrom(20cdb7fa2a1349c7).(this); |
| 253 | int iconSize = stylecxx . . $ QWidget#style(5bbb00d3017c281f).()->pixelMetriccxx . . $ QStyle#pixelMetric(83914974d8fbce56).(QStylecxx . . $ QStyle#::PM_SmallIconSizecxx . . $ QStyle#PM_SmallIconSize., &option, this); |
| 254 | return QSizecxx . . $ QSize#QSize(c0d38f4800714fae).(iconSize, iconSize); |
| 255 | } |
| 256 | |
| 257 | QSizecxx . . $ QSize# QLedcxx . . $ QLed#::minimumSizeHintcxx . . $ QLed#minimumSizeHint(4b3b776e5ee2b367).() const |
| 258 | { |
| 259 | return QSizecxx . . $ QSize#QSize(c0d38f4800714fae).(16, 16); |
| 260 | } |
| 261 | |
| 262 | void QLedcxx . . $ QLed#::updateCachedPixmapcxx . . $ QLed#updateCachedPixmap(49f6e7a06ebc5aa8).() |
| 263 | { |
| 264 | dcxx . . $ QLed#d.->cachedPixmapcxx . . $ QLed#Private#cachedPixmap.[Offcxx . . $ QLed#Off.] =cxx . . $ QPixmap#`operator=`(4972951fe8d596b5). QPixmapcxx . . $ QPixmap#QPixmap(49f6e7a06ebc5aa8).(); |
| 265 | dcxx . . $ QLed#d.->cachedPixmapcxx . . $ QLed#Private#cachedPixmap.[Oncxx . . $ QLed#On.] =cxx . . $ QPixmap#`operator=`(4972951fe8d596b5). QPixmapcxx . . $ QPixmap#QPixmap(49f6e7a06ebc5aa8).(); |
| 266 | updatecxx . . $ QWidget#update(49f6e7a06ebc5aa8).(); |
| 267 | } |
| 268 | |
| 269 | void QLedcxx . . $ QLed#::paintLedcxx . . $ QLed#paintLed(2b1357a7fabc35f1).(Shapecxx . . $ QLed#Shape# shape, Lookcxx . . $ QLed#Look# look) |
| 270 | { |
| 271 | if (paintCachedPixmapcxx . . $ QLed#paintCachedPixmap(c9857a73d68e59ba).()) { |
| 272 | return; |
| 273 | } |
| 274 | |
| 275 | QSizecxx . . $ QSize# sizecxx . . $ QSize#QSize(c0d38f4800714fae).(widthcxx . . $ QWidget#width(455f465bc33b4cdf).() - 2, heightcxx . . $ QWidget#height(455f465bc33b4cdf).() - 2); |
| 276 | if (shape == Circularcxx . . $ QLed#Circular.) { |
| 277 | const int width = ledWidthcxx . . $ QLed#ledWidth(455f465bc33b4cdf).(); |
| 278 | size =cxx . . $ QSize#`operator=`(eccf1d0da1f690e2). QSizecxx . . $ QSize#QSize(c0d38f4800714fae).(width, width); |
| 279 | } |
| 280 | QPointFcxx . . $ QPointF# centercxx . . $ QPointF#QPointF(bc12c9ec15586e6a).(size.widthcxx . . $ QSize#width(ea6fe5115c70a13f).() / 2.0, size.heightcxx . . $ QSize#height(ea6fe5115c70a13f).() / 2.0); |
| 281 | const int smallestSize = qMincxx . . $ qMin(2a338fce5842aa6a).(size.widthcxx . . $ QSize#width(ea6fe5115c70a13f).(), size.heightcxx . . $ QSize#height(ea6fe5115c70a13f).()); |
| 282 | QPaintercxx . . $ QPainter# paintercxx . . $ QPainter#QPainter(49f6e7a06ebc5aa8).; |
| 283 | QImagecxx . . $ QImage# imagecxx . . $ QImage#QImage(fe815e29ae3e37c9).(size, QImagecxx . . $ QImage#::Format_ARGB32_Premultipliedcxx . . $ QImage#Format_ARGB32_Premultiplied.); |
| 284 | image.fillcxx . . $ QImage#fill(cb2f890c2fdad230).(0); |
| 285 | QRadialGradientcxx . . $ QRadialGradient# fillGradientcxx . . $ QRadialGradient#QRadialGradient(5a76b9ad396af36b).(center, smallestSize / 2.0, QPointFcxx . . $ QPointF#QPointF(bc12c9ec15586e6a).(center.xcxx . . $ QPointF#x(21b6c25e127938e2).(), size.heightcxx . . $ QSize#height(ea6fe5115c70a13f).() / 3.0)); |
| 286 | const QColorcxx . . $ QColor# fillColor = dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state. != Offcxx . . $ QLed#Off. ? dcxx . . $ QColor#QColor(c396aab421781ee8).->colorcxx . . $ QLed#Private#color. : dcxx . . $ QLed#d.->colorcxx . . $ QLed#Private#color..darkcxx . . $ QColor#dark(a312dab4e0811e0).(dcxx . . $ QLed#d.->darkFactorcxx . . $ QLed#Private#darkFactor.); |
| 287 | fillGradient.setColorAtcxx . . $ QGradient#setColorAt(e8a5895791b6fa8c).(0.0, fillColor.lightcxx . . $ QColor#light(a312dab4e0811e0).(250)); |
| 288 | fillGradient.setColorAtcxx . . $ QGradient#setColorAt(e8a5895791b6fa8c).(0.5, fillColor.lightcxx . . $ QColor#light(a312dab4e0811e0).(130)); |
| 289 | fillGradient.setColorAtcxx . . $ QGradient#setColorAt(e8a5895791b6fa8c).(1.0, fillColor); |
| 290 | QConicalGradientcxx . . $ QConicalGradient# borderGradientcxx . . $ QConicalGradient#QConicalGradient(12845cb24d750046).(center, look == Sunkencxx . . $ QLed#Sunken. ? 90 : -90); |
| 291 | QColorcxx . . $ QColor# borderColor = palettecxx . . $ QColor#QColor(c396aab421781ee8).().colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Darkcxx . . $ QPalette#Dark.); |
| 292 | if (dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state. == Oncxx . . $ QLed#On.) { |
| 293 | QColorcxx . . $ QColor# glowOverlay = fillColorcxx . . $ QColor#QColor(c396aab421781ee8).; |
| 294 | glowOverlay.setAlphacxx . . $ QColor#setAlpha(d4f767463ce0a6b3).(80); |
| 295 | borderColor =cxx . . $ QColor#`operator=`(fd1b853fb77c9003). overlayColorscxx . . $ QLed#overlayColors(ee3e018a28843076).(borderColor, glowOverlay); |
| 296 | } |
| 297 | borderGradient.setColorAtcxx . . $ QGradient#setColorAt(e8a5895791b6fa8c).(0.2, borderColor); |
| 298 | borderGradient.setColorAtcxx . . $ QGradient#setColorAt(e8a5895791b6fa8c).(0.5, palettecxx . . $ QWidget#palette(a7bd6a16d2c88209).().colorcxx . . $ QPalette#color(a08a5ea14130e12).(QPalettecxx . . $ QPalette#::Lightcxx . . $ QPalette#Light.)); |
| 299 | borderGradient.setColorAtcxx . . $ QGradient#setColorAt(e8a5895791b6fa8c).(0.8, borderColor); |
| 300 | |
| 301 | painter.begincxx . . $ QPainter#begin(3d42010d693361d5).(&image); |
| 302 | painter.setRenderHintcxx . . $ QPainter#setRenderHint(df747a77a7bbbce1).(QPaintercxx . . $ QPainter#::Antialiasingcxx . . $ QPainter#Antialiasing.); |
| 303 | painter.setBrushcxx . . $ QPainter#setBrush(ffc9f5d0bda78261).(look == Flatcxx . . $ QLed#Flat. ? QBrushcxx . . $ QBrush#QBrush(b50947b0752ea6ac).(fillColor) : QBrushcxx . . $ QBrush#QBrush(cbd511d3bf8d464c).(fillGradient)); |
| 304 | const QBrushcxx . . $ QBrush# penBrush = (look == Flatcxx . . $ QLed#Flat.) ? QBrushcxx . . $ QBrush#QBrush(b50947b0752ea6ac).(borderColor) : QBrushcxx . . $ QBrush#QBrush(cbd511d3bf8d464c).(borderGradient); |
| 305 | const qrealcxx . . $ qreal# penWidth = smallestSize / 8.0; |
| 306 | painter.setPencxx . . $ QPainter#setPen(af0a25dfda3214db).(QPencxx . . $ QPen#QPen(c1f9b1cc0228302b).(penBrush, penWidth)); |
| 307 | QRectFcxx . . $ QRectF# rcxx . . $ QRectF#QRectF(ba0360b8cbb82f7c).(penWidth / 2.0, penWidth / 2.0, size.widthcxx . . $ QSize#width(ea6fe5115c70a13f).() - penWidth, size.heightcxx . . $ QSize#height(ea6fe5115c70a13f).() - penWidth); |
| 308 | if (shape == Rectangularcxx . . $ QLed#Rectangular.) { |
| 309 | painter.drawRectcxx . . $ QPainter#drawRect(7a51d6bf5aba0926).(r); |
| 310 | } else { |
| 311 | painter.drawEllipsecxx . . $ QPainter#drawEllipse(7a51d6bf5aba0926).(r); |
| 312 | } |
| 313 | painter.endcxx . . $ QPainter#end(c9857a73d68e59ba).(); |
| 314 | |
| 315 | dcxx . . $ QLed#d.->cachedPixmapcxx . . $ QLed#Private#cachedPixmap.[dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state.] =cxx . . $ QPixmap#`operator=`(4972951fe8d596b5). QPixmapcxx . . $ QPixmap#::fromImagecxx . . $ QPixmap#fromImage(e89e6101063912f).(image); |
| 316 | painter.begincxx . . $ QPainter#begin(3d42010d693361d5).(this); |
| 317 | painter.drawPixmapcxx . . $ QPainter#drawPixmap(c906314a67120896).(1, 1, dcxx . . $ QLed#d.->cachedPixmapcxx . . $ QLed#Private#cachedPixmap.[dcxx . . $ QLed#d.->statecxx . . $ QLed#Private#state.]); |
| 318 | painter.endcxx . . $ QPainter#end(c9857a73d68e59ba).(); |
| 319 | } |
| 320 | |
| 321 | QColorcxx . . $ QColor# QLedcxx . . $ QLed#::overlayColorscxx . . $ QLed#overlayColors(ee3e018a28843076).(const QColorcxx . . $ QColor#& base, const QColorcxx . . $ QColor#& paint, |
| 322 | QPaintercxx . . $ QPainter#::CompositionModecxx . . $ QPainter#CompositionMode# comp) |
| 323 | { |
| 324 | QImagecxx . . $ QImage# imgcxx . . $ QImage#QImage(bf9e47a5364bf007).(1, 1, QImagecxx . . $ QImage#::Format_ARGB32_Premultipliedcxx . . $ QImage#Format_ARGB32_Premultiplied.); |
| 325 | QPaintercxx . . $ QPainter# pcxx . . $ QPainter#QPainter(dd2eedc069b0ab5f).(&img); |
| 326 | QColorcxx . . $ QColor# start = basecxx . . $ QColor#QColor(c396aab421781ee8).; |
| 327 | start.setAlphacxx . . $ QColor#setAlpha(d4f767463ce0a6b3).(255); // opaque |
| 328 | p.fillRectcxx . . $ QPainter#fillRect(b6f7dd7f1bbb6c84).(0, 0, 1, 1, start); |
| 329 | p.setCompositionModecxx . . $ QPainter#setCompositionMode(233e5f91a307c5b).(comp); |
| 330 | p.fillRectcxx . . $ QPainter#fillRect(b6f7dd7f1bbb6c84).(0, 0, 1, 1, paint); |
| 331 | p.endcxx . . $ QPainter#end(c9857a73d68e59ba).(); |
| 332 | return imgcxx . . $ QColor#QColor(6bab9b75950d6f3)..pixelcxx . . $ QImage#pixel(d41b8d272ac56277).(0, 0); |
| 333 | } |