[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: KDE/kdelibs/kdeui/kernel
From: Maks Orlovich <maksim () kde ! org>
Date: 2008-05-30 20:21:33
Message-ID: 1212178893.176978.11383.nullmailer () svn ! kde ! org
[Download RAW message or body]
SVN commit 814598 by orlovich:
Add support for drawing inline arrows, like Qt4.4 does.
CCBUG:151697
M +17 -0 kstyle.cpp
M +15 -2 kstyle.h
--- trunk/KDE/kdelibs/kdeui/kernel/kstyle.cpp #814597:814598
@@ -2987,6 +2987,21 @@
tOpt.rect = menuRect;
tOpt.state = mflags;
drawPrimitive(PE_IndicatorButtonDropDown, &tOpt, p, w);
+ } else if (tool->features & QStyleOptionToolButton::HasMenu) {
+ // This is requesting KDE3-style arrow indicator, per Qt 4.4 \
behavior. Qt 4.3 prefers to hide + // the fact of the menu's \
existence. Whee! Since we don't know how to paint this right, + // \
though, we have to have some metrics set for it to look nice. + \
int size = widgetLayoutProp(WT_ToolButton, ToolButton::InlineMenuIndicatorSize, opt, \
w); +
+ if (size) {
+ int xOff = widgetLayoutProp(WT_ToolButton, \
ToolButton::InlineMenuIndicatorXOff, opt, w); + int yOff = \
widgetLayoutProp(WT_ToolButton, ToolButton::InlineMenuIndicatorYOff, opt, w); +
+ QRect r = QRect(buttonRect.right() + xOff, \
buttonRect.bottom() + yOff, size, size); + tOpt.rect = r;
+ tOpt.state = bflags;
+ drawPrimitive(PE_IndicatorButtonDropDown, &tOpt, p, w);
+ }
}
if (flags & State_HasFocus) {
@@ -3649,6 +3664,8 @@
if (const QStyleOptionToolButton* tbOpt = qstyleoption_cast<const \
QStyleOptionToolButton*>(option)) {
if (tbOpt->features & QStyleOptionToolButton::MenuButtonPopup)
menuAreaWidth = pixelMetric(QStyle::PM_MenuButtonIndicator, \
option, widget); + else if (tbOpt->features & \
QStyleOptionToolButton::HasMenu) + size.setWidth(size.width() + \
widgetLayoutProp(WT_ToolButton, ToolButton::InlineMenuIndicatorSize, tbOpt, widget)); \
}
size.setWidth(size.width() - menuAreaWidth);
--- trunk/KDE/kdelibs/kdeui/kernel/kstyle.h #814597:814598
@@ -1312,6 +1312,11 @@
/**
* @brief Describes widgets like QToolButton (usually inside a QToolBar).
+ * The drawing of ToolButton's is much like that of PushButtons; however, in \
some cases the widget is configured + * to not have a separate arrow area, but to \
incorporate the area inside the button itself. To handle this mode, + * set \
InlineMenuIndicatorSize to the size of the arrow, + * and the \
InlineMenuIndicatorXOff, and InlineMenuIndicatorYOff to offset from the bottom-right \
corner to place that + * rectangle. If InlineMenuIndicatorSize isn't set, the \
arrow won't be drawn.
*
* @sa WT_ToolButton
*/
@@ -1327,9 +1332,17 @@
FocusMargin = ContentsMargin + MarginInc,
/**< (\b 3) Where the focus rect will be drawn, \
measured
* from the widget sides */
- MenuIndicatorSize, /** < (\b 11) Size for the separate menu arrows on \
tool buttons + MenuIndicatorSize, /**< (\b 11) Size for the separate menu \
arrows on tool buttons
* [sets QStyle::PM_MenuButtonIndicator wheen a \
toolbutton option is passed in] */
- DummyProp = FocusMargin + MarginInc
+ InlineMenuIndicatorSize = FocusMargin + MarginInc, /**< (\b 0) Size of \
arrow when it's incorporated into + \
* the button directly. If it's 0, it will not be drawn + \
* @since 4.1 */ + InlineMenuIndicatorXOff, /**< Horizontal offset off the \
bottom-right corner to place the arrow + * if \
it's incorporated directly, and not in a separate area + \
* @since 4.1 */ + InlineMenuIndicatorYOff /**< Vertical offset off the \
bottom-right corner to place the arrow + * if \
it's incorporated directly, and not in a separate area + \
* @since 4.1 */ };
/**
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic