| Absolute File Name: | /home/qt/qt5_coco/qt5/qtbase/src/widgets/styles/qpixmapstyle.cpp |
| Switch to Source code | Preprocessed file |
| Line | Source | Count | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | - | |||||||||||||||||||
| 2 | - | |||||||||||||||||||
| 3 | - | |||||||||||||||||||
| 4 | - | |||||||||||||||||||
| 5 | QPixmapStyle::QPixmapStyle() | - | ||||||||||||||||||
| 6 | : QCommonStyle(*new QPixmapStylePrivate) | - | ||||||||||||||||||
| 7 | { | - | ||||||||||||||||||
| 8 | } never executed: end of block | 0 | ||||||||||||||||||
| 9 | - | |||||||||||||||||||
| 10 | - | |||||||||||||||||||
| 11 | - | |||||||||||||||||||
| 12 | - | |||||||||||||||||||
| 13 | QPixmapStyle::~QPixmapStyle() | - | ||||||||||||||||||
| 14 | { | - | ||||||||||||||||||
| 15 | } | - | ||||||||||||||||||
| 16 | - | |||||||||||||||||||
| 17 | - | |||||||||||||||||||
| 18 | - | |||||||||||||||||||
| 19 | - | |||||||||||||||||||
| 20 | void QPixmapStyle::polish(QApplication *application) | - | ||||||||||||||||||
| 21 | { | - | ||||||||||||||||||
| 22 | QCommonStyle::polish(application); | - | ||||||||||||||||||
| 23 | - | |||||||||||||||||||
| 24 | - | |||||||||||||||||||
| 25 | - | |||||||||||||||||||
| 26 | } never executed: end of block | 0 | ||||||||||||||||||
| 27 | - | |||||||||||||||||||
| 28 | - | |||||||||||||||||||
| 29 | - | |||||||||||||||||||
| 30 | - | |||||||||||||||||||
| 31 | void QPixmapStyle::polish(QPalette &palette) | - | ||||||||||||||||||
| 32 | { | - | ||||||||||||||||||
| 33 | palette = proxy()->standardPalette(); | - | ||||||||||||||||||
| 34 | } never executed: end of block | 0 | ||||||||||||||||||
| 35 | - | |||||||||||||||||||
| 36 | - | |||||||||||||||||||
| 37 | - | |||||||||||||||||||
| 38 | - | |||||||||||||||||||
| 39 | void QPixmapStyle::polish(QWidget *widget) | - | ||||||||||||||||||
| 40 | { | - | ||||||||||||||||||
| 41 | QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 42 | - | |||||||||||||||||||
| 43 | - | |||||||||||||||||||
| 44 | if (qobject_cast<QTextEdit*>(widget)
| 0 | ||||||||||||||||||
| 45 | QPalette p = widget->palette(); | - | ||||||||||||||||||
| 46 | p.setBrush(QPalette::Base, Qt::NoBrush); | - | ||||||||||||||||||
| 47 | widget->setPalette(p); | - | ||||||||||||||||||
| 48 | } never executed: end of block | 0 | ||||||||||||||||||
| 49 | - | |||||||||||||||||||
| 50 | if (QProgressBar *pb = qobject_cast<QProgressBar*>(widget)
| 0 | ||||||||||||||||||
| 51 | - | |||||||||||||||||||
| 52 | pb->setAlignment(Qt::AlignCenter); | - | ||||||||||||||||||
| 53 | - | |||||||||||||||||||
| 54 | QFont font = pb->font(); | - | ||||||||||||||||||
| 55 | font.setPixelSize(d->descriptors.value(PB_HBackground).size.height()/2); | - | ||||||||||||||||||
| 56 | pb->setFont(font); | - | ||||||||||||||||||
| 57 | } never executed: end of block | 0 | ||||||||||||||||||
| 58 | - | |||||||||||||||||||
| 59 | if (qobject_cast<QSlider*>(widget)
| 0 | ||||||||||||||||||
| 60 | widget->installEventFilter(this); never executed: widget->installEventFilter(this); | 0 | ||||||||||||||||||
| 61 | - | |||||||||||||||||||
| 62 | if (QComboBox *cb = qobject_cast<QComboBox*>(widget)
| 0 | ||||||||||||||||||
| 63 | widget->installEventFilter(this); | - | ||||||||||||||||||
| 64 | - | |||||||||||||||||||
| 65 | - | |||||||||||||||||||
| 66 | QAbstractItemView *list = cb->view(); | - | ||||||||||||||||||
| 67 | list->setProperty("_pixmap_combobox_list", true); | - | ||||||||||||||||||
| 68 | list->setItemDelegate(new QStyledItemDelegate(list)); | - | ||||||||||||||||||
| 69 | QPalette p = list->palette(); | - | ||||||||||||||||||
| 70 | p.setBrush(QPalette::Active, QPalette::Base, QBrush(Qt::transparent) ); | - | ||||||||||||||||||
| 71 | p.setBrush(QPalette::Active, QPalette::AlternateBase, QBrush(Qt::transparent) ); | - | ||||||||||||||||||
| 72 | p.setBrush(QPalette::Inactive, QPalette::Base, QBrush(Qt::transparent) ); | - | ||||||||||||||||||
| 73 | p.setBrush(QPalette::Inactive, QPalette::AlternateBase, QBrush(Qt::transparent) ); | - | ||||||||||||||||||
| 74 | p.setBrush(QPalette::Disabled, QPalette::Base, QBrush(Qt::transparent) ); | - | ||||||||||||||||||
| 75 | p.setBrush(QPalette::Disabled, QPalette::AlternateBase, QBrush(Qt::transparent) ); | - | ||||||||||||||||||
| 76 | list->setPalette(p); | - | ||||||||||||||||||
| 77 | - | |||||||||||||||||||
| 78 | QFrame *frame = qobject_cast<QFrame*>(list->parent()); | - | ||||||||||||||||||
| 79 | if (frame
| 0 | ||||||||||||||||||
| 80 | const QPixmapStyleDescriptor &desc = d->descriptors.value(DD_PopupDown); | - | ||||||||||||||||||
| 81 | const QPixmapStylePixmap &pix = d->pixmaps.value(DD_ItemSeparator); | - | ||||||||||||||||||
| 82 | frame->setContentsMargins(pix.margins.left(), desc.margins.top(), | - | ||||||||||||||||||
| 83 | pix.margins.right(), desc.margins.bottom()); | - | ||||||||||||||||||
| 84 | frame->setAttribute(Qt::WA_TranslucentBackground); | - | ||||||||||||||||||
| 85 | - | |||||||||||||||||||
| 86 | - | |||||||||||||||||||
| 87 | - | |||||||||||||||||||
| 88 | - | |||||||||||||||||||
| 89 | - | |||||||||||||||||||
| 90 | } never executed: end of block | 0 | ||||||||||||||||||
| 91 | } never executed: end of block | 0 | ||||||||||||||||||
| 92 | - | |||||||||||||||||||
| 93 | if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0
| 0 | ||||||||||||||||||
| 94 | widget->installEventFilter(this); never executed: widget->installEventFilter(this); | 0 | ||||||||||||||||||
| 95 | - | |||||||||||||||||||
| 96 | if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget)
| 0 | ||||||||||||||||||
| 97 | scrollArea->viewport()->setAutoFillBackground(false); | - | ||||||||||||||||||
| 98 | if (QAbstractItemView *view = qobject_cast<QAbstractItemView*>(scrollArea)
| 0 | ||||||||||||||||||
| 99 | view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel); | - | ||||||||||||||||||
| 100 | view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel); | - | ||||||||||||||||||
| 101 | } never executed: end of block | 0 | ||||||||||||||||||
| 102 | QScroller::grabGesture(scrollArea->viewport(), QScroller::LeftMouseButtonGesture); | - | ||||||||||||||||||
| 103 | } never executed: end of block | 0 | ||||||||||||||||||
| 104 | - | |||||||||||||||||||
| 105 | if (qobject_cast<QScrollBar*>(widget)
| 0 | ||||||||||||||||||
| 106 | widget->setAttribute(Qt::WA_OpaquePaintEvent, false); never executed: widget->setAttribute(Qt::WA_OpaquePaintEvent, false); | 0 | ||||||||||||||||||
| 107 | - | |||||||||||||||||||
| 108 | QCommonStyle::polish(widget); | - | ||||||||||||||||||
| 109 | } never executed: end of block | 0 | ||||||||||||||||||
| 110 | - | |||||||||||||||||||
| 111 | - | |||||||||||||||||||
| 112 | - | |||||||||||||||||||
| 113 | - | |||||||||||||||||||
| 114 | void QPixmapStyle::unpolish(QApplication *application) | - | ||||||||||||||||||
| 115 | { | - | ||||||||||||||||||
| 116 | QCommonStyle::unpolish(application); | - | ||||||||||||||||||
| 117 | } never executed: end of block | 0 | ||||||||||||||||||
| 118 | - | |||||||||||||||||||
| 119 | - | |||||||||||||||||||
| 120 | - | |||||||||||||||||||
| 121 | - | |||||||||||||||||||
| 122 | void QPixmapStyle::unpolish(QWidget *widget) | - | ||||||||||||||||||
| 123 | { | - | ||||||||||||||||||
| 124 | if (qobject_cast<QSlider*>(widget)
| 0 | ||||||||||||||||||
| 125 | qobject_cast<QComboBox*>(widget)
| 0 | ||||||||||||||||||
| 126 | widget->removeEventFilter(this); | - | ||||||||||||||||||
| 127 | } never executed: end of block | 0 | ||||||||||||||||||
| 128 | - | |||||||||||||||||||
| 129 | if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0
| 0 | ||||||||||||||||||
| 130 | widget->removeEventFilter(this); never executed: widget->removeEventFilter(this); | 0 | ||||||||||||||||||
| 131 | - | |||||||||||||||||||
| 132 | if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget)
| 0 | ||||||||||||||||||
| 133 | QScroller::ungrabGesture(scrollArea->viewport()); never executed: QScroller::ungrabGesture(scrollArea->viewport()); | 0 | ||||||||||||||||||
| 134 | - | |||||||||||||||||||
| 135 | QCommonStyle::unpolish(widget); | - | ||||||||||||||||||
| 136 | } never executed: end of block | 0 | ||||||||||||||||||
| 137 | - | |||||||||||||||||||
| 138 | - | |||||||||||||||||||
| 139 | - | |||||||||||||||||||
| 140 | - | |||||||||||||||||||
| 141 | void QPixmapStyle::drawPrimitive(PrimitiveElement element, const QStyleOption *option, | - | ||||||||||||||||||
| 142 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||
| 143 | { | - | ||||||||||||||||||
| 144 | switch (element) { | - | ||||||||||||||||||
| 145 | case never executed: PE_FrameFocusRect:case PE_FrameFocusRect:never executed: case PE_FrameFocusRect: | 0 | ||||||||||||||||||
| 146 | break; never executed: break; | 0 | ||||||||||||||||||
| 147 | case never executed: PE_PanelButtonBevel:case PE_PanelButtonBevel:never executed: case PE_PanelButtonBevel: | 0 | ||||||||||||||||||
| 148 | case never executed: PE_PanelButtonCommand:case PE_PanelButtonCommand:never executed: case PE_PanelButtonCommand: | 0 | ||||||||||||||||||
| 149 | drawPushButton(option, painter, widget); | - | ||||||||||||||||||
| 150 | break; never executed: break; | 0 | ||||||||||||||||||
| 151 | case never executed: PE_PanelLineEdit:case PE_PanelLineEdit:never executed: case PE_PanelLineEdit: | 0 | ||||||||||||||||||
| 152 | case never executed: PE_FrameLineEdit:case PE_FrameLineEdit:never executed: case PE_FrameLineEdit: | 0 | ||||||||||||||||||
| 153 | drawLineEdit(option, painter, widget); | - | ||||||||||||||||||
| 154 | break; never executed: break; | 0 | ||||||||||||||||||
| 155 | case never executed: PE_Frame:case PE_Frame:never executed: case PE_Frame: | 0 | ||||||||||||||||||
| 156 | case never executed: PE_FrameDefaultButton:case PE_FrameDefaultButton:never executed: case PE_FrameDefaultButton: | 0 | ||||||||||||||||||
| 157 | if (qobject_cast<const QTextEdit*>(widget)
| 0 | ||||||||||||||||||
| 158 | drawTextEdit(option, painter, widget); never executed: drawTextEdit(option, painter, widget); | 0 | ||||||||||||||||||
| 159 | break; never executed: break; | 0 | ||||||||||||||||||
| 160 | case never executed: PE_IndicatorCheckBox:case PE_IndicatorCheckBox:never executed: case PE_IndicatorCheckBox: | 0 | ||||||||||||||||||
| 161 | drawCheckBox(option, painter, widget); | - | ||||||||||||||||||
| 162 | break; never executed: break; | 0 | ||||||||||||||||||
| 163 | case never executed: PE_IndicatorRadioButton:case PE_IndicatorRadioButton:never executed: case PE_IndicatorRadioButton: | 0 | ||||||||||||||||||
| 164 | drawRadioButton(option, painter, widget); | - | ||||||||||||||||||
| 165 | break; never executed: break; | 0 | ||||||||||||||||||
| 166 | case never executed: PE_PanelItemViewItem:case PE_PanelItemViewItem:never executed: case PE_PanelItemViewItem: | 0 | ||||||||||||||||||
| 167 | if (qobject_cast<const QListView*>(widget)
| 0 | ||||||||||||||||||
| 168 | drawPanelItemViewItem(option, painter, widget); never executed: drawPanelItemViewItem(option, painter, widget); | 0 | ||||||||||||||||||
| 169 | else | - | ||||||||||||||||||
| 170 | QCommonStyle::drawPrimitive(element, option, painter, widget); never executed: QCommonStyle::drawPrimitive(element, option, painter, widget); | 0 | ||||||||||||||||||
| 171 | break; never executed: break; | 0 | ||||||||||||||||||
| 172 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 173 | QCommonStyle::drawPrimitive(element, option, painter, widget); | - | ||||||||||||||||||
| 174 | } never executed: end of block | 0 | ||||||||||||||||||
| 175 | } | - | ||||||||||||||||||
| 176 | - | |||||||||||||||||||
| 177 | - | |||||||||||||||||||
| 178 | - | |||||||||||||||||||
| 179 | - | |||||||||||||||||||
| 180 | void QPixmapStyle::drawControl(ControlElement element, const QStyleOption *option, | - | ||||||||||||||||||
| 181 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||
| 182 | { | - | ||||||||||||||||||
| 183 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 184 | - | |||||||||||||||||||
| 185 | switch (element) { | - | ||||||||||||||||||
| 186 | case never executed: CE_ProgressBarGroove:case CE_ProgressBarGroove:never executed: case CE_ProgressBarGroove: | 0 | ||||||||||||||||||
| 187 | drawProgressBarBackground(option, painter, widget); | - | ||||||||||||||||||
| 188 | break; never executed: break; | 0 | ||||||||||||||||||
| 189 | case never executed: CE_ProgressBarLabel:case CE_ProgressBarLabel:never executed: case CE_ProgressBarLabel: | 0 | ||||||||||||||||||
| 190 | drawProgressBarLabel(option, painter, widget); | - | ||||||||||||||||||
| 191 | break; never executed: break; | 0 | ||||||||||||||||||
| 192 | case never executed: CE_ProgressBarContents:case CE_ProgressBarContents:never executed: case CE_ProgressBarContents: | 0 | ||||||||||||||||||
| 193 | drawProgressBarFill(option, painter, widget); | - | ||||||||||||||||||
| 194 | break; never executed: break; | 0 | ||||||||||||||||||
| 195 | case never executed: CE_ShapedFrame:case CE_ShapedFrame:never executed: case CE_ShapedFrame: | 0 | ||||||||||||||||||
| 196 | - | |||||||||||||||||||
| 197 | if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0
| 0 | ||||||||||||||||||
| 198 | const QPixmapStyleDescriptor &desc = d->descriptors.value(DD_PopupDown); | - | ||||||||||||||||||
| 199 | const QPixmapStylePixmap &pix = d->pixmaps.value(DD_ItemSeparator); | - | ||||||||||||||||||
| 200 | QRect rect = option->rect; | - | ||||||||||||||||||
| 201 | rect.adjust(-pix.margins.left(), -desc.margins.top(), | - | ||||||||||||||||||
| 202 | pix.margins.right(), desc.margins.bottom()); | - | ||||||||||||||||||
| 203 | bool up = widget->property("_pixmapstyle_combobox_up").toBool(); | - | ||||||||||||||||||
| 204 | drawCachedPixmap(up ? DD_PopupUp : DD_PopupDown, rect, painter); | - | ||||||||||||||||||
| 205 | } never executed: end of block | 0 | ||||||||||||||||||
| 206 | else { | - | ||||||||||||||||||
| 207 | QCommonStyle::drawControl(element, option, painter, widget); | - | ||||||||||||||||||
| 208 | } never executed: end of block | 0 | ||||||||||||||||||
| 209 | break; never executed: break; | 0 | ||||||||||||||||||
| 210 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 211 | QCommonStyle::drawControl(element, option, painter, widget); | - | ||||||||||||||||||
| 212 | } never executed: end of block | 0 | ||||||||||||||||||
| 213 | } | - | ||||||||||||||||||
| 214 | - | |||||||||||||||||||
| 215 | - | |||||||||||||||||||
| 216 | - | |||||||||||||||||||
| 217 | - | |||||||||||||||||||
| 218 | void QPixmapStyle::drawComplexControl(ComplexControl cc, const QStyleOptionComplex *option, | - | ||||||||||||||||||
| 219 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||
| 220 | { | - | ||||||||||||||||||
| 221 | switch (cc) { | - | ||||||||||||||||||
| 222 | case never executed: CC_Slider:case CC_Slider:never executed: case CC_Slider: | 0 | ||||||||||||||||||
| 223 | drawSlider(option, painter, widget); | - | ||||||||||||||||||
| 224 | break; never executed: break; | 0 | ||||||||||||||||||
| 225 | case never executed: CC_ComboBox:case CC_ComboBox:never executed: case CC_ComboBox: | 0 | ||||||||||||||||||
| 226 | drawComboBox(option, painter, widget); | - | ||||||||||||||||||
| 227 | break; never executed: break; | 0 | ||||||||||||||||||
| 228 | case never executed: CC_ScrollBar:case CC_ScrollBar:never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||
| 229 | drawScrollBar(option, painter, widget); | - | ||||||||||||||||||
| 230 | break; never executed: break; | 0 | ||||||||||||||||||
| 231 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 232 | QCommonStyle::drawComplexControl(cc, option, painter, widget); | - | ||||||||||||||||||
| 233 | } never executed: end of block | 0 | ||||||||||||||||||
| 234 | } | - | ||||||||||||||||||
| 235 | - | |||||||||||||||||||
| 236 | - | |||||||||||||||||||
| 237 | - | |||||||||||||||||||
| 238 | - | |||||||||||||||||||
| 239 | QSize QPixmapStyle::sizeFromContents(ContentsType type, const QStyleOption *option, | - | ||||||||||||||||||
| 240 | const QSize &contentsSize, const QWidget *widget) const | - | ||||||||||||||||||
| 241 | { | - | ||||||||||||||||||
| 242 | switch (type) { | - | ||||||||||||||||||
| 243 | case never executed: CT_PushButton:case CT_PushButton:never executed: case CT_PushButton: | 0 | ||||||||||||||||||
| 244 | return never executed: pushButtonSizeFromContents(option, contentsSize, widget);return pushButtonSizeFromContents(option, contentsSize, widget);never executed: return pushButtonSizeFromContents(option, contentsSize, widget); | 0 | ||||||||||||||||||
| 245 | case never executed: CT_LineEdit:case CT_LineEdit:never executed: case CT_LineEdit: | 0 | ||||||||||||||||||
| 246 | return never executed: lineEditSizeFromContents(option, contentsSize, widget);return lineEditSizeFromContents(option, contentsSize, widget);never executed: return lineEditSizeFromContents(option, contentsSize, widget); | 0 | ||||||||||||||||||
| 247 | case never executed: CT_ProgressBar:case CT_ProgressBar:never executed: case CT_ProgressBar: | 0 | ||||||||||||||||||
| 248 | return never executed: progressBarSizeFromContents(option, contentsSize, widget);return progressBarSizeFromContents(option, contentsSize, widget);never executed: return progressBarSizeFromContents(option, contentsSize, widget); | 0 | ||||||||||||||||||
| 249 | case never executed: CT_Slider:case CT_Slider:never executed: case CT_Slider: | 0 | ||||||||||||||||||
| 250 | return never executed: sliderSizeFromContents(option, contentsSize, widget);return sliderSizeFromContents(option, contentsSize, widget);never executed: return sliderSizeFromContents(option, contentsSize, widget); | 0 | ||||||||||||||||||
| 251 | case never executed: CT_ComboBox:case CT_ComboBox:never executed: case CT_ComboBox: | 0 | ||||||||||||||||||
| 252 | return never executed: comboBoxSizeFromContents(option, contentsSize, widget);return comboBoxSizeFromContents(option, contentsSize, widget);never executed: return comboBoxSizeFromContents(option, contentsSize, widget); | 0 | ||||||||||||||||||
| 253 | case never executed: CT_ItemViewItem:case CT_ItemViewItem:never executed: case CT_ItemViewItem: | 0 | ||||||||||||||||||
| 254 | return never executed: itemViewSizeFromContents(option, contentsSize, widget);return itemViewSizeFromContents(option, contentsSize, widget);never executed: return itemViewSizeFromContents(option, contentsSize, widget); | 0 | ||||||||||||||||||
| 255 | default never executed: :default:never executed: ;default: | 0 | ||||||||||||||||||
| 256 | } never executed: end of block | 0 | ||||||||||||||||||
| 257 | - | |||||||||||||||||||
| 258 | return never executed: QCommonStyle::sizeFromContents(type, option, contentsSize, widget);return QCommonStyle::sizeFromContents(type, option, contentsSize, widget);never executed: return QCommonStyle::sizeFromContents(type, option, contentsSize, widget); | 0 | ||||||||||||||||||
| 259 | } | - | ||||||||||||||||||
| 260 | - | |||||||||||||||||||
| 261 | - | |||||||||||||||||||
| 262 | - | |||||||||||||||||||
| 263 | - | |||||||||||||||||||
| 264 | QRect QPixmapStyle::subElementRect(SubElement element, const QStyleOption *option, | - | ||||||||||||||||||
| 265 | const QWidget *widget) const | - | ||||||||||||||||||
| 266 | { | - | ||||||||||||||||||
| 267 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 268 | - | |||||||||||||||||||
| 269 | switch (element) { | - | ||||||||||||||||||
| 270 | case never executed: SE_LineEditContents:case SE_LineEditContents:never executed: case SE_LineEditContents: | 0 | ||||||||||||||||||
| 271 | { | - | ||||||||||||||||||
| 272 | QRect rect = QCommonStyle::subElementRect(element, option, widget); | - | ||||||||||||||||||
| 273 | const QPixmapStyleDescriptor &desc = d->descriptors.value(LE_Enabled); | - | ||||||||||||||||||
| 274 | rect.adjust(desc.margins.left(), desc.margins.top(), | - | ||||||||||||||||||
| 275 | -desc.margins.right(), -desc.margins.bottom()); | - | ||||||||||||||||||
| 276 | rect = visualRect(option->direction, option->rect, rect); | - | ||||||||||||||||||
| 277 | return never executed: rect;return rect;never executed: return rect; | 0 | ||||||||||||||||||
| 278 | } | - | ||||||||||||||||||
| 279 | default never executed: :default:never executed: ;default: | 0 | ||||||||||||||||||
| 280 | } never executed: end of block | 0 | ||||||||||||||||||
| 281 | - | |||||||||||||||||||
| 282 | return never executed: QCommonStyle::subElementRect(element, option, widget);return QCommonStyle::subElementRect(element, option, widget);never executed: return QCommonStyle::subElementRect(element, option, widget); | 0 | ||||||||||||||||||
| 283 | } | - | ||||||||||||||||||
| 284 | - | |||||||||||||||||||
| 285 | - | |||||||||||||||||||
| 286 | - | |||||||||||||||||||
| 287 | - | |||||||||||||||||||
| 288 | QRect QPixmapStyle::subControlRect(ComplexControl cc, const QStyleOptionComplex *option, | - | ||||||||||||||||||
| 289 | SubControl sc, const QWidget *widget) const | - | ||||||||||||||||||
| 290 | { | - | ||||||||||||||||||
| 291 | switch (cc) { | - | ||||||||||||||||||
| 292 | case never executed: CC_ComboBox:case CC_ComboBox:never executed: case CC_ComboBox: | 0 | ||||||||||||||||||
| 293 | return never executed: comboBoxSubControlRect(option, sc, widget);return comboBoxSubControlRect(option, sc, widget);never executed: return comboBoxSubControlRect(option, sc, widget); | 0 | ||||||||||||||||||
| 294 | case never executed: CC_ScrollBar:case CC_ScrollBar:never executed: case CC_ScrollBar: | 0 | ||||||||||||||||||
| 295 | return never executed: scrollBarSubControlRect(option, sc, widget);return scrollBarSubControlRect(option, sc, widget);never executed: return scrollBarSubControlRect(option, sc, widget); | 0 | ||||||||||||||||||
| 296 | default never executed: :default:never executed: ;default: | 0 | ||||||||||||||||||
| 297 | } never executed: end of block | 0 | ||||||||||||||||||
| 298 | - | |||||||||||||||||||
| 299 | return never executed: QCommonStyle::subControlRect(cc, option, sc, widget);return QCommonStyle::subControlRect(cc, option, sc, widget);never executed: return QCommonStyle::subControlRect(cc, option, sc, widget); | 0 | ||||||||||||||||||
| 300 | } | - | ||||||||||||||||||
| 301 | - | |||||||||||||||||||
| 302 | - | |||||||||||||||||||
| 303 | - | |||||||||||||||||||
| 304 | - | |||||||||||||||||||
| 305 | int QPixmapStyle::pixelMetric(PixelMetric metric, const QStyleOption *option, | - | ||||||||||||||||||
| 306 | const QWidget *widget) const | - | ||||||||||||||||||
| 307 | { | - | ||||||||||||||||||
| 308 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 309 | - | |||||||||||||||||||
| 310 | switch (metric) { | - | ||||||||||||||||||
| 311 | case never executed: PM_ButtonShiftHorizontal:case PM_ButtonShiftHorizontal:never executed: case PM_ButtonShiftHorizontal: | 0 | ||||||||||||||||||
| 312 | case never executed: PM_ButtonShiftVertical:case PM_ButtonShiftVertical:never executed: case PM_ButtonShiftVertical: | 0 | ||||||||||||||||||
| 313 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 314 | case never executed: PM_DefaultFrameWidth:case PM_DefaultFrameWidth:never executed: case PM_DefaultFrameWidth: | 0 | ||||||||||||||||||
| 315 | if (qobject_cast<const QTextEdit*>(widget)
| 0 | ||||||||||||||||||
| 316 | const QPixmapStyleDescriptor &desc = d->descriptors.value(LE_Enabled); | - | ||||||||||||||||||
| 317 | return never executed: qMax(qMax(desc.margins.left(), desc.margins.right()),return qMax(qMax(desc.margins.left(), desc.margins.right()), qMax(desc.margins.top(), desc.margins.bottom()));never executed: return qMax(qMax(desc.margins.left(), desc.margins.right()), qMax(desc.margins.top(), desc.margins.bottom())); | 0 | ||||||||||||||||||
| 318 | qMax(desc.margins.top(), desc.margins.bottom())); never executed: return qMax(qMax(desc.margins.left(), desc.margins.right()), qMax(desc.margins.top(), desc.margins.bottom())); | 0 | ||||||||||||||||||
| 319 | } | - | ||||||||||||||||||
| 320 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 321 | case never executed: PM_IndicatorWidth:case PM_IndicatorWidth:never executed: case PM_IndicatorWidth: | 0 | ||||||||||||||||||
| 322 | return never executed: d->pixmaps.value(CB_Enabled).pixmap.width();return d->pixmaps.value(CB_Enabled).pixmap.width();never executed: return d->pixmaps.value(CB_Enabled).pixmap.width(); | 0 | ||||||||||||||||||
| 323 | case never executed: PM_IndicatorHeight:case PM_IndicatorHeight:never executed: case PM_IndicatorHeight: | 0 | ||||||||||||||||||
| 324 | return never executed: d->pixmaps.value(CB_Enabled).pixmap.height();return d->pixmaps.value(CB_Enabled).pixmap.height();never executed: return d->pixmaps.value(CB_Enabled).pixmap.height(); | 0 | ||||||||||||||||||
| 325 | case never executed: PM_CheckBoxLabelSpacing:case PM_CheckBoxLabelSpacing:never executed: case PM_CheckBoxLabelSpacing: | 0 | ||||||||||||||||||
| 326 | { | - | ||||||||||||||||||
| 327 | const QPixmapStylePixmap &pix = d->pixmaps.value(CB_Enabled); | - | ||||||||||||||||||
| 328 | return never executed: qMax(qMax(pix.margins.left(), pix.margins.right()),return qMax(qMax(pix.margins.left(), pix.margins.right()), qMax(pix.margins.top(), pix.margins.bottom()));never executed: return qMax(qMax(pix.margins.left(), pix.margins.right()), qMax(pix.margins.top(), pix.margins.bottom())); | 0 | ||||||||||||||||||
| 329 | qMax(pix.margins.top(), pix.margins.bottom())); never executed: return qMax(qMax(pix.margins.left(), pix.margins.right()), qMax(pix.margins.top(), pix.margins.bottom())); | 0 | ||||||||||||||||||
| 330 | } | - | ||||||||||||||||||
| 331 | case never executed: PM_ExclusiveIndicatorWidth:case PM_ExclusiveIndicatorWidth:never executed: case PM_ExclusiveIndicatorWidth: | 0 | ||||||||||||||||||
| 332 | return never executed: d->pixmaps.value(RB_Enabled).pixmap.width();return d->pixmaps.value(RB_Enabled).pixmap.width();never executed: return d->pixmaps.value(RB_Enabled).pixmap.width(); | 0 | ||||||||||||||||||
| 333 | case never executed: PM_ExclusiveIndicatorHeight:case PM_ExclusiveIndicatorHeight:never executed: case PM_ExclusiveIndicatorHeight: | 0 | ||||||||||||||||||
| 334 | return never executed: d->pixmaps.value(RB_Enabled).pixmap.height();return d->pixmaps.value(RB_Enabled).pixmap.height();never executed: return d->pixmaps.value(RB_Enabled).pixmap.height(); | 0 | ||||||||||||||||||
| 335 | case never executed: PM_RadioButtonLabelSpacing:case PM_RadioButtonLabelSpacing:never executed: case PM_RadioButtonLabelSpacing: | 0 | ||||||||||||||||||
| 336 | { | - | ||||||||||||||||||
| 337 | const QPixmapStylePixmap &pix = d->pixmaps.value(RB_Enabled); | - | ||||||||||||||||||
| 338 | return never executed: qMax(qMax(pix.margins.left(), pix.margins.right()),return qMax(qMax(pix.margins.left(), pix.margins.right()), qMax(pix.margins.top(), pix.margins.bottom()));never executed: return qMax(qMax(pix.margins.left(), pix.margins.right()), qMax(pix.margins.top(), pix.margins.bottom())); | 0 | ||||||||||||||||||
| 339 | qMax(pix.margins.top(), pix.margins.bottom())); never executed: return qMax(qMax(pix.margins.left(), pix.margins.right()), qMax(pix.margins.top(), pix.margins.bottom())); | 0 | ||||||||||||||||||
| 340 | } | - | ||||||||||||||||||
| 341 | case never executed: PM_SliderThickness:case PM_SliderThickness:never executed: case PM_SliderThickness: | 0 | ||||||||||||||||||
| 342 | if (const
| 0 | ||||||||||||||||||
| 343 | qstyleoption_cast<const QStyleOptionSlider*>(option)
| 0 | ||||||||||||||||||
| 344 | const QPixmapStyleDescriptor desc = | - | ||||||||||||||||||
| 345 | d->descriptors.value(slider->orientation == Qt::Horizontal | - | ||||||||||||||||||
| 346 | ? SG_HEnabled : SG_VEnabled); | - | ||||||||||||||||||
| 347 | return never executed: slider->orientation == Qt::Horizontalreturn slider->orientation == Qt::Horizontal ? desc.size.height() : desc.size.width();never executed: return slider->orientation == Qt::Horizontal ? desc.size.height() : desc.size.width(); | 0 | ||||||||||||||||||
| 348 | ? desc.size.height() : desc.size.width(); never executed: return slider->orientation == Qt::Horizontal ? desc.size.height() : desc.size.width(); | 0 | ||||||||||||||||||
| 349 | } | - | ||||||||||||||||||
| 350 | break; never executed: break; | 0 | ||||||||||||||||||
| 351 | case never executed: PM_SliderControlThickness:case PM_SliderControlThickness:never executed: case PM_SliderControlThickness: | 0 | ||||||||||||||||||
| 352 | if (const
| 0 | ||||||||||||||||||
| 353 | qstyleoption_cast<const QStyleOptionSlider*>(option)
| 0 | ||||||||||||||||||
| 354 | const QPixmapStylePixmap pix = | - | ||||||||||||||||||
| 355 | d->pixmaps.value(slider->orientation == Qt::Horizontal | - | ||||||||||||||||||
| 356 | ? SH_HEnabled : SH_VEnabled); | - | ||||||||||||||||||
| 357 | return never executed: slider->orientation == Qt::Horizontalreturn slider->orientation == Qt::Horizontal ? pix.pixmap.height() : pix.pixmap.width();never executed: return slider->orientation == Qt::Horizontal ? pix.pixmap.height() : pix.pixmap.width(); | 0 | ||||||||||||||||||
| 358 | ? pix.pixmap.height() : pix.pixmap.width(); never executed: return slider->orientation == Qt::Horizontal ? pix.pixmap.height() : pix.pixmap.width(); | 0 | ||||||||||||||||||
| 359 | } | - | ||||||||||||||||||
| 360 | break; never executed: break; | 0 | ||||||||||||||||||
| 361 | case never executed: PM_SliderLength:case PM_SliderLength:never executed: case PM_SliderLength: | 0 | ||||||||||||||||||
| 362 | if (const
| 0 | ||||||||||||||||||
| 363 | qstyleoption_cast<const QStyleOptionSlider*>(option)
| 0 | ||||||||||||||||||
| 364 | const QPixmapStylePixmap pix = | - | ||||||||||||||||||
| 365 | d->pixmaps.value(slider->orientation == Qt::Horizontal | - | ||||||||||||||||||
| 366 | ? SH_HEnabled : SH_VEnabled); | - | ||||||||||||||||||
| 367 | return never executed: slider->orientation == Qt::Horizontalreturn slider->orientation == Qt::Horizontal ? pix.pixmap.width() : pix.pixmap.height();never executed: return slider->orientation == Qt::Horizontal ? pix.pixmap.width() : pix.pixmap.height(); | 0 | ||||||||||||||||||
| 368 | ? pix.pixmap.width() : pix.pixmap.height(); never executed: return slider->orientation == Qt::Horizontal ? pix.pixmap.width() : pix.pixmap.height(); | 0 | ||||||||||||||||||
| 369 | } | - | ||||||||||||||||||
| 370 | break; never executed: break; | 0 | ||||||||||||||||||
| 371 | case never executed: PM_ScrollBarExtent:case PM_ScrollBarExtent:never executed: case PM_ScrollBarExtent: | 0 | ||||||||||||||||||
| 372 | if (const
| 0 | ||||||||||||||||||
| 373 | qstyleoption_cast<const QStyleOptionSlider*>(option)
| 0 | ||||||||||||||||||
| 374 | const QPixmapStyleDescriptor desc = | - | ||||||||||||||||||
| 375 | d->descriptors.value(slider->orientation == Qt::Horizontal | - | ||||||||||||||||||
| 376 | ? SB_Horizontal : SB_Vertical); | - | ||||||||||||||||||
| 377 | return never executed: slider->orientation == Qt::Horizontalreturn slider->orientation == Qt::Horizontal ? desc.size.height() : desc.size.width();never executed: return slider->orientation == Qt::Horizontal ? desc.size.height() : desc.size.width(); | 0 | ||||||||||||||||||
| 378 | ? desc.size.height() : desc.size.width(); never executed: return slider->orientation == Qt::Horizontal ? desc.size.height() : desc.size.width(); | 0 | ||||||||||||||||||
| 379 | } | - | ||||||||||||||||||
| 380 | break; never executed: break; | 0 | ||||||||||||||||||
| 381 | case never executed: PM_ScrollBarSliderMin:case PM_ScrollBarSliderMin:never executed: case PM_ScrollBarSliderMin: | 0 | ||||||||||||||||||
| 382 | return never executed: 0;return 0;never executed: return 0; | 0 | ||||||||||||||||||
| 383 | default never executed: :default:never executed: ;default: | 0 | ||||||||||||||||||
| 384 | } never executed: end of block | 0 | ||||||||||||||||||
| 385 | - | |||||||||||||||||||
| 386 | return never executed: QCommonStyle::pixelMetric(metric, option, widget);return QCommonStyle::pixelMetric(metric, option, widget);never executed: return QCommonStyle::pixelMetric(metric, option, widget); | 0 | ||||||||||||||||||
| 387 | } | - | ||||||||||||||||||
| 388 | - | |||||||||||||||||||
| 389 | - | |||||||||||||||||||
| 390 | - | |||||||||||||||||||
| 391 | - | |||||||||||||||||||
| 392 | int QPixmapStyle::styleHint(StyleHint hint, const QStyleOption *option, | - | ||||||||||||||||||
| 393 | const QWidget *widget, QStyleHintReturn *returnData) const | - | ||||||||||||||||||
| 394 | { | - | ||||||||||||||||||
| 395 | switch (hint) { | - | ||||||||||||||||||
| 396 | case never executed: SH_EtchDisabledText:case SH_EtchDisabledText:never executed: case SH_EtchDisabledText: | 0 | ||||||||||||||||||
| 397 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 398 | case never executed: SH_ComboBox_Popup:case SH_ComboBox_Popup:never executed: case SH_ComboBox_Popup: | 0 | ||||||||||||||||||
| 399 | return never executed: false;return false;never executed: return false; | 0 | ||||||||||||||||||
| 400 | default never executed: :default:never executed: ;default: | 0 | ||||||||||||||||||
| 401 | } never executed: end of block | 0 | ||||||||||||||||||
| 402 | - | |||||||||||||||||||
| 403 | return never executed: QCommonStyle::styleHint(hint, option, widget, returnData);return QCommonStyle::styleHint(hint, option, widget, returnData);never executed: return QCommonStyle::styleHint(hint, option, widget, returnData); | 0 | ||||||||||||||||||
| 404 | } | - | ||||||||||||||||||
| 405 | - | |||||||||||||||||||
| 406 | - | |||||||||||||||||||
| 407 | - | |||||||||||||||||||
| 408 | - | |||||||||||||||||||
| 409 | QStyle::SubControl QPixmapStyle::hitTestComplexControl(QStyle::ComplexControl control, | - | ||||||||||||||||||
| 410 | const QStyleOptionComplex *option, | - | ||||||||||||||||||
| 411 | const QPoint &pos, | - | ||||||||||||||||||
| 412 | const QWidget *widget) const | - | ||||||||||||||||||
| 413 | { | - | ||||||||||||||||||
| 414 | const SubControl sc = QCommonStyle::hitTestComplexControl(control, option, pos, widget); | - | ||||||||||||||||||
| 415 | if (control == CC_ScrollBar
| 0 | ||||||||||||||||||
| 416 | if (sc == SC_ScrollBarAddLine
| 0 | ||||||||||||||||||
| 417 | return never executed: SC_ScrollBarAddPage;return SC_ScrollBarAddPage;never executed: return SC_ScrollBarAddPage; | 0 | ||||||||||||||||||
| 418 | else if (sc == SC_ScrollBarSubLine
| 0 | ||||||||||||||||||
| 419 | return never executed: SC_ScrollBarSubPage;return SC_ScrollBarSubPage;never executed: return SC_ScrollBarSubPage; | 0 | ||||||||||||||||||
| 420 | } never executed: end of block | 0 | ||||||||||||||||||
| 421 | - | |||||||||||||||||||
| 422 | return never executed: sc;return sc;never executed: return sc; | 0 | ||||||||||||||||||
| 423 | } | - | ||||||||||||||||||
| 424 | - | |||||||||||||||||||
| 425 | - | |||||||||||||||||||
| 426 | - | |||||||||||||||||||
| 427 | - | |||||||||||||||||||
| 428 | bool QPixmapStyle::eventFilter(QObject *watched, QEvent *event) | - | ||||||||||||||||||
| 429 | { | - | ||||||||||||||||||
| 430 | QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 431 | - | |||||||||||||||||||
| 432 | if (QSlider *slider = qobject_cast<QSlider*>(watched)
| 0 | ||||||||||||||||||
| 433 | switch (event->type()) { | - | ||||||||||||||||||
| 434 | case never executed: QEvent::MouseButtonPress:case QEvent::MouseButtonPress:never executed: case QEvent::MouseButtonPress: | 0 | ||||||||||||||||||
| 435 | case never executed: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease:never executed: case QEvent::MouseButtonRelease: | 0 | ||||||||||||||||||
| 436 | case never executed: QEvent::MouseMove:case QEvent::MouseMove:never executed: case QEvent::MouseMove: | 0 | ||||||||||||||||||
| 437 | slider->update(); | - | ||||||||||||||||||
| 438 | break; never executed: break; | 0 | ||||||||||||||||||
| 439 | default never executed: :default:never executed: ;default: | 0 | ||||||||||||||||||
| 440 | } never executed: end of block | 0 | ||||||||||||||||||
| 441 | } | - | ||||||||||||||||||
| 442 | - | |||||||||||||||||||
| 443 | if (QComboBox *comboBox = qobject_cast<QComboBox*>(watched)
| 0 | ||||||||||||||||||
| 444 | switch (event->type()) { | - | ||||||||||||||||||
| 445 | case never executed: QEvent::MouseButtonPress:case QEvent::MouseButtonPress:never executed: case QEvent::MouseButtonPress: | 0 | ||||||||||||||||||
| 446 | event->ignore(); | - | ||||||||||||||||||
| 447 | comboBox->setProperty("_pixmapstyle_combobox_pressed", true); | - | ||||||||||||||||||
| 448 | comboBox->repaint(); | - | ||||||||||||||||||
| 449 | return never executed: true;return true;never executed: return true; | 0 | ||||||||||||||||||
| 450 | case never executed: QEvent::MouseButtonRelease:case QEvent::MouseButtonRelease:never executed: case QEvent::MouseButtonRelease: | 0 | ||||||||||||||||||
| 451 | comboBox->setProperty("_pixmapstyle_combobox_pressed", false); | - | ||||||||||||||||||
| 452 | comboBox->repaint(); | - | ||||||||||||||||||
| 453 | if ( comboBox->view()
| 0 | ||||||||||||||||||
| 454 | if ( comboBox->view()->isVisible()
| 0 | ||||||||||||||||||
| 455 | comboBox->hidePopup(); never executed: comboBox->hidePopup(); | 0 | ||||||||||||||||||
| 456 | else | - | ||||||||||||||||||
| 457 | comboBox->showPopup(); never executed: comboBox->showPopup(); | 0 | ||||||||||||||||||
| 458 | } | - | ||||||||||||||||||
| 459 | break; never executed: break; | 0 | ||||||||||||||||||
| 460 | default never executed: :default:never executed: ;default: | 0 | ||||||||||||||||||
| 461 | } never executed: end of block | 0 | ||||||||||||||||||
| 462 | } | - | ||||||||||||||||||
| 463 | - | |||||||||||||||||||
| 464 | if (qstrcmp(watched->metaObject()->className(),"QComboBoxPrivateContainer") == 0
| 0 | ||||||||||||||||||
| 465 | if (event->type() == QEvent::Show
| 0 | ||||||||||||||||||
| 466 | QWidget *widget = qobject_cast<QWidget*>(watched); | - | ||||||||||||||||||
| 467 | int yPopup = widget->geometry().top(); | - | ||||||||||||||||||
| 468 | int yCombo = widget->parentWidget()->mapToGlobal(QPoint(0, 0)).y(); | - | ||||||||||||||||||
| 469 | QRect geom = widget->geometry(); | - | ||||||||||||||||||
| 470 | const QPixmapStyleDescriptor &desc = d->descriptors.value(DD_ButtonEnabled); | - | ||||||||||||||||||
| 471 | const bool up = yPopup < yCombo; | - | ||||||||||||||||||
| 472 | geom.moveTop(geom.top() + (up ? desc.margins.top() : -desc.margins.bottom())); | - | ||||||||||||||||||
| 473 | widget->setGeometry(geom); | - | ||||||||||||||||||
| 474 | widget->setProperty("_pixmapstyle_combobox_up", up); | - | ||||||||||||||||||
| 475 | widget->parentWidget()->setProperty("_pixmapstyle_combobox_up", up); | - | ||||||||||||||||||
| 476 | } never executed: end of block | 0 | ||||||||||||||||||
| 477 | } never executed: end of block | 0 | ||||||||||||||||||
| 478 | - | |||||||||||||||||||
| 479 | return never executed: QCommonStyle::eventFilter(watched, event);return QCommonStyle::eventFilter(watched, event);never executed: return QCommonStyle::eventFilter(watched, event); | 0 | ||||||||||||||||||
| 480 | } | - | ||||||||||||||||||
| 481 | void QPixmapStyle::addDescriptor(QPixmapStyle::ControlDescriptor control, const QString &fileName, | - | ||||||||||||||||||
| 482 | QMargins margins, QTileRules tileRules) | - | ||||||||||||||||||
| 483 | { | - | ||||||||||||||||||
| 484 | QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 485 | - | |||||||||||||||||||
| 486 | QPixmapStyleDescriptor desc; | - | ||||||||||||||||||
| 487 | QImage image(fileName); | - | ||||||||||||||||||
| 488 | - | |||||||||||||||||||
| 489 | if (image.isNull()
| 0 | ||||||||||||||||||
| 490 | return; never executed: return; | 0 | ||||||||||||||||||
| 491 | - | |||||||||||||||||||
| 492 | desc.fileName = fileName; | - | ||||||||||||||||||
| 493 | desc.margins = margins; | - | ||||||||||||||||||
| 494 | desc.tileRules = tileRules; | - | ||||||||||||||||||
| 495 | desc.size = image.size(); | - | ||||||||||||||||||
| 496 | - | |||||||||||||||||||
| 497 | d->descriptors[control] = desc; | - | ||||||||||||||||||
| 498 | } never executed: end of block | 0 | ||||||||||||||||||
| 499 | void QPixmapStyle::copyDescriptor(QPixmapStyle::ControlDescriptor source, | - | ||||||||||||||||||
| 500 | QPixmapStyle::ControlDescriptor dest) | - | ||||||||||||||||||
| 501 | { | - | ||||||||||||||||||
| 502 | QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 503 | d->descriptors[dest] = d->descriptors.value(source); | - | ||||||||||||||||||
| 504 | } never executed: end of block | 0 | ||||||||||||||||||
| 505 | - | |||||||||||||||||||
| 506 | - | |||||||||||||||||||
| 507 | - | |||||||||||||||||||
| 508 | - | |||||||||||||||||||
| 509 | - | |||||||||||||||||||
| 510 | - | |||||||||||||||||||
| 511 | void QPixmapStyle::drawCachedPixmap(QPixmapStyle::ControlDescriptor control, const QRect &rect, | - | ||||||||||||||||||
| 512 | QPainter *p) const | - | ||||||||||||||||||
| 513 | { | - | ||||||||||||||||||
| 514 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 515 | if (!d->descriptors.contains(control)
| 0 | ||||||||||||||||||
| 516 | return; never executed: return; | 0 | ||||||||||||||||||
| 517 | const QPixmapStyleDescriptor &desc = d->descriptors.value(control); | - | ||||||||||||||||||
| 518 | const QPixmap pix = d->getCachedPixmap(control, desc, rect.size()); | - | ||||||||||||||||||
| 519 | ((!(!pix.isNull())) ? qt_assert("!pix.isNull()",__FILE__,631) : qt_noop()); | - | ||||||||||||||||||
| 520 | p->drawPixmap(rect, pix); | - | ||||||||||||||||||
| 521 | } never executed: end of block | 0 | ||||||||||||||||||
| 522 | void QPixmapStyle::addPixmap(ControlPixmap control, const QString &fileName, | - | ||||||||||||||||||
| 523 | QMargins margins) | - | ||||||||||||||||||
| 524 | { | - | ||||||||||||||||||
| 525 | QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 526 | - | |||||||||||||||||||
| 527 | QPixmapStylePixmap pix; | - | ||||||||||||||||||
| 528 | QPixmap image(fileName); | - | ||||||||||||||||||
| 529 | - | |||||||||||||||||||
| 530 | if (image.isNull()
| 0 | ||||||||||||||||||
| 531 | return; never executed: return; | 0 | ||||||||||||||||||
| 532 | - | |||||||||||||||||||
| 533 | pix.pixmap = image; | - | ||||||||||||||||||
| 534 | pix.margins = margins; | - | ||||||||||||||||||
| 535 | - | |||||||||||||||||||
| 536 | d->pixmaps[control] = pix; | - | ||||||||||||||||||
| 537 | } never executed: end of block | 0 | ||||||||||||||||||
| 538 | void QPixmapStyle::copyPixmap(QPixmapStyle::ControlPixmap source, QPixmapStyle::ControlPixmap dest) | - | ||||||||||||||||||
| 539 | { | - | ||||||||||||||||||
| 540 | QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 541 | d->pixmaps[dest] = d->pixmaps.value(source); | - | ||||||||||||||||||
| 542 | } never executed: end of block | 0 | ||||||||||||||||||
| 543 | - | |||||||||||||||||||
| 544 | - | |||||||||||||||||||
| 545 | - | |||||||||||||||||||
| 546 | - | |||||||||||||||||||
| 547 | - | |||||||||||||||||||
| 548 | - | |||||||||||||||||||
| 549 | QPixmapStyle::QPixmapStyle(QPixmapStylePrivate &dd) | - | ||||||||||||||||||
| 550 | : QCommonStyle(dd) | - | ||||||||||||||||||
| 551 | {} never executed: end of block | 0 | ||||||||||||||||||
| 552 | - | |||||||||||||||||||
| 553 | void QPixmapStyle::drawPushButton(const QStyleOption *option, | - | ||||||||||||||||||
| 554 | QPainter *painter, const QWidget *) const | - | ||||||||||||||||||
| 555 | { | - | ||||||||||||||||||
| 556 | const bool checked = option->state & State_On; | - | ||||||||||||||||||
| 557 | const bool pressed = option->state & State_Sunken; | - | ||||||||||||||||||
| 558 | const bool enabled = option->state & State_Enabled; | - | ||||||||||||||||||
| 559 | - | |||||||||||||||||||
| 560 | ControlDescriptor control = PB_Enabled; | - | ||||||||||||||||||
| 561 | if (enabled
| 0 | ||||||||||||||||||
| 562 | control = pressed
never executed: control = pressed ? PB_Pressed : (checked ? PB_Checked : PB_Enabled); | 0 | ||||||||||||||||||
| 563 | else | - | ||||||||||||||||||
| 564 | control = checked
never executed: control = checked ? PB_PressedDisabled : PB_Disabled; | 0 | ||||||||||||||||||
| 565 | drawCachedPixmap(control, option->rect, painter); | - | ||||||||||||||||||
| 566 | } never executed: end of block | 0 | ||||||||||||||||||
| 567 | - | |||||||||||||||||||
| 568 | void QPixmapStyle::drawLineEdit(const QStyleOption *option, | - | ||||||||||||||||||
| 569 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||
| 570 | { | - | ||||||||||||||||||
| 571 | - | |||||||||||||||||||
| 572 | if (widget
| 0 | ||||||||||||||||||
| 573 | return; never executed: return; | 0 | ||||||||||||||||||
| 574 | - | |||||||||||||||||||
| 575 | const bool enabled = option->state & State_Enabled; | - | ||||||||||||||||||
| 576 | const bool focused = option->state & State_HasFocus; | - | ||||||||||||||||||
| 577 | ControlDescriptor control = enabled
| 0 | ||||||||||||||||||
| 578 | drawCachedPixmap(control, option->rect, painter); | - | ||||||||||||||||||
| 579 | } never executed: end of block | 0 | ||||||||||||||||||
| 580 | - | |||||||||||||||||||
| 581 | void QPixmapStyle::drawTextEdit(const QStyleOption *option, | - | ||||||||||||||||||
| 582 | QPainter *painter, const QWidget *) const | - | ||||||||||||||||||
| 583 | { | - | ||||||||||||||||||
| 584 | const bool enabled = option->state & State_Enabled; | - | ||||||||||||||||||
| 585 | const bool focused = option->state & State_HasFocus; | - | ||||||||||||||||||
| 586 | ControlDescriptor control = enabled
| 0 | ||||||||||||||||||
| 587 | drawCachedPixmap(control, option->rect, painter); | - | ||||||||||||||||||
| 588 | } never executed: end of block | 0 | ||||||||||||||||||
| 589 | - | |||||||||||||||||||
| 590 | void QPixmapStyle::drawCheckBox(const QStyleOption *option, | - | ||||||||||||||||||
| 591 | QPainter *painter, const QWidget *) const | - | ||||||||||||||||||
| 592 | { | - | ||||||||||||||||||
| 593 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 594 | - | |||||||||||||||||||
| 595 | const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option); | - | ||||||||||||||||||
| 596 | - | |||||||||||||||||||
| 597 | const bool down = button->state & State_Sunken; | - | ||||||||||||||||||
| 598 | const bool enabled = button->state & State_Enabled; | - | ||||||||||||||||||
| 599 | const bool on = button->state & State_On; | - | ||||||||||||||||||
| 600 | - | |||||||||||||||||||
| 601 | ControlPixmap control; | - | ||||||||||||||||||
| 602 | if (enabled
| 0 | ||||||||||||||||||
| 603 | control = on
never executed: control = on ? (down ? CB_PressedChecked : CB_Checked) : (down ? CB_Pressed : CB_Enabled); | 0 | ||||||||||||||||||
| 604 | else | - | ||||||||||||||||||
| 605 | control = on
never executed: control = on ? CB_DisabledChecked : CB_Disabled; | 0 | ||||||||||||||||||
| 606 | painter->drawPixmap(button->rect, d->pixmaps.value(control).pixmap); | - | ||||||||||||||||||
| 607 | } never executed: end of block | 0 | ||||||||||||||||||
| 608 | - | |||||||||||||||||||
| 609 | void QPixmapStyle::drawRadioButton(const QStyleOption *option, | - | ||||||||||||||||||
| 610 | QPainter *painter, const QWidget *) const | - | ||||||||||||||||||
| 611 | { | - | ||||||||||||||||||
| 612 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 613 | - | |||||||||||||||||||
| 614 | const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option); | - | ||||||||||||||||||
| 615 | - | |||||||||||||||||||
| 616 | const bool down = button->state & State_Sunken; | - | ||||||||||||||||||
| 617 | const bool enabled = button->state & State_Enabled; | - | ||||||||||||||||||
| 618 | const bool on = button->state & State_On; | - | ||||||||||||||||||
| 619 | - | |||||||||||||||||||
| 620 | ControlPixmap control; | - | ||||||||||||||||||
| 621 | if (enabled
| 0 | ||||||||||||||||||
| 622 | control = on
never executed: control = on ? RB_Checked : (down ? RB_Pressed : RB_Enabled); | 0 | ||||||||||||||||||
| 623 | else | - | ||||||||||||||||||
| 624 | control = on
never executed: control = on ? RB_DisabledChecked : RB_Disabled; | 0 | ||||||||||||||||||
| 625 | painter->drawPixmap(button->rect, d->pixmaps.value(control).pixmap); | - | ||||||||||||||||||
| 626 | } never executed: end of block | 0 | ||||||||||||||||||
| 627 | - | |||||||||||||||||||
| 628 | void QPixmapStyle::drawPanelItemViewItem(const QStyleOption *option, QPainter *painter, | - | ||||||||||||||||||
| 629 | const QWidget *widget) const | - | ||||||||||||||||||
| 630 | { | - | ||||||||||||||||||
| 631 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 632 | - | |||||||||||||||||||
| 633 | ControlPixmap cp = ID_Separator; | - | ||||||||||||||||||
| 634 | ControlDescriptor cd = ID_Selected; | - | ||||||||||||||||||
| 635 | - | |||||||||||||||||||
| 636 | if (widget
| 0 | ||||||||||||||||||
| 637 | cp = DD_ItemSeparator; | - | ||||||||||||||||||
| 638 | cd = DD_ItemSelected; | - | ||||||||||||||||||
| 639 | } never executed: end of block | 0 | ||||||||||||||||||
| 640 | - | |||||||||||||||||||
| 641 | QPixmap pix = d->pixmaps.value(cp).pixmap; | - | ||||||||||||||||||
| 642 | QRect rect = option->rect; | - | ||||||||||||||||||
| 643 | rect.setBottom(rect.top() + pix.height()-1); | - | ||||||||||||||||||
| 644 | painter->drawPixmap(rect, pix); | - | ||||||||||||||||||
| 645 | if (option->state & QStyle::State_Selected
| 0 | ||||||||||||||||||
| 646 | rect = option->rect; | - | ||||||||||||||||||
| 647 | rect.setTop(rect.top() + pix.height()); | - | ||||||||||||||||||
| 648 | drawCachedPixmap(cd, rect, painter); | - | ||||||||||||||||||
| 649 | } never executed: end of block | 0 | ||||||||||||||||||
| 650 | } never executed: end of block | 0 | ||||||||||||||||||
| 651 | - | |||||||||||||||||||
| 652 | void QPixmapStyle::drawProgressBarBackground(const QStyleOption *option, | - | ||||||||||||||||||
| 653 | QPainter *painter, const QWidget *) const | - | ||||||||||||||||||
| 654 | { | - | ||||||||||||||||||
| 655 | bool vertical = false; | - | ||||||||||||||||||
| 656 | if (const
| 0 | ||||||||||||||||||
| 657 | qstyleoption_cast<const QStyleOptionProgressBar *>(option)
| 0 | ||||||||||||||||||
| 658 | vertical = pb->orientation == Qt::Vertical; | - | ||||||||||||||||||
| 659 | } never executed: end of block | 0 | ||||||||||||||||||
| 660 | drawCachedPixmap(vertical ? PB_VBackground : PB_HBackground, option->rect, painter); | - | ||||||||||||||||||
| 661 | } never executed: end of block | 0 | ||||||||||||||||||
| 662 | - | |||||||||||||||||||
| 663 | void QPixmapStyle::drawProgressBarLabel(const QStyleOption *option, | - | ||||||||||||||||||
| 664 | QPainter *painter, const QWidget *) const | - | ||||||||||||||||||
| 665 | { | - | ||||||||||||||||||
| 666 | if (const
| 0 | ||||||||||||||||||
| 667 | qstyleoption_cast<const QStyleOptionProgressBar *>(option)
| 0 | ||||||||||||||||||
| 668 | const bool vertical = pb->orientation == Qt::Vertical; | - | ||||||||||||||||||
| 669 | if (!vertical
| 0 | ||||||||||||||||||
| 670 | QPalette::ColorRole textRole = QPalette::ButtonText; | - | ||||||||||||||||||
| 671 | proxy()->drawItemText(painter, pb->rect, | - | ||||||||||||||||||
| 672 | Qt::AlignCenter | Qt::TextSingleLine, pb->palette, | - | ||||||||||||||||||
| 673 | pb->state & State_Enabled, pb->text, textRole); | - | ||||||||||||||||||
| 674 | } never executed: end of block | 0 | ||||||||||||||||||
| 675 | } never executed: end of block | 0 | ||||||||||||||||||
| 676 | } never executed: end of block | 0 | ||||||||||||||||||
| 677 | - | |||||||||||||||||||
| 678 | void QPixmapStyle::drawProgressBarFill(const QStyleOption *option, | - | ||||||||||||||||||
| 679 | QPainter *painter, const QWidget *) const | - | ||||||||||||||||||
| 680 | { | - | ||||||||||||||||||
| 681 | const QStyleOptionProgressBar *pbar = | - | ||||||||||||||||||
| 682 | qstyleoption_cast<const QStyleOptionProgressBar*>(option); | - | ||||||||||||||||||
| 683 | const bool vertical = pbar->orientation == Qt::Vertical; | - | ||||||||||||||||||
| 684 | const bool flip = (pbar->direction == Qt::RightToLeft) ^ pbar->invertedAppearance; | - | ||||||||||||||||||
| 685 | - | |||||||||||||||||||
| 686 | if (pbar->progress == pbar->maximum
| 0 | ||||||||||||||||||
| 687 | drawCachedPixmap(vertical ? PB_VComplete : PB_HComplete, option->rect, painter); | - | ||||||||||||||||||
| 688 | - | |||||||||||||||||||
| 689 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 690 | if (pbar->progress == 0
| 0 | ||||||||||||||||||
| 691 | return; never executed: return; | 0 | ||||||||||||||||||
| 692 | const int maximum = pbar->maximum; | - | ||||||||||||||||||
| 693 | const qreal ratio = qreal(vertical?option->rect.height():option->rect.width())/maximum; | - | ||||||||||||||||||
| 694 | const int progress = pbar->progress*ratio; | - | ||||||||||||||||||
| 695 | - | |||||||||||||||||||
| 696 | QRect optRect = option->rect; | - | ||||||||||||||||||
| 697 | if (vertical
| 0 | ||||||||||||||||||
| 698 | if (flip
| 0 | ||||||||||||||||||
| 699 | optRect.setBottom(optRect.top()+progress-1); never executed: optRect.setBottom(optRect.top()+progress-1); | 0 | ||||||||||||||||||
| 700 | else | - | ||||||||||||||||||
| 701 | optRect.setTop(optRect.bottom()-progress+1); never executed: optRect.setTop(optRect.bottom()-progress+1); | 0 | ||||||||||||||||||
| 702 | } else { | - | ||||||||||||||||||
| 703 | if (flip
| 0 | ||||||||||||||||||
| 704 | optRect.setLeft(optRect.right()-progress+1); never executed: optRect.setLeft(optRect.right()-progress+1); | 0 | ||||||||||||||||||
| 705 | else | - | ||||||||||||||||||
| 706 | optRect.setRight(optRect.left()+progress-1); never executed: optRect.setRight(optRect.left()+progress-1); | 0 | ||||||||||||||||||
| 707 | } | - | ||||||||||||||||||
| 708 | - | |||||||||||||||||||
| 709 | drawCachedPixmap(vertical ? PB_VContent : PB_HContent, optRect, painter); | - | ||||||||||||||||||
| 710 | } never executed: end of block | 0 | ||||||||||||||||||
| 711 | } | - | ||||||||||||||||||
| 712 | - | |||||||||||||||||||
| 713 | void QPixmapStyle::drawSlider(const QStyleOptionComplex *option, | - | ||||||||||||||||||
| 714 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||
| 715 | { | - | ||||||||||||||||||
| 716 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 717 | - | |||||||||||||||||||
| 718 | const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option); | - | ||||||||||||||||||
| 719 | if (!slider
| 0 | ||||||||||||||||||
| 720 | return; never executed: return; | 0 | ||||||||||||||||||
| 721 | - | |||||||||||||||||||
| 722 | const bool enabled = option->state & State_Enabled; | - | ||||||||||||||||||
| 723 | const bool pressed = option->state & State_Sunken; | - | ||||||||||||||||||
| 724 | const Qt::Orientation orient = slider->orientation; | - | ||||||||||||||||||
| 725 | - | |||||||||||||||||||
| 726 | const QRect handle = proxy()->subControlRect(CC_Slider, option, SC_SliderHandle, widget); | - | ||||||||||||||||||
| 727 | if (option->subControls & SC_SliderGroove
| 0 | ||||||||||||||||||
| 728 | QRect groove = proxy()->subControlRect(CC_Slider, option, SC_SliderGroove, widget); | - | ||||||||||||||||||
| 729 | if (groove.isValid()
| 0 | ||||||||||||||||||
| 730 | - | |||||||||||||||||||
| 731 | ControlDescriptor control; | - | ||||||||||||||||||
| 732 | if (orient == Qt::Horizontal
| 0 | ||||||||||||||||||
| 733 | control = enabled
never executed: control = enabled ? SG_HEnabled : SG_HDisabled; | 0 | ||||||||||||||||||
| 734 | else | - | ||||||||||||||||||
| 735 | control = enabled
never executed: control = enabled ? SG_VEnabled : SG_VDisabled; | 0 | ||||||||||||||||||
| 736 | drawCachedPixmap(control, groove, painter); | - | ||||||||||||||||||
| 737 | - | |||||||||||||||||||
| 738 | - | |||||||||||||||||||
| 739 | if (orient == Qt::Horizontal
| 0 | ||||||||||||||||||
| 740 | control = enabled
| 0 | ||||||||||||||||||
| 741 | : SG_HActiveDisabled; | - | ||||||||||||||||||
| 742 | } never executed: else {end of block | 0 | ||||||||||||||||||
| 743 | control = enabled
| 0 | ||||||||||||||||||
| 744 | : SG_VActiveDisabled; | - | ||||||||||||||||||
| 745 | } never executed: end of block | 0 | ||||||||||||||||||
| 746 | const QPixmapStyleDescriptor &desc = d->descriptors.value(control); | - | ||||||||||||||||||
| 747 | const QPixmap pix = d->getCachedPixmap(control, desc, groove.size()); | - | ||||||||||||||||||
| 748 | if (!pix.isNull()
| 0 | ||||||||||||||||||
| 749 | groove.setRight(orient == Qt::Horizontal | - | ||||||||||||||||||
| 750 | ? handle.center().x() : handle.center().y()); | - | ||||||||||||||||||
| 751 | painter->drawPixmap(groove, pix, groove); | - | ||||||||||||||||||
| 752 | } never executed: end of block | 0 | ||||||||||||||||||
| 753 | } never executed: end of block | 0 | ||||||||||||||||||
| 754 | } never executed: end of block | 0 | ||||||||||||||||||
| 755 | if (option->subControls & SC_SliderHandle
| 0 | ||||||||||||||||||
| 756 | if (handle.isValid()
| 0 | ||||||||||||||||||
| 757 | ControlPixmap pix; | - | ||||||||||||||||||
| 758 | if (orient == Qt::Horizontal
| 0 | ||||||||||||||||||
| 759 | pix = enabled
never executed: pix = enabled ? (pressed ? SH_HPressed : SH_HEnabled) : SH_HDisabled; | 0 | ||||||||||||||||||
| 760 | else | - | ||||||||||||||||||
| 761 | pix = enabled
never executed: pix = enabled ? (pressed ? SH_VPressed : SH_VEnabled) : SH_VDisabled; | 0 | ||||||||||||||||||
| 762 | painter->drawPixmap(handle, d->pixmaps.value(pix).pixmap); | - | ||||||||||||||||||
| 763 | } never executed: end of block | 0 | ||||||||||||||||||
| 764 | } never executed: end of block | 0 | ||||||||||||||||||
| 765 | } never executed: end of block | 0 | ||||||||||||||||||
| 766 | - | |||||||||||||||||||
| 767 | void QPixmapStyle::drawComboBox(const QStyleOptionComplex *option, | - | ||||||||||||||||||
| 768 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||
| 769 | { | - | ||||||||||||||||||
| 770 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 771 | - | |||||||||||||||||||
| 772 | const bool enabled = option->state & State_Enabled; | - | ||||||||||||||||||
| 773 | const bool pressed = widget->property("_pixmapstyle_combobox_pressed").toBool(); | - | ||||||||||||||||||
| 774 | const bool opened = option->state & State_On; | - | ||||||||||||||||||
| 775 | - | |||||||||||||||||||
| 776 | ControlDescriptor control = | - | ||||||||||||||||||
| 777 | enabled
| 0 | ||||||||||||||||||
| 778 | drawCachedPixmap(control, option->rect, painter); | - | ||||||||||||||||||
| 779 | - | |||||||||||||||||||
| 780 | ControlPixmap cp = enabled
| 0 | ||||||||||||||||||
| 781 | : (pressed
| 0 | ||||||||||||||||||
| 782 | : DD_ArrowDisabled; | - | ||||||||||||||||||
| 783 | QPixmapStylePixmap pix = d->pixmaps.value(cp); | - | ||||||||||||||||||
| 784 | QRect rect = comboBoxSubControlRect(option, SC_ComboBoxArrow, widget); | - | ||||||||||||||||||
| 785 | painter->drawPixmap(rect, pix.pixmap); | - | ||||||||||||||||||
| 786 | } never executed: end of block | 0 | ||||||||||||||||||
| 787 | - | |||||||||||||||||||
| 788 | void QPixmapStyle::drawScrollBar(const QStyleOptionComplex *option, | - | ||||||||||||||||||
| 789 | QPainter *painter, const QWidget *widget) const | - | ||||||||||||||||||
| 790 | { | - | ||||||||||||||||||
| 791 | if (const
| 0 | ||||||||||||||||||
| 792 | qstyleoption_cast<const QStyleOptionSlider*>(option)
| 0 | ||||||||||||||||||
| 793 | - | |||||||||||||||||||
| 794 | if (slider->minimum == slider->maximum
| 0 | ||||||||||||||||||
| 795 | return; never executed: return; | 0 | ||||||||||||||||||
| 796 | - | |||||||||||||||||||
| 797 | QRect rect = scrollBarSubControlRect(option, SC_ScrollBarSlider, widget); | - | ||||||||||||||||||
| 798 | ControlDescriptor control = slider->orientation == Qt::Horizontal
| 0 | ||||||||||||||||||
| 799 | ? SB_Horizontal : SB_Vertical; | - | ||||||||||||||||||
| 800 | drawCachedPixmap(control, rect, painter); | - | ||||||||||||||||||
| 801 | } never executed: end of block | 0 | ||||||||||||||||||
| 802 | } never executed: end of block | 0 | ||||||||||||||||||
| 803 | - | |||||||||||||||||||
| 804 | QSize QPixmapStyle::pushButtonSizeFromContents(const QStyleOption *option, | - | ||||||||||||||||||
| 805 | const QSize &contentsSize, | - | ||||||||||||||||||
| 806 | const QWidget *widget) const | - | ||||||||||||||||||
| 807 | { | - | ||||||||||||||||||
| 808 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 809 | - | |||||||||||||||||||
| 810 | const QPixmapStyleDescriptor &desc = d->descriptors.value(PB_Enabled); | - | ||||||||||||||||||
| 811 | const int bm = proxy()->pixelMetric(PM_ButtonMargin, option, widget); | - | ||||||||||||||||||
| 812 | - | |||||||||||||||||||
| 813 | int w = contentsSize.width(); | - | ||||||||||||||||||
| 814 | int h = contentsSize.height(); | - | ||||||||||||||||||
| 815 | w += desc.margins.left() + desc.margins.right() + bm; | - | ||||||||||||||||||
| 816 | h += desc.margins.top() + desc.margins.bottom() + bm; | - | ||||||||||||||||||
| 817 | - | |||||||||||||||||||
| 818 | return never executed: d->computeSize(desc, w, h);return d->computeSize(desc, w, h);never executed: return d->computeSize(desc, w, h); | 0 | ||||||||||||||||||
| 819 | } | - | ||||||||||||||||||
| 820 | - | |||||||||||||||||||
| 821 | QSize QPixmapStyle::lineEditSizeFromContents(const QStyleOption *, | - | ||||||||||||||||||
| 822 | const QSize &contentsSize, const QWidget *) const | - | ||||||||||||||||||
| 823 | { | - | ||||||||||||||||||
| 824 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 825 | - | |||||||||||||||||||
| 826 | const QPixmapStyleDescriptor &desc = d->descriptors.value(LE_Enabled); | - | ||||||||||||||||||
| 827 | const int border = 2 * proxy()->pixelMetric(PM_DefaultFrameWidth); | - | ||||||||||||||||||
| 828 | - | |||||||||||||||||||
| 829 | int w = contentsSize.width() + border + desc.margins.left() + desc.margins.right(); | - | ||||||||||||||||||
| 830 | int h = contentsSize.height() + border + desc.margins.top() + desc.margins.bottom(); | - | ||||||||||||||||||
| 831 | - | |||||||||||||||||||
| 832 | return never executed: d->computeSize(desc, w, h);return d->computeSize(desc, w, h);never executed: return d->computeSize(desc, w, h); | 0 | ||||||||||||||||||
| 833 | } | - | ||||||||||||||||||
| 834 | - | |||||||||||||||||||
| 835 | QSize QPixmapStyle::progressBarSizeFromContents(const QStyleOption *option, | - | ||||||||||||||||||
| 836 | const QSize &contentsSize, | - | ||||||||||||||||||
| 837 | const QWidget *widget) const | - | ||||||||||||||||||
| 838 | { | - | ||||||||||||||||||
| 839 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 840 | - | |||||||||||||||||||
| 841 | bool vertical = false; | - | ||||||||||||||||||
| 842 | if (const
| 0 | ||||||||||||||||||
| 843 | qstyleoption_cast<const QStyleOptionProgressBar *>(option)
| 0 | ||||||||||||||||||
| 844 | vertical = pb->orientation == Qt::Vertical; | - | ||||||||||||||||||
| 845 | } never executed: end of block | 0 | ||||||||||||||||||
| 846 | QSize result = QCommonStyle::sizeFromContents(CT_Slider, option, contentsSize, widget); | - | ||||||||||||||||||
| 847 | if (vertical
| 0 | ||||||||||||||||||
| 848 | const QPixmapStyleDescriptor desc = d->descriptors.value(PB_VBackground); | - | ||||||||||||||||||
| 849 | return never executed: QSize(desc.size.height(), result.height());return QSize(desc.size.height(), result.height());never executed: return QSize(desc.size.height(), result.height()); | 0 | ||||||||||||||||||
| 850 | } else { | - | ||||||||||||||||||
| 851 | const QPixmapStyleDescriptor desc = d->descriptors.value(PB_HBackground); | - | ||||||||||||||||||
| 852 | return never executed: QSize(result.width(), desc.size.height());return QSize(result.width(), desc.size.height());never executed: return QSize(result.width(), desc.size.height()); | 0 | ||||||||||||||||||
| 853 | } | - | ||||||||||||||||||
| 854 | } | - | ||||||||||||||||||
| 855 | - | |||||||||||||||||||
| 856 | QSize QPixmapStyle::sliderSizeFromContents(const QStyleOption *option, | - | ||||||||||||||||||
| 857 | const QSize &contentsSize, | - | ||||||||||||||||||
| 858 | const QWidget *widget) const | - | ||||||||||||||||||
| 859 | { | - | ||||||||||||||||||
| 860 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 861 | - | |||||||||||||||||||
| 862 | const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option); | - | ||||||||||||||||||
| 863 | if (!slider
| 0 | ||||||||||||||||||
| 864 | return never executed: QSize();return QSize();never executed: return QSize(); | 0 | ||||||||||||||||||
| 865 | - | |||||||||||||||||||
| 866 | QSize result = QCommonStyle::sizeFromContents(CT_Slider, option, contentsSize, widget); | - | ||||||||||||||||||
| 867 | - | |||||||||||||||||||
| 868 | const QPixmapStyleDescriptor desc = d->descriptors.value(slider->orientation == Qt::Horizontal | - | ||||||||||||||||||
| 869 | ? SG_HEnabled : SG_VEnabled); | - | ||||||||||||||||||
| 870 | - | |||||||||||||||||||
| 871 | if (slider->orientation == Qt::Horizontal
| 0 | ||||||||||||||||||
| 872 | return never executed: QSize(result.width(), desc.size.height());return QSize(result.width(), desc.size.height());never executed: return QSize(result.width(), desc.size.height()); | 0 | ||||||||||||||||||
| 873 | else | - | ||||||||||||||||||
| 874 | return never executed: QSize(desc.size.width(), result.height());return QSize(desc.size.width(), result.height());never executed: return QSize(desc.size.width(), result.height()); | 0 | ||||||||||||||||||
| 875 | } | - | ||||||||||||||||||
| 876 | - | |||||||||||||||||||
| 877 | QSize QPixmapStyle::comboBoxSizeFromContents(const QStyleOption *option, | - | ||||||||||||||||||
| 878 | const QSize &contentsSize, | - | ||||||||||||||||||
| 879 | const QWidget *widget) const | - | ||||||||||||||||||
| 880 | { | - | ||||||||||||||||||
| 881 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 882 | - | |||||||||||||||||||
| 883 | const QPixmapStyleDescriptor &desc = d->descriptors.value(DD_ButtonEnabled); | - | ||||||||||||||||||
| 884 | - | |||||||||||||||||||
| 885 | QSize result = QCommonStyle::sizeFromContents(CT_ComboBox, option, contentsSize, widget); | - | ||||||||||||||||||
| 886 | return never executed: d->computeSize(desc, result.width(), result.height());return d->computeSize(desc, result.width(), result.height());never executed: return d->computeSize(desc, result.width(), result.height()); | 0 | ||||||||||||||||||
| 887 | } | - | ||||||||||||||||||
| 888 | - | |||||||||||||||||||
| 889 | QSize QPixmapStyle::itemViewSizeFromContents(const QStyleOption *option, | - | ||||||||||||||||||
| 890 | const QSize &contentsSize, | - | ||||||||||||||||||
| 891 | const QWidget *widget) const | - | ||||||||||||||||||
| 892 | { | - | ||||||||||||||||||
| 893 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 894 | - | |||||||||||||||||||
| 895 | QSize size = QCommonStyle::sizeFromContents(CT_ItemViewItem, option, contentsSize, widget); | - | ||||||||||||||||||
| 896 | - | |||||||||||||||||||
| 897 | ControlPixmap cp = ID_Separator; | - | ||||||||||||||||||
| 898 | ControlDescriptor cd = ID_Selected; | - | ||||||||||||||||||
| 899 | if (widget
| 0 | ||||||||||||||||||
| 900 | cp = DD_ItemSeparator; | - | ||||||||||||||||||
| 901 | cd = DD_ItemSelected; | - | ||||||||||||||||||
| 902 | } never executed: end of block | 0 | ||||||||||||||||||
| 903 | - | |||||||||||||||||||
| 904 | const QPixmapStyleDescriptor &desc = d->descriptors.value(cd); | - | ||||||||||||||||||
| 905 | const QPixmapStylePixmap &pix = d->pixmaps.value(cp); | - | ||||||||||||||||||
| 906 | size.setHeight(qMax(size.height(), | - | ||||||||||||||||||
| 907 | desc.size.height() + pix.pixmap.height())); | - | ||||||||||||||||||
| 908 | return never executed: size;return size;never executed: return size; | 0 | ||||||||||||||||||
| 909 | } | - | ||||||||||||||||||
| 910 | - | |||||||||||||||||||
| 911 | QRect QPixmapStyle::comboBoxSubControlRect(const QStyleOptionComplex *option, | - | ||||||||||||||||||
| 912 | QStyle::SubControl sc, const QWidget *) const | - | ||||||||||||||||||
| 913 | { | - | ||||||||||||||||||
| 914 | const QPixmapStylePrivate * const d = d_func(); | - | ||||||||||||||||||
| 915 | - | |||||||||||||||||||
| 916 | QRect r = option->rect; | - | ||||||||||||||||||
| 917 | const QPixmapStylePixmap &pix = d->pixmaps.value(DD_ArrowEnabled); | - | ||||||||||||||||||
| 918 | const QPixmapStyleDescriptor &desc = d->descriptors.value(DD_ButtonEnabled); | - | ||||||||||||||||||
| 919 | - | |||||||||||||||||||
| 920 | switch (sc) { | - | ||||||||||||||||||
| 921 | case never executed: SC_ComboBoxArrow:case SC_ComboBoxArrow:never executed: case SC_ComboBoxArrow: | 0 | ||||||||||||||||||
| 922 | r.setRect(r.right() - pix.margins.right() - pix.pixmap.width(), | - | ||||||||||||||||||
| 923 | r.top() + pix.margins.top(), | - | ||||||||||||||||||
| 924 | pix.pixmap.width(), pix.pixmap.height()); | - | ||||||||||||||||||
| 925 | break; never executed: break; | 0 | ||||||||||||||||||
| 926 | case never executed: SC_ComboBoxEditField:case SC_ComboBoxEditField:never executed: case SC_ComboBoxEditField: | 0 | ||||||||||||||||||
| 927 | r.adjust(desc.margins.left(), desc.margins.right(), | - | ||||||||||||||||||
| 928 | -desc.margins.right(), -desc.margins.bottom()); | - | ||||||||||||||||||
| 929 | r.setRight(r.right() - pix.margins.right() - pix.margins.left() - pix.pixmap.width()); | - | ||||||||||||||||||
| 930 | break; never executed: break; | 0 | ||||||||||||||||||
| 931 | default never executed: :default:never executed: default: | 0 | ||||||||||||||||||
| 932 | break; never executed: break; | 0 | ||||||||||||||||||
| 933 | } | - | ||||||||||||||||||
| 934 | - | |||||||||||||||||||
| 935 | r = visualRect(option->direction, option->rect, r); | - | ||||||||||||||||||
| 936 | return never executed: r;return r;never executed: return r; | 0 | ||||||||||||||||||
| 937 | } | - | ||||||||||||||||||
| 938 | - | |||||||||||||||||||
| 939 | QRect QPixmapStyle::scrollBarSubControlRect(const QStyleOptionComplex *option, | - | ||||||||||||||||||
| 940 | QStyle::SubControl sc, const QWidget *) const | - | ||||||||||||||||||
| 941 | { | - | ||||||||||||||||||
| 942 | if (const
| 0 | ||||||||||||||||||
| 943 | qstyleoption_cast<const QStyleOptionSlider*>(option)
| 0 | ||||||||||||||||||
| 944 | int length = (
| 0 | ||||||||||||||||||
| 945 | ? slider->rect.width() : slider->rect.height(); | - | ||||||||||||||||||
| 946 | int page = length * slider->pageStep | - | ||||||||||||||||||
| 947 | / (slider->maximum - slider->minimum + slider->pageStep); | - | ||||||||||||||||||
| 948 | int pos = length * slider->sliderValue | - | ||||||||||||||||||
| 949 | / (slider->maximum - slider->minimum + slider->pageStep); | - | ||||||||||||||||||
| 950 | pos = qMin(pos+page, length) - page; | - | ||||||||||||||||||
| 951 | - | |||||||||||||||||||
| 952 | QRect rect = slider->rect; | - | ||||||||||||||||||
| 953 | - | |||||||||||||||||||
| 954 | if (slider->orientation == Qt::Horizontal
| 0 | ||||||||||||||||||
| 955 | switch (sc) { | - | ||||||||||||||||||
| 956 | case never executed: SC_ScrollBarAddPage:case SC_ScrollBarAddPage:never executed: case SC_ScrollBarAddPage: | 0 | ||||||||||||||||||
| 957 | rect.setLeft(pos+page); | - | ||||||||||||||||||
| 958 | return never executed: rect;return rect;never executed: return rect; | 0 | ||||||||||||||||||
| 959 | case never executed: SC_ScrollBarSubPage:case SC_ScrollBarSubPage:never executed: case SC_ScrollBarSubPage: | 0 | ||||||||||||||||||
| 960 | rect.setRight(pos); | - | ||||||||||||||||||
| 961 | return never executed: rect;return rect;never executed: return rect; | 0 | ||||||||||||||||||
| 962 | case never executed: SC_ScrollBarGroove:case SC_ScrollBarGroove:never executed: case SC_ScrollBarGroove: | 0 | ||||||||||||||||||
| 963 | return never executed: rect;return rect;never executed: return rect; | 0 | ||||||||||||||||||
| 964 | case never executed: SC_ScrollBarSlider:case SC_ScrollBarSlider:never executed: case SC_ScrollBarSlider: | 0 | ||||||||||||||||||
| 965 | rect.setLeft(pos); | - | ||||||||||||||||||
| 966 | rect.setRight(pos+page); | - | ||||||||||||||||||
| 967 | return never executed: rect;return rect;never executed: return rect; | 0 | ||||||||||||||||||
| 968 | default never executed: :default:never executed: ;default: | 0 | ||||||||||||||||||
| 969 | } never executed: end of block | 0 | ||||||||||||||||||
| 970 | } else { | - | ||||||||||||||||||
| 971 | switch (sc) { | - | ||||||||||||||||||
| 972 | case never executed: SC_ScrollBarAddPage:case SC_ScrollBarAddPage:never executed: case SC_ScrollBarAddPage: | 0 | ||||||||||||||||||
| 973 | rect.setTop(pos+page); | - | ||||||||||||||||||
| 974 | return never executed: rect;return rect;never executed: return rect; | 0 | ||||||||||||||||||
| 975 | case never executed: SC_ScrollBarSubPage:case SC_ScrollBarSubPage:never executed: case SC_ScrollBarSubPage: | 0 | ||||||||||||||||||
| 976 | rect.setBottom(pos); | - | ||||||||||||||||||
| 977 | return never executed: rect;return rect;never executed: return rect; | 0 | ||||||||||||||||||
| 978 | case never executed: SC_ScrollBarGroove:case SC_ScrollBarGroove:never executed: case SC_ScrollBarGroove: | 0 | ||||||||||||||||||
| 979 | return never executed: rect;return rect;never executed: return rect; | 0 | ||||||||||||||||||
| 980 | case never executed: SC_ScrollBarSlider:case SC_ScrollBarSlider:never executed: case SC_ScrollBarSlider: | 0 | ||||||||||||||||||
| 981 | rect.setTop(pos); | - | ||||||||||||||||||
| 982 | rect.setBottom(pos+page); | - | ||||||||||||||||||
| 983 | return never executed: rect;return rect;never executed: return rect; | 0 | ||||||||||||||||||
| 984 | default never executed: :default:never executed: ;default: | 0 | ||||||||||||||||||
| 985 | } never executed: end of block | 0 | ||||||||||||||||||
| 986 | } | - | ||||||||||||||||||
| 987 | } | - | ||||||||||||||||||
| 988 | return never executed: QRect();return QRect();never executed: return QRect(); | 0 | ||||||||||||||||||
| 989 | } | - | ||||||||||||||||||
| 990 | - | |||||||||||||||||||
| 991 | QPixmap QPixmapStylePrivate::scale(int w, int h, const QPixmap &pixmap, const QPixmapStyleDescriptor &desc) | - | ||||||||||||||||||
| 992 | { | - | ||||||||||||||||||
| 993 | QPixmap result(w, h); | - | ||||||||||||||||||
| 994 | { | - | ||||||||||||||||||
| 995 | const QColor transparent(0, 0, 0, 0); | - | ||||||||||||||||||
| 996 | result.fill( transparent ); | - | ||||||||||||||||||
| 997 | QPainter p( &result ); | - | ||||||||||||||||||
| 998 | const QMargins margins = desc.margins; | - | ||||||||||||||||||
| 999 | qDrawBorderPixmap(&p, result.rect(), margins, pixmap, | - | ||||||||||||||||||
| 1000 | pixmap.rect(), margins, desc.tileRules); | - | ||||||||||||||||||
| 1001 | } | - | ||||||||||||||||||
| 1002 | return never executed: result;return result;never executed: return result; | 0 | ||||||||||||||||||
| 1003 | } | - | ||||||||||||||||||
| 1004 | - | |||||||||||||||||||
| 1005 | QPixmap QPixmapStylePrivate::getCachedPixmap(QPixmapStyle::ControlDescriptor control, | - | ||||||||||||||||||
| 1006 | const QPixmapStyleDescriptor &desc, | - | ||||||||||||||||||
| 1007 | const QSize &size) const | - | ||||||||||||||||||
| 1008 | { | - | ||||||||||||||||||
| 1009 | const QPixmapStyle * const q = q_func(); | - | ||||||||||||||||||
| 1010 | - | |||||||||||||||||||
| 1011 | const QString sizeString = QString::number(size.width()) % QLatin1Char('*') | - | ||||||||||||||||||
| 1012 | % QString::number(size.height()); | - | ||||||||||||||||||
| 1013 | const QString key = QLatin1String(q->metaObject()->className()) % QString::number(control) | - | ||||||||||||||||||
| 1014 | % QLatin1Char('@') % sizeString; | - | ||||||||||||||||||
| 1015 | - | |||||||||||||||||||
| 1016 | QPixmap result; | - | ||||||||||||||||||
| 1017 | - | |||||||||||||||||||
| 1018 | if (!QPixmapCache::find( key, &result)
| 0 | ||||||||||||||||||
| 1019 | QPixmap source(desc.fileName); | - | ||||||||||||||||||
| 1020 | result = scale(size.width(), size.height(), source, desc); | - | ||||||||||||||||||
| 1021 | QPixmapCache::insert(key, result); | - | ||||||||||||||||||
| 1022 | } never executed: end of block | 0 | ||||||||||||||||||
| 1023 | return never executed: result;return result;never executed: return result; | 0 | ||||||||||||||||||
| 1024 | } | - | ||||||||||||||||||
| 1025 | - | |||||||||||||||||||
| 1026 | QSize QPixmapStylePrivate::computeSize(const QPixmapStyleDescriptor &desc, int width, int height) const | - | ||||||||||||||||||
| 1027 | { | - | ||||||||||||||||||
| 1028 | if (desc.tileRules.horizontal != Qt::RepeatTile
| 0 | ||||||||||||||||||
| 1029 | width = qMax(width, desc.size.width()); never executed: width = qMax(width, desc.size.width()); | 0 | ||||||||||||||||||
| 1030 | if (desc.tileRules.vertical != Qt::RepeatTile
| 0 | ||||||||||||||||||
| 1031 | height = qMax(height, desc.size.height()); never executed: height = qMax(height, desc.size.height()); | 0 | ||||||||||||||||||
| 1032 | return never executed: QSize(width, height);return QSize(width, height);never executed: return QSize(width, height); | 0 | ||||||||||||||||||
| 1033 | } | - | ||||||||||||||||||
| 1034 | - | |||||||||||||||||||
| 1035 | - | |||||||||||||||||||
| Switch to Source code | Preprocessed file |