KDEUI
Go to the documentation of this file.
22 #include <QStyleOptionFrame>
27 class KArrowButtonPrivate
46 return QSize( 12, 12 );
64 const unsigned int arrowSize = 8;
65 const unsigned int margin = 2;
67 QStyleOptionFrame opt;
72 p.fillRect( rect(), palette().brush( QPalette::Background ) );
74 style()->drawPrimitive( QStyle::PE_Frame, &opt, &p,
this);
76 if (d->arrow == Qt::NoArrow)
79 if (
static_cast<unsigned int>(width()) < arrowSize + margin ||
80 static_cast<unsigned int>(height()) < arrowSize + margin)
83 unsigned int x = 0, y = 0;
84 if (d->arrow == Qt::DownArrow) {
85 x = (width() - arrowSize) / 2;
86 y = height() - (arrowSize + margin);
87 }
else if (d->arrow == Qt::UpArrow) {
88 x = (width() - arrowSize) / 2;
90 }
else if (d->arrow == Qt::RightArrow) {
91 x = width() - (arrowSize + margin);
92 y = (height() - arrowSize) / 2;
95 y = (height() - arrowSize) / 2;
103 QStyle::PrimitiveElement e = QStyle::PE_IndicatorArrowLeft;
106 case Qt::LeftArrow: e = QStyle::PE_IndicatorArrowLeft;
break;
107 case Qt::RightArrow: e = QStyle::PE_IndicatorArrowRight;
break;
108 case Qt::UpArrow: e = QStyle::PE_IndicatorArrowUp;
break;
109 case Qt::DownArrow: e = QStyle::PE_IndicatorArrowDown;
break;
110 case Qt::NoArrow: assert( 0 );
break;
113 opt.state |= QStyle::State_Enabled;
114 opt.rect = QRect( x, y, arrowSize, arrowSize);
116 style()->drawPrimitive( e, &opt, &p,
this );
119 #include "karrowbutton.moc"
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Thu Jan 30 2020 00:00:00 by
doxygen 1.8.17 written
by
Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.