Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qpixmapstyle.cpp
Go to the documentation of this file.
1// Copyright (C) 2014 BlackBerry Limited. All rights reserved.
2// Copyright (C) 2015 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com
3// Copyright (C) 2016 The Qt Company Ltd.
4// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
5
6#include "qpixmapstyle_p.h"
7#include "qpixmapstyle_p_p.h"
8
9#include <QDebug>
10#if QT_CONFIG(textedit)
11#include <QTextEdit>
12#endif
13#include <QStringBuilder>
14#include <QPainter>
15#include <QPixmapCache>
16#include <QStyleOption>
17#include <QString>
18#if QT_CONFIG(progressbar)
19#include <QProgressBar>
20#endif
21#if QT_CONFIG(slider)
22#include <QSlider>
23#endif
24#include <QEvent>
25#if QT_CONFIG(combobox)
26#include <QComboBox>
27#endif
28#if QT_CONFIG(itemviews)
29#include <QAbstractItemView>
30#include <QStyledItemDelegate>
31#endif
32#if QT_CONFIG(listview)
33#include <QListView>
34#endif
35#include <QAbstractScrollArea>
36#if QT_CONFIG(scrollbar)
37#include <QScrollBar>
38#endif
39#if QT_CONFIG(scroller)
40#include <qscroller.h>
41#endif
42
44
75
82
87{
88 QCommonStyle::polish(application);
89}
90
98
103{
104 Q_D(QPixmapStyle);
105
106 // Don't fill the interior of the QTextEdit
107#if QT_CONFIG(textedit)
108 if (qobject_cast<QTextEdit*>(widget)) {
112 }
113#endif
114#if QT_CONFIG(progressbar)
115 if (QProgressBar *pb = qobject_cast<QProgressBar*>(widget)) {
116 // Center the text in the progress bar
117 pb->setAlignment(Qt::AlignCenter);
118 // Change the font size if needed, as it's used to compute the minimum size
119 QFont font = pb->font();
120 font.setPixelSize(d->descriptors.value(PB_HBackground).size.height()/2);
121 pb->setFont(font);
122 }
123#endif
124#if QT_CONFIG(slider)
125 if (qobject_cast<QSlider*>(widget))
127#endif
128#if QT_CONFIG(combobox)
129 if (QComboBox *cb = qobject_cast<QComboBox*>(widget)) {
131 // NOTE: This will break if the private API of QComboBox changes drastically
132 // Make sure the popup is created so we can change the frame style
133 QAbstractItemView *list = cb->view();
134 list->setProperty("_pixmap_combobox_list", true);
135 list->setItemDelegate(new QStyledItemDelegate(list));
136 QPalette p = list->palette();
143 list->setPalette(p);
144
145 QFrame *frame = qobject_cast<QFrame*>(list->parent());
146 if (frame) {
147 const QPixmapStyleDescriptor &desc = d->descriptors.value(DD_PopupDown);
148 const QPixmapStylePixmap &pix = d->pixmaps.value(DD_ItemSeparator);
149 frame->setContentsMargins(pix.margins.left(), desc.margins.top(),
150 pix.margins.right(), desc.margins.bottom());
152 }
153 }
154#endif // QT_CONFIG(combobox)
155 if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0)
157
158#if QT_CONFIG(scrollarea)
159 if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget)) {
160 scrollArea->viewport()->setAutoFillBackground(false);
161#if QT_CONFIG(itemviews)
162 if (QAbstractItemView *view = qobject_cast<QAbstractItemView*>(scrollArea)) {
163 view->setHorizontalScrollMode(QAbstractItemView::ScrollPerPixel);
164 view->setVerticalScrollMode(QAbstractItemView::ScrollPerPixel);
165 }
166#endif
167#if QT_CONFIG(gestures) && QT_CONFIG(scroller)
169#endif
170 }
171#endif // QT_CONFIG(scrollarea)
172#if QT_CONFIG(scrollbar)
173 if (qobject_cast<QScrollBar*>(widget))
175#endif
176#if !QT_CONFIG(progressbar) && !QT_CONFIG(combobox)
177 Q_UNUSED(d);
178#endif
180}
181
186{
187 QCommonStyle::unpolish(application);
188}
189
194{
195 if (
196#if QT_CONFIG(slider)
197 qobject_cast<QSlider*>(widget)
198#else
199 false
200#endif
201#if QT_CONFIG(combobox)
202 || qobject_cast<QComboBox*>(widget)
203#endif
204 ) {
206 }
207
208 if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0)
210
211#if QT_CONFIG(gestures) && QT_CONFIG(scrollarea) && QT_CONFIG(scroller)
212 if (QAbstractScrollArea *scrollArea = qobject_cast<QAbstractScrollArea*>(widget))
214#endif
215
217}
218
223 QPainter *painter, const QWidget *widget) const
224{
225 switch (element) {
226 case PE_FrameFocusRect: //disable focus rectangle
227 break;
231 break;
232 case PE_PanelLineEdit:
233 case PE_FrameLineEdit:
235 break;
236 case PE_Frame:
237#if QT_CONFIG(textedit)
239 if (qobject_cast<const QTextEdit*>(widget))
241 break;
242#endif
245 break;
248 break;
250#if QT_CONFIG(listview)
251 if (qobject_cast<const QListView*>(widget))
253 else
254#endif
256 break;
257 default:
259 }
260}
261
266 QPainter *painter, const QWidget *widget) const
267{
268 Q_D(const QPixmapStyle);
269
270 switch (element) {
273 break;
276 break;
279 break;
280 case CE_ShapedFrame:
281 // NOTE: This will break if the private API of QComboBox changes drastically
282 if (qstrcmp(widget->metaObject()->className(),"QComboBoxPrivateContainer") == 0) {
283 const QPixmapStyleDescriptor &desc = d->descriptors.value(DD_PopupDown);
284 const QPixmapStylePixmap &pix = d->pixmaps.value(DD_ItemSeparator);
285 QRect rect = option->rect;
286 rect.adjust(-pix.margins.left(), -desc.margins.top(),
287 pix.margins.right(), desc.margins.bottom());
288 bool up = widget->property("_pixmapstyle_combobox_up").toBool();
290 }
291 else {
293 }
294 break;
295 default:
297 }
298}
299
304 QPainter *painter, const QWidget *widget) const
305{
306 switch (cc) {
307 case CC_Slider:
309 break;
310 case CC_ComboBox:
312 break;
313 case CC_ScrollBar:
315 break;
316 default:
318 }
319}
320
325 const QSize &contentsSize, const QWidget *widget) const
326{
327 switch (type) {
328 case CT_PushButton:
329 return pushButtonSizeFromContents(option, contentsSize, widget);
330 case CT_LineEdit:
331 return lineEditSizeFromContents(option, contentsSize, widget);
332 case CT_ProgressBar:
333 return progressBarSizeFromContents(option, contentsSize, widget);
334 case CT_Slider:
335 return sliderSizeFromContents(option, contentsSize, widget);
336 case CT_ComboBox:
337 return comboBoxSizeFromContents(option, contentsSize, widget);
338 case CT_ItemViewItem:
339 return itemViewSizeFromContents(option, contentsSize, widget);
340 default: ;
341 }
342
343 return QCommonStyle::sizeFromContents(type, option, contentsSize, widget);
344}
345
350 const QWidget *widget) const
351{
352 Q_D(const QPixmapStyle);
353
354 switch (element) {
356 {
358 const QPixmapStyleDescriptor &desc = d->descriptors.value(LE_Enabled);
359 rect.adjust(desc.margins.left(), desc.margins.top(),
360 -desc.margins.right(), -desc.margins.bottom());
361 rect = visualRect(option->direction, option->rect, rect);
362 return rect;
363 }
364 default: ;
365 }
366
368}
369
374 SubControl sc, const QWidget *widget) const
375{
376 switch (cc) {
377 case CC_ComboBox:
379 case CC_ScrollBar:
381 default: ;
382 }
383
385}
386
391 const QWidget *widget) const
392{
393 Q_D(const QPixmapStyle);
394
395 switch (metric) {
398 return 0;
400#if QT_CONFIG(textedit)
401 if (qobject_cast<const QTextEdit*>(widget)) {
402 const QPixmapStyleDescriptor &desc = d->descriptors.value(LE_Enabled);
403 return qMax(qMax(desc.margins.left(), desc.margins.right()),
404 qMax(desc.margins.top(), desc.margins.bottom()));
405 }
406#endif
407 return 0;
409 return d->pixmaps.value(CB_Enabled).pixmap.width();
411 return d->pixmaps.value(CB_Enabled).pixmap.height();
413 {
414 const QPixmapStylePixmap &pix = d->pixmaps.value(CB_Enabled);
415 return qMax(qMax(pix.margins.left(), pix.margins.right()),
416 qMax(pix.margins.top(), pix.margins.bottom()));
417 }
419 return d->pixmaps.value(RB_Enabled).pixmap.width();
421 return d->pixmaps.value(RB_Enabled).pixmap.height();
423 {
424 const QPixmapStylePixmap &pix = d->pixmaps.value(RB_Enabled);
425 return qMax(qMax(pix.margins.left(), pix.margins.right()),
426 qMax(pix.margins.top(), pix.margins.bottom()));
427 }
428#if QT_CONFIG(slider)
430 if (const QStyleOptionSlider *slider =
431 qstyleoption_cast<const QStyleOptionSlider*>(option)) {
432 const QPixmapStyleDescriptor desc =
433 d->descriptors.value(slider->orientation == Qt::Horizontal
435 return slider->orientation == Qt::Horizontal
436 ? desc.size.height() : desc.size.width();
437 }
438 break;
440 if (const QStyleOptionSlider *slider =
441 qstyleoption_cast<const QStyleOptionSlider*>(option)) {
442 const QPixmapStylePixmap pix =
443 d->pixmaps.value(slider->orientation == Qt::Horizontal
445 return slider->orientation == Qt::Horizontal
446 ? pix.pixmap.height() : pix.pixmap.width();
447 }
448 break;
449 case PM_SliderLength:
450 if (const QStyleOptionSlider *slider =
451 qstyleoption_cast<const QStyleOptionSlider*>(option)) {
452 const QPixmapStylePixmap pix =
453 d->pixmaps.value(slider->orientation == Qt::Horizontal
455 return slider->orientation == Qt::Horizontal
456 ? pix.pixmap.width() : pix.pixmap.height();
457 }
458 break;
460 if (const QStyleOptionSlider *slider =
461 qstyleoption_cast<const QStyleOptionSlider*>(option)) {
462 const QPixmapStyleDescriptor desc =
463 d->descriptors.value(slider->orientation == Qt::Horizontal
465 return slider->orientation == Qt::Horizontal
466 ? desc.size.height() : desc.size.width();
467 }
468 break;
469#endif // QT_CONFIG(slider)
471 return 0;
472 default: ;
473 }
474
475 return QCommonStyle::pixelMetric(metric, option, widget);
476}
477
482 const QWidget *widget, QStyleHintReturn *returnData) const
483{
484 switch (hint) {
486 return false;
488 return false;
489 default: ;
490 }
491
492 return QCommonStyle::styleHint(hint, option, widget, returnData);
493}
494
500 const QPoint &pos,
501 const QWidget *widget) const
502{
504 if (control == CC_ScrollBar) {
505 if (sc == SC_ScrollBarAddLine)
506 return SC_ScrollBarAddPage;
507 else if (sc == SC_ScrollBarSubLine)
508 return SC_ScrollBarSubPage;
509 }
510
511 return sc;
512}
513
518{
519 Q_D(QPixmapStyle);
520#if QT_CONFIG(slider)
521 if (QSlider *slider = qobject_cast<QSlider*>(watched)) {
522 switch (event->type()) {
526 slider->update();
527 break;
528 default: ;
529 }
530 }
531#endif // QT_CONFIG(slider)
532#if QT_CONFIG(combobox)
533 if (QComboBox *comboBox = qobject_cast<QComboBox*>(watched)) {
534 switch (event->type()) {
536 event->ignore();
537 comboBox->setProperty("_pixmapstyle_combobox_pressed", true);
538 comboBox->repaint();
539 return true;
541 comboBox->setProperty("_pixmapstyle_combobox_pressed", false);
542 comboBox->repaint();
543 if ( comboBox->view() ) {
544 if ( comboBox->view()->isVisible() || (!comboBox->isEnabled()))
545 comboBox->hidePopup();
546 else
547 comboBox->showPopup();
548 }
549 break;
550 default: ;
551 }
552 }
553#endif // QT_CONFIG(combobox)
554
555 if (qstrcmp(watched->metaObject()->className(),"QComboBoxPrivateContainer") == 0) {
556 if (event->type() == QEvent::Show) {
558 int yPopup = widget->geometry().top();
559 int yCombo = widget->parentWidget()->mapToGlobal(QPoint(0, 0)).y();
560 QRect geom = widget->geometry();
561 const QPixmapStyleDescriptor &desc = d->descriptors.value(DD_ButtonEnabled);
562 const bool up = yPopup < yCombo;
563 geom.moveTop(geom.top() + (up ? desc.margins.top() : -desc.margins.bottom()));
564 widget->setGeometry(geom);
565 widget->setProperty("_pixmapstyle_combobox_up", up);
566 widget->parentWidget()->setProperty("_pixmapstyle_combobox_up", up);
567 }
568 }
569
570 return QCommonStyle::eventFilter(watched, event);
571}
572
588 QMargins margins, QTileRules tileRules)
589{
590 Q_D(QPixmapStyle);
591
594
595 if (image.isNull())
596 return;
597
598 desc.fileName = fileName;
599 desc.margins = margins;
600 desc.tileRules = tileRules;
601 desc.size = image.size();
602
603 d->descriptors[control] = desc;
604}
605
616{
617 Q_D(QPixmapStyle);
618 d->descriptors[dest] = d->descriptors.value(source);
619}
620
627 QPainter *p) const
628{
629 Q_D(const QPixmapStyle);
630 auto descriptor = d->descriptors.constFind(control);
631 if (descriptor == d->descriptors.constEnd())
632 return;
633 const QPixmap pix = d->getCachedPixmap(control, descriptor.value(), rect.size());
634 Q_ASSERT(!pix.isNull());
635 p->drawPixmap(rect, pix);
636}
637
646 QMargins margins)
647{
648 Q_D(QPixmapStyle);
649
652
653 if (image.isNull())
654 return;
655
656 pix.pixmap = image;
657 pix.margins = margins;
658
659 d->pixmaps[control] = pix;
660}
661
662/*
663 \fn void QPixmapStyle::copyPixmap(QPixmapStyle::ControlPixmap source, QPixmapStyle::ControlPixmap dest)
664
665 Copies the data associated with the \a source pixmap to the \a dest pixmap.
666
667 \sa addPixmap, addDescriptor, copyDescriptor
668*/
670{
671 Q_D(QPixmapStyle);
672 d->pixmaps[dest] = d->pixmaps.value(source);
673}
674
683
685 QPainter *painter, const QWidget *) const
686{
687 const bool checked = option->state & State_On;
688 const bool pressed = option->state & State_Sunken;
689 const bool enabled = option->state & State_Enabled;
690
692 if (enabled)
693 control = pressed ? PB_Pressed : (checked ? PB_Checked : PB_Enabled);
694 else
695 control = checked ? PB_PressedDisabled : PB_Disabled;
696 drawCachedPixmap(control, option->rect, painter);
697}
698
700 QPainter *painter, const QWidget *widget) const
701{
702 // Don't draw for the line edit inside a combobox
703#if QT_CONFIG(combobox)
704 if (widget && qobject_cast<const QComboBox*>(widget->parentWidget()))
705 return;
706#else
708#endif
709 const bool enabled = option->state & State_Enabled;
710 const bool focused = option->state & State_HasFocus;
711 ControlDescriptor control = enabled ? (focused ? LE_Focused : LE_Enabled) : LE_Disabled;
712 drawCachedPixmap(control, option->rect, painter);
713}
714
716 QPainter *painter, const QWidget *) const
717{
718 const bool enabled = option->state & State_Enabled;
719 const bool focused = option->state & State_HasFocus;
720 ControlDescriptor control = enabled ? (focused ? TE_Focused : TE_Enabled) : TE_Disabled;
721 drawCachedPixmap(control, option->rect, painter);
722}
723
725 QPainter *painter, const QWidget *) const
726{
727 Q_D(const QPixmapStyle);
728
729 const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option);
730
731 const bool down = button->state & State_Sunken;
732 const bool enabled = button->state & State_Enabled;
733 const bool on = button->state & State_On;
734
735 ControlPixmap control;
736 if (enabled)
737 control = on ? (down ? CB_PressedChecked : CB_Checked) : (down ? CB_Pressed : CB_Enabled);
738 else
739 control = on ? CB_DisabledChecked : CB_Disabled;
740 painter->drawPixmap(button->rect, d->pixmaps.value(control).pixmap);
741}
742
744 QPainter *painter, const QWidget *) const
745{
746 Q_D(const QPixmapStyle);
747
748 const QStyleOptionButton *button = qstyleoption_cast<const QStyleOptionButton*>(option);
749
750 const bool down = button->state & State_Sunken;
751 const bool enabled = button->state & State_Enabled;
752 const bool on = button->state & State_On;
753
754 ControlPixmap control;
755 if (enabled)
756 control = on ? RB_Checked : (down ? RB_Pressed : RB_Enabled);
757 else
758 control = on ? RB_DisabledChecked : RB_Disabled;
759 painter->drawPixmap(button->rect, d->pixmaps.value(control).pixmap);
760}
761
763 const QWidget *widget) const
764{
765 Q_D(const QPixmapStyle);
766
769
770 if (widget && widget->property("_pixmap_combobox_list").toBool()) {
771 cp = DD_ItemSeparator;
772 cd = DD_ItemSelected;
773 }
774
775 QPixmap pix = d->pixmaps.value(cp).pixmap;
776 QRect rect = option->rect;
777 rect.setBottom(rect.top() + pix.height()-1);
779 if (option->state & QStyle::State_Selected) {
780 rect = option->rect;
781 rect.setTop(rect.top() + pix.height());
783 }
784}
785
787 QPainter *painter, const QWidget *) const
788{
789 bool vertical = false;
790 if (const QStyleOptionProgressBar *pb =
791 qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
792 vertical = !(pb->state & QStyle::State_Horizontal);
793 }
795}
796
798 QPainter *painter, const QWidget *) const
799{
800 if (const QStyleOptionProgressBar *pb =
801 qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
802 const bool vertical = !(pb->state & QStyle::State_Horizontal);
803 if (!vertical) {
805 proxy()->drawItemText(painter, pb->rect,
806 Qt::AlignCenter | Qt::TextSingleLine, pb->palette,
807 pb->state & State_Enabled, pb->text, textRole);
808 }
809 }
810}
811
813 QPainter *painter, const QWidget *) const
814{
816 qstyleoption_cast<const QStyleOptionProgressBar*>(option);
817 const bool vertical = !(pbar->state & QStyle::State_Horizontal);
818 const bool flip = (pbar->direction == Qt::RightToLeft) ^ pbar->invertedAppearance;
819
820 if (pbar->progress == pbar->maximum) {
822
823 } else {
824 if (pbar->progress == pbar->minimum)
825 return;
826 const auto totalSteps = qint64(pbar->maximum) - pbar->minimum;
827 const auto progressSteps = qint64(pbar->progress) - pbar->minimum;
828 const auto availablePixels = vertical ? option->rect.height() : option->rect.width();
829 const auto pixelsPerStep = double(availablePixels) / totalSteps;
830
831 const auto progress = static_cast<int>(progressSteps * pixelsPerStep); // width in pixels
832
833 QRect optRect = option->rect;
834 if (vertical) {
835 if (flip)
836 optRect.setBottom(optRect.top()+progress-1);
837 else
838 optRect.setTop(optRect.bottom()-progress+1);
839 } else {
840 if (flip)
841 optRect.setLeft(optRect.right()-progress+1);
842 else
843 optRect.setRight(optRect.left()+progress-1);
844 }
845
846 drawCachedPixmap(vertical ? PB_VContent : PB_HContent, optRect, painter);
847 }
848}
849
851 QPainter *painter, const QWidget *widget) const
852{
853#if QT_CONFIG(slider)
854 Q_D(const QPixmapStyle);
855
856 const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option);
857 if (!slider)
858 return;
859
860 const bool enabled = option->state & State_Enabled;
861 const bool pressed = option->state & State_Sunken;
862 const Qt::Orientation orient = slider->orientation;
863
865 if (option->subControls & SC_SliderGroove) {
867 if (groove.isValid()) {
868 // Draw the background
869 ControlDescriptor control;
870 if (orient == Qt::Horizontal)
871 control = enabled ? SG_HEnabled : SG_HDisabled;
872 else
873 control = enabled ? SG_VEnabled : SG_VDisabled;
874 drawCachedPixmap(control, groove, painter);
875
876 // Draw the active part
877 if (orient == Qt::Horizontal) {
878 control = enabled ? (pressed ? SG_HActivePressed : SG_HActiveEnabled )
880 } else {
881 control = enabled ? (pressed ? SG_VActivePressed : SG_VActiveEnabled )
883 }
884 const QPixmapStyleDescriptor &desc = d->descriptors.value(control);
885 const QPixmap pix = d->getCachedPixmap(control, desc, groove.size());
886 if (!pix.isNull()) {
887 groove.setRight(orient == Qt::Horizontal
888 ? handle.center().x() : handle.center().y());
889 painter->drawPixmap(groove, pix, groove);
890 }
891 }
892 }
893 if (option->subControls & SC_SliderHandle) {
894 if (handle.isValid()) {
896 if (orient == Qt::Horizontal)
897 pix = enabled ? (pressed ? SH_HPressed : SH_HEnabled) : SH_HDisabled;
898 else
899 pix = enabled ? (pressed ? SH_VPressed : SH_VEnabled) : SH_VDisabled;
900 painter->drawPixmap(handle, d->pixmaps.value(pix).pixmap);
901 }
902 }
903#else
907#endif // QT_CONFIG(slider)
908}
909
911 QPainter *painter, const QWidget *widget) const
912{
913 Q_D(const QPixmapStyle);
914
915 const bool enabled = option->state & State_Enabled;
916 const bool pressed = widget->property("_pixmapstyle_combobox_pressed").toBool();
917 const bool opened = option->state & State_On;
918
919 ControlDescriptor control =
921 drawCachedPixmap(control, option->rect, painter);
922
923 ControlPixmap cp = enabled ? (opened ? DD_ArrowOpen
924 : (pressed ? DD_ArrowPressed : DD_ArrowEnabled))
926 QPixmapStylePixmap pix = d->pixmaps.value(cp);
928 painter->drawPixmap(rect, pix.pixmap);
929}
930
932 QPainter *painter, const QWidget *widget) const
933{
934#if QT_CONFIG(slider)
935 if (const QStyleOptionSlider *slider =
936 qstyleoption_cast<const QStyleOptionSlider*>(option)) {
937 // Do not draw the scrollbar
938 if (slider->minimum == slider->maximum)
939 return;
940
942 ControlDescriptor control = slider->orientation == Qt::Horizontal
944 drawCachedPixmap(control, rect, painter);
945 }
946#else
950#endif // QT_CONFIG(slider)
951}
952
954 const QSize &contentsSize,
955 const QWidget *widget) const
956{
957 Q_D(const QPixmapStyle);
958
959 const QPixmapStyleDescriptor &desc = d->descriptors.value(PB_Enabled);
960 const int bm = proxy()->pixelMetric(PM_ButtonMargin, option, widget);
961
962 int w = contentsSize.width();
963 int h = contentsSize.height();
964 w += desc.margins.left() + desc.margins.right() + bm;
965 h += desc.margins.top() + desc.margins.bottom() + bm;
966
967 return d->computeSize(desc, w, h);
968}
969
971 const QSize &contentsSize, const QWidget *) const
972{
973 Q_D(const QPixmapStyle);
974
975 const QPixmapStyleDescriptor &desc = d->descriptors.value(LE_Enabled);
977
978 int w = contentsSize.width() + border + desc.margins.left() + desc.margins.right();
979 int h = contentsSize.height() + border + desc.margins.top() + desc.margins.bottom();
980
981 return d->computeSize(desc, w, h);
982}
983
985 const QSize &contentsSize,
986 const QWidget *widget) const
987{
988 Q_D(const QPixmapStyle);
989
990 bool vertical = false;
991 if (const QStyleOptionProgressBar *pb =
992 qstyleoption_cast<const QStyleOptionProgressBar *>(option)) {
993 vertical = !(pb->state & QStyle::State_Horizontal);
994 }
996 if (vertical) {
997 const QPixmapStyleDescriptor desc = d->descriptors.value(PB_VBackground);
998 return QSize(desc.size.height(), result.height());
999 } else {
1000 const QPixmapStyleDescriptor desc = d->descriptors.value(PB_HBackground);
1001 return QSize(result.width(), desc.size.height());
1002 }
1003}
1004
1006 const QSize &contentsSize,
1007 const QWidget *widget) const
1008{
1009#if QT_CONFIG(slider)
1010 Q_D(const QPixmapStyle);
1011
1012 const QStyleOptionSlider *slider = qstyleoption_cast<const QStyleOptionSlider*>(option);
1013 if (!slider)
1014 return QSize();
1015
1017
1018 const QPixmapStyleDescriptor desc = d->descriptors.value(slider->orientation == Qt::Horizontal
1020
1021 if (slider->orientation == Qt::Horizontal)
1022 return QSize(result.width(), desc.size.height());
1023 else
1024 return QSize(desc.size.width(), result.height());
1025#else // QT_CONFIG(slider)
1027 Q_UNUSED(contentsSize);
1029 return QSize();
1030#endif // QT_CONFIG(slider)
1031}
1032
1034 const QSize &contentsSize,
1035 const QWidget *widget) const
1036{
1037 Q_D(const QPixmapStyle);
1038
1039 const QPixmapStyleDescriptor &desc = d->descriptors.value(DD_ButtonEnabled);
1040
1042 return d->computeSize(desc, result.width(), result.height());
1043}
1044
1046 const QSize &contentsSize,
1047 const QWidget *widget) const
1048{
1049 Q_D(const QPixmapStyle);
1050
1052
1055 if (widget && widget->property("_pixmap_combobox_list").toBool()) {
1056 cp = DD_ItemSeparator;
1057 cd = DD_ItemSelected;
1058 }
1059
1060 const QPixmapStyleDescriptor &desc = d->descriptors.value(cd);
1061 const QPixmapStylePixmap &pix = d->pixmaps.value(cp);
1062 size.setHeight(qMax(size.height(),
1063 desc.size.height() + pix.pixmap.height()));
1064 return size;
1065}
1066
1068 QStyle::SubControl sc, const QWidget *) const
1069{
1070 Q_D(const QPixmapStyle);
1071
1072 QRect r = option->rect; // Default size
1073 const QPixmapStylePixmap &pix = d->pixmaps.value(DD_ArrowEnabled);
1074 const QPixmapStyleDescriptor &desc = d->descriptors.value(DD_ButtonEnabled);
1075
1076 switch (sc) {
1077 case SC_ComboBoxArrow:
1078 r.setRect(r.right() - pix.margins.right() - pix.pixmap.width(),
1079 r.top() + pix.margins.top(),
1080 pix.pixmap.width(), pix.pixmap.height());
1081 break;
1083 r.adjust(desc.margins.left(), desc.margins.right(),
1084 -desc.margins.right(), -desc.margins.bottom());
1085 r.setRight(r.right() - pix.margins.right() - pix.margins.left() - pix.pixmap.width());
1086 break;
1087 default:
1088 break;
1089 }
1090
1091 r = visualRect(option->direction, option->rect, r);
1092 return r;
1093}
1094
1096 QStyle::SubControl sc, const QWidget *) const
1097{
1098#if QT_CONFIG(slider)
1099 if (const QStyleOptionSlider *slider =
1100 qstyleoption_cast<const QStyleOptionSlider*>(option)) {
1101 int length = (slider->orientation == Qt::Horizontal)
1102 ? slider->rect.width() : slider->rect.height();
1103 int page = length * slider->pageStep
1104 / (slider->maximum - slider->minimum + slider->pageStep);
1105 int pos = length * slider->sliderValue
1106 / (slider->maximum - slider->minimum + slider->pageStep);
1107 pos = qMin(pos+page, length) - page;
1108
1109 QRect rect = slider->rect;
1110
1111 if (slider->orientation == Qt::Horizontal) {
1112 switch (sc) {
1115 return rect;
1117 rect.setRight(pos);
1118 return rect;
1119 case SC_ScrollBarGroove:
1120 return rect;
1121 case SC_ScrollBarSlider:
1122 rect.setLeft(pos);
1123 rect.setRight(pos+page);
1124 return rect;
1125 default: ;
1126 }
1127 } else {
1128 switch (sc) {
1130 rect.setTop(pos+page);
1131 return rect;
1133 rect.setBottom(pos);
1134 return rect;
1135 case SC_ScrollBarGroove:
1136 return rect;
1137 case SC_ScrollBarSlider:
1138 rect.setTop(pos);
1139 rect.setBottom(pos+page);
1140 return rect;
1141 default: ;
1142 }
1143 }
1144 }
1145#else
1147 Q_UNUSED(sc);
1148#endif // QT_CONFIG(slider)
1149 return QRect();
1150}
1151
1153{
1154 QPixmap result(w, h);
1155 {
1156 const QColor transparent(0, 0, 0, 0);
1157 result.fill( transparent );
1158 QPainter p( &result );
1159 const QMargins margins = desc.margins;
1160 qDrawBorderPixmap(&p, result.rect(), margins, pixmap,
1161 pixmap.rect(), margins, desc.tileRules);
1162 }
1163 return result;
1164}
1165
1167 const QPixmapStyleDescriptor &desc,
1168 const QSize &size) const
1169{
1170 Q_Q(const QPixmapStyle);
1171
1172 const QString sizeString = QString::number(size.width()) % u'*'
1173 % QString::number(size.height());
1174 const QString key = QLatin1StringView(q->metaObject()->className()) % QString::number(control)
1175 % u'@' % sizeString;
1176
1178
1179 if (!QPixmapCache::find( key, &result)) {
1180 QPixmap source(desc.fileName);
1181 result = scale(size.width(), size.height(), source, desc);
1183 }
1184 return result;
1185}
1186
1188{
1189 if (desc.tileRules.horizontal != Qt::RepeatTile)
1190 width = qMax(width, desc.size.width());
1191 if (desc.tileRules.vertical != Qt::RepeatTile)
1192 height = qMax(height, desc.size.height());
1193 return QSize(width, height);
1194}
1195
1197
1198#include "moc_qpixmapstyle_p.cpp"
The QAbstractItemView class provides the basic functionality for item view classes.
The QApplication class manages the GUI application's control flow and main settings.
\inmodule QtGui
Definition qbrush.h:30
The QColor class provides colors based on RGB, HSV or CMYK values.
Definition qcolor.h:31
The QComboBox widget combines a button with a dropdown list.
Definition qcombobox.h:24
The QCommonStyle class encapsulates the common Look and Feel of a GUI.
int pixelMetric(PixelMetric m, const QStyleOption *opt=nullptr, const QWidget *widget=nullptr) const override
\reimp
QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *widget=nullptr) const override
\reimp
QRect subElementRect(SubElement r, const QStyleOption *opt, const QWidget *widget=nullptr) const override
\reimp
void unpolish(QWidget *widget) override
\reimp
void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const override
\reimp
SubControl hitTestComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, const QPoint &pt, const QWidget *w=nullptr) const override
\reimp
int styleHint(StyleHint sh, const QStyleOption *opt=nullptr, const QWidget *w=nullptr, QStyleHintReturn *shret=nullptr) const override
\reimp
void polish(QPalette &) override
\reimp
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *w=nullptr) const override
\reimp
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *opt, QPainter *p, const QWidget *w=nullptr) const override
\reimp
void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w=nullptr) const override
\reimp
\inmodule QtCore
Definition qcoreevent.h:45
@ MouseMove
Definition qcoreevent.h:63
@ MouseButtonPress
Definition qcoreevent.h:60
@ MouseButtonRelease
Definition qcoreevent.h:61
\reentrant
Definition qfont.h:22
void setPixelSize(int)
Sets the font size to pixelSize pixels, with a maxiumum size of an unsigned 16-bit integer.
Definition qfont.cpp:1049
The QFrame class is the base class of widgets that can have a frame.
Definition qframe.h:17
\inmodule QtGui
Definition qimage.h:37
\inmodule QtCore
Definition qmargins.h:24
\inmodule QtCore
Definition qobject.h:103
void installEventFilter(QObject *filterObj)
Installs an event filter filterObj on this object.
Definition qobject.cpp:2339
virtual bool eventFilter(QObject *watched, QEvent *event)
Filters events if this object has been installed as an event filter for the watched object.
Definition qobject.cpp:1555
void removeEventFilter(QObject *obj)
Removes an event filter object obj from this object.
Definition qobject.cpp:2370
QVariant property(const char *name) const
Returns the value of the object's name property.
Definition qobject.cpp:4323
bool setProperty(const char *name, const QVariant &value)
Sets the value of the object's name property to value.
The QPainter class performs low-level painting on widgets and other paint devices.
Definition qpainter.h:46
void drawPixmap(const QRectF &targetRect, const QPixmap &pixmap, const QRectF &sourceRect)
Draws the rectangular portion source of the given pixmap into the given target in the paint device.
The QPalette class contains color groups for each widget state.
Definition qpalette.h:19
void setBrush(ColorRole cr, const QBrush &brush)
Sets the brush for the given color role to the specified brush for all groups in the palette.
Definition qpalette.h:151
@ Inactive
Definition qpalette.h:49
@ Disabled
Definition qpalette.h:49
@ AlternateBase
Definition qpalette.h:55
@ ButtonText
Definition qpalette.h:52
static bool find(const QString &key, QPixmap *pixmap)
Looks for a cached pixmap associated with the given key in the cache.
static bool insert(const QString &key, const QPixmap &pixmap)
Inserts a copy of the pixmap pixmap associated with the key into the cache.
QPixmap getCachedPixmap(QPixmapStyle::ControlDescriptor control, const QPixmapStyleDescriptor &desc, const QSize &size) const
QSize computeSize(const QPixmapStyleDescriptor &desc, int width, int height) const
static QPixmap scale(int w, int h, const QPixmap &pixmap, const QPixmapStyleDescriptor &desc)
The QPixmapStyle class provides mechanism for writing pixmap based styles.
void drawTextEdit(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *option, SubControl sc, const QWidget *widget=nullptr) const override
\reimp
void drawSlider(const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
int styleHint(StyleHint hint, const QStyleOption *option, const QWidget *widget, QStyleHintReturn *returnData) const override
\reimp
void drawPushButton(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
void drawLineEdit(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
QRect subElementRect(SubElement element, const QStyleOption *option, const QWidget *widget=nullptr) const override
\reimp
int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const override
\reimp
void drawCheckBox(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
void drawControl(ControlElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=nullptr) const override
\reimp
void copyPixmap(ControlPixmap source, ControlPixmap dest)
void drawPanelItemViewItem(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
void drawProgressBarBackground(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
QSize itemViewSizeFromContents(const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
QSize progressBarSizeFromContents(const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
void polish(QApplication *application) override
\reimp
bool eventFilter(QObject *watched, QEvent *event) override
\reimp
QSize lineEditSizeFromContents(const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
void drawScrollBar(const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
QRect comboBoxSubControlRect(const QStyleOptionComplex *option, QPixmapStyle::SubControl sc, const QWidget *widget) const
void copyDescriptor(ControlDescriptor source, ControlDescriptor dest)
Copies the data associated with the source descriptor to the dest descriptor.
void drawProgressBarLabel(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
void drawRadioButton(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
QRect scrollBarSubControlRect(const QStyleOptionComplex *option, QPixmapStyle::SubControl sc, const QWidget *widget) const
void addPixmap(ControlPixmap control, const QString &fileName, QMargins margins=QMargins())
Use this function to style statically sized controls such as check boxes.
void unpolish(QApplication *application) override
\reimp
void drawComplexControl(ComplexControl cc, const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget=nullptr) const override
\reimp
void addDescriptor(ControlDescriptor control, const QString &fileName, QMargins margins=QMargins(), QTileRules tileRules=QTileRules(Qt::RepeatTile, Qt::RepeatTile))
Associates the pixmap having the given fileName with the given control.
void drawPrimitive(PrimitiveElement element, const QStyleOption *option, QPainter *painter, const QWidget *widget=nullptr) const override
\reimp
~QPixmapStyle()
Destroys the QPixmapStyle object.
QSize sliderSizeFromContents(const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
SubControl hitTestComplexControl(ComplexControl control, const QStyleOptionComplex *option, const QPoint &pos, const QWidget *widget) const override
\reimp
void drawComboBox(const QStyleOptionComplex *option, QPainter *painter, const QWidget *widget) const
QSize sizeFromContents(ContentsType type, const QStyleOption *option, const QSize &contentsSize, const QWidget *widget=nullptr) const override
\reimp
void drawCachedPixmap(ControlDescriptor control, const QRect &rect, QPainter *p) const
Draws the image associated with the current control on the given rect using the given painter.
QSize pushButtonSizeFromContents(const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
void drawProgressBarFill(const QStyleOption *option, QPainter *painter, const QWidget *widget) const
QSize comboBoxSizeFromContents(const QStyleOption *option, const QSize &contentsSize, const QWidget *widget) const
Returns a copy of the pixmap that is transformed using the given transformation transform and transfo...
Definition qpixmap.h:27
int height() const
Returns the height of the pixmap.
Definition qpixmap.cpp:480
bool isNull() const
Returns true if this is a null pixmap; otherwise returns false.
Definition qpixmap.cpp:456
int width() const
Returns the width of the pixmap.
Definition qpixmap.cpp:468
constexpr qreal y() const noexcept
Returns the y coordinate of this point.
Definition qpoint.h:348
\inmodule QtCore\reentrant
Definition qpoint.h:25
The QProgressBar widget provides a horizontal or vertical progress bar.
int minimum
the progress bar's minimum value
int maximum
the progress bar's maximum value
bool invertedAppearance
whether or not a progress bar shows its progress inverted
\inmodule QtCore\reentrant
Definition qrect.h:30
constexpr void adjust(int x1, int y1, int x2, int y2) noexcept
Adds dx1, dy1, dx2 and dy2 respectively to the existing coordinates of the rectangle.
Definition qrect.h:373
constexpr int top() const noexcept
Returns the y-coordinate of the rectangle's top edge.
Definition qrect.h:176
constexpr void setBottom(int pos) noexcept
Sets the bottom edge of the rectangle to the given y coordinate.
Definition qrect.h:200
constexpr void setLeft(int pos) noexcept
Sets the left edge of the rectangle to the given x coordinate.
Definition qrect.h:191
constexpr int width() const noexcept
Returns the width of the rectangle.
Definition qrect.h:236
constexpr void moveTop(int pos) noexcept
Moves the rectangle vertically, leaving the rectangle's top edge at the given y coordinate.
Definition qrect.h:289
static void ungrabGesture(QObject *target)
Ungrabs the gesture for the target.
static Qt::GestureType grabGesture(QObject *target, ScrollerGestureType gestureType=TouchGesture)
Registers a custom scroll gesture recognizer, grabs it for the target and returns the resulting gestu...
@ LeftMouseButtonGesture
Definition qscroller.h:45
\inmodule QtCore
Definition qsize.h:25
constexpr int height() const noexcept
Returns the height.
Definition qsize.h:133
constexpr int width() const noexcept
Returns the width.
Definition qsize.h:130
The QSlider widget provides a vertical or horizontal slider.
Definition qslider.h:18
\macro QT_RESTRICTED_CAST_FROM_ASCII
Definition qstring.h:129
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qstring.cpp:8084
\variable QStyleOptionGraphicsItem::exposedRect
\variable QStyleOptionHeaderV2::textElideMode
\variable QStyleOptionMenuItem::menuItemType
\variable QStyleOptionButton::features
The QStyleOption class stores the parameters used by QStyle functions.
@ State_Sunken
Definition qstyle.h:69
@ State_HasFocus
Definition qstyle.h:75
@ State_Enabled
Definition qstyle.h:67
@ State_Horizontal
Definition qstyle.h:74
@ State_On
Definition qstyle.h:72
@ State_Selected
Definition qstyle.h:82
ContentsType
This enum describes the available contents types.
Definition qstyle.h:546
@ CT_ProgressBar
Definition qstyle.h:553
@ CT_ItemViewItem
Definition qstyle.h:569
@ CT_PushButton
Definition qstyle.h:547
@ CT_LineEdit
Definition qstyle.h:561
@ CT_Slider
Definition qstyle.h:559
@ CT_ComboBox
Definition qstyle.h:551
virtual QPalette standardPalette() const
Returns the style's standard palette.
Definition qstyle.cpp:2301
virtual QRect subControlRect(ComplexControl cc, const QStyleOptionComplex *opt, SubControl sc, const QWidget *widget=nullptr) const =0
Returns the rectangle containing the specified subControl of the given complex control (with the styl...
StyleHint
This enum describes the available style hints.
Definition qstyle.h:584
@ SH_ComboBox_Popup
Definition qstyle.h:610
@ SH_EtchDisabledText
Definition qstyle.h:585
ControlElement
This enum represents a control element.
Definition qstyle.h:170
@ CE_ProgressBarLabel
Definition qstyle.h:188
@ CE_ShapedFrame
Definition qstyle.h:232
@ CE_ProgressBarContents
Definition qstyle.h:187
@ CE_ProgressBarGroove
Definition qstyle.h:186
static QRect visualRect(Qt::LayoutDirection direction, const QRect &boundingRect, const QRect &logicalRect)
Returns the given logicalRectangle converted to screen coordinates based on the specified direction.
Definition qstyle.cpp:2143
PixelMetric
This enum describes the various available pixel metrics.
Definition qstyle.h:413
@ PM_ScrollBarExtent
Definition qstyle.h:426
@ PM_ExclusiveIndicatorHeight
Definition qstyle.h:465
@ PM_DefaultFrameWidth
Definition qstyle.h:420
@ PM_ButtonShiftHorizontal
Definition qstyle.h:417
@ PM_IndicatorWidth
Definition qstyle.h:462
@ PM_CheckBoxLabelSpacing
Definition qstyle.h:502
@ PM_ButtonShiftVertical
Definition qstyle.h:418
@ PM_IndicatorHeight
Definition qstyle.h:463
@ PM_SliderControlThickness
Definition qstyle.h:430
@ PM_ButtonMargin
Definition qstyle.h:414
@ PM_SliderThickness
Definition qstyle.h:429
@ PM_SliderLength
Definition qstyle.h:431
@ PM_RadioButtonLabelSpacing
Definition qstyle.h:511
@ PM_ExclusiveIndicatorWidth
Definition qstyle.h:464
@ PM_ScrollBarSliderMin
Definition qstyle.h:427
ComplexControl
This enum describes the available complex controls.
Definition qstyle.h:331
@ CC_ComboBox
Definition qstyle.h:333
@ CC_Slider
Definition qstyle.h:335
@ CC_ScrollBar
Definition qstyle.h:334
PrimitiveElement
This enum describes the various primitive elements.
Definition qstyle.h:102
@ PE_FrameLineEdit
Definition qstyle.h:108
@ PE_PanelLineEdit
Definition qstyle.h:122
@ PE_PanelButtonCommand
Definition qstyle.h:117
@ PE_IndicatorCheckBox
Definition qstyle.h:131
@ PE_Frame
Definition qstyle.h:103
@ PE_PanelButtonBevel
Definition qstyle.h:118
@ PE_IndicatorRadioButton
Definition qstyle.h:136
@ PE_FrameDefaultButton
Definition qstyle.h:104
@ PE_FrameFocusRect
Definition qstyle.h:106
@ PE_PanelItemViewItem
Definition qstyle.h:153
virtual int pixelMetric(PixelMetric metric, const QStyleOption *option=nullptr, const QWidget *widget=nullptr) const =0
Returns the value of the given pixel metric.
virtual void drawItemText(QPainter *painter, const QRect &rect, int flags, const QPalette &pal, bool enabled, const QString &text, QPalette::ColorRole textRole=QPalette::NoRole) const
Draws the given text in the specified rectangle using the provided painter and palette.
Definition qstyle.cpp:574
SubElement
This enum represents a sub-area of a widget.
Definition qstyle.h:242
@ SE_LineEditContents
Definition qstyle.h:281
const QStyle * proxy() const
Definition qstyle.cpp:2400
SubControl
This enum describes the available sub controls.
Definition qstyle.h:347
@ SC_ScrollBarSubLine
Definition qstyle.h:351
@ SC_SliderGroove
Definition qstyle.h:369
@ SC_ScrollBarAddPage
Definition qstyle.h:352
@ SC_ScrollBarAddLine
Definition qstyle.h:350
@ SC_ScrollBarGroove
Definition qstyle.h:357
@ SC_ScrollBarSlider
Definition qstyle.h:356
@ SC_ScrollBarSubPage
Definition qstyle.h:353
@ SC_ComboBoxEditField
Definition qstyle.h:365
@ SC_ComboBoxArrow
Definition qstyle.h:366
@ SC_SliderHandle
Definition qstyle.h:370
The QStyledItemDelegate class provides display and editing facilities for data items from a model.
bool toBool() const
Returns the variant as a bool if the variant has userType() Bool.
The QWidget class is the base class of all user interface objects.
Definition qwidget.h:99
void setAttribute(Qt::WidgetAttribute, bool on=true)
Sets the attribute attribute on this widget if on is true; otherwise clears the attribute.
void setGeometry(int x, int y, int w, int h)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition qwidget.h:886
void setContentsMargins(int left, int top, int right, int bottom)
Sets the margins around the contents of the widget to have the sizes left, top, right,...
Definition qwidget.cpp:7590
QPointF mapToGlobal(const QPointF &) const
Translates the widget coordinate pos to global screen coordinates.
QRect geometry
the geometry of the widget relative to its parent and excluding the window frame
Definition qwidget.h:106
void setPalette(const QPalette &)
Definition qwidget.cpp:4530
QPalette palette
the widget's palette
Definition qwidget.h:132
QRect rect
the internal geometry of the widget excluding any window frame
Definition qwidget.h:116
QWidget * parentWidget() const
Returns the parent of this widget, or \nullptr if it does not have any parent widget.
Definition qwidget.h:904
QOpenGLWidget * widget
[1]
QPushButton * button
[2]
rect
[4]
QPixmap pix
Combined button and popup list for selecting options.
@ AlignCenter
Definition qnamespace.h:163
@ WA_TranslucentBackground
Definition qnamespace.h:402
@ WA_OpaquePaintEvent
Definition qnamespace.h:287
@ RightToLeft
Orientation
Definition qnamespace.h:98
@ Horizontal
Definition qnamespace.h:99
@ TextSingleLine
Definition qnamespace.h:170
@ RepeatTile
Definition qnamespace.h:135
@ transparent
Definition qnamespace.h:47
@ NoBrush
Definition image.cpp:4
Q_CORE_EXPORT int qstrcmp(const char *str1, const char *str2)
Q_WIDGETS_EXPORT void qDrawBorderPixmap(QPainter *painter, const QRect &targetRect, const QMargins &targetMargins, const QPixmap &pixmap, const QRect &sourceRect, const QMargins &sourceMargins, const QTileRules &rules=QTileRules(), QDrawBorderPixmap::DrawingHints hints=QDrawBorderPixmap::DrawingHints())
constexpr const T & qMin(const T &a, const T &b)
Definition qminmax.h:40
constexpr const T & qMax(const T &a, const T &b)
Definition qminmax.h:42
GLuint64 GLenum void * handle
GLuint64 key
GLfloat GLfloat GLfloat w
[0]
GLint GLsizei GLsizei height
GLenum GLuint GLintptr GLsizeiptr size
[1]
GLboolean r
[2]
GLenum GLuint GLenum GLsizei length
GLint GLenum GLsizei GLsizei GLsizei GLint border
GLenum GLenum GLsizei const GLuint GLboolean enabled
GLint GLsizei width
GLenum type
GLfloat GLfloat GLfloat GLfloat h
GLsizei GLsizei GLchar * source
struct _cl_event * event
GLdouble GLdouble GLdouble GLdouble q
Definition qopenglext.h:259
GLuint64EXT * result
[6]
GLfloat GLfloat p
[1]
GLuint GLenum option
GLenum GLenum GLenum GLenum GLenum scale
#define Q_ASSERT(cond)
Definition qrandom.cpp:47
SSL_CTX int(* cb)(SSL *ssl, unsigned char **out, unsigned char *outlen, const unsigned char *in, unsigned int inlen, void *arg)
static QT_BEGIN_NAMESPACE QVariant hint(QPlatformIntegration::StyleHint h)
#define QT_CONFIG(feature)
#define Q_UNUSED(x)
long long qint64
Definition qtypes.h:60
QWidget * qobject_cast< QWidget * >(QObject *o)
Definition qwidget.h:786
QList< int > list
[14]
QByteArray page
[45]
widget render & pixmap
QPainter painter(this)
[7]
QFrame frame
[0]
QProgressBar pbar(...)
QQuickView * view
[0]
The QTileRules class provides the rules used to draw a pixmap or image split into nine segments.
Definition qdrawutil.h:88