diff options
author | Timothy Pearson <[email protected]> | 2012-10-31 12:39:27 -0500 |
---|---|---|
committer | Timothy Pearson <[email protected]> | 2012-10-31 12:39:27 -0500 |
commit | a5ced706e9295f4f3c1e95c829750dff0d808935 (patch) | |
tree | cd1851fcfaa1639c8ab9fc3b8ee166b13a745257 | |
parent | 69429dcfc35d449c78b346bdce536f17d926c755 (diff) | |
download | qt3-a5ced706e9295f4f3c1e95c829750dff0d808935.tar.gz qt3-a5ced706e9295f4f3c1e95c829750dff0d808935.zip |
Add new style hints for enhanced third party style compatibility
-rw-r--r-- | src/kernel/qstyle.h | 8 | ||||
-rw-r--r-- | src/styles/qcompactstyle.cpp | 51 | ||||
-rw-r--r-- | src/styles/qcompactstyle.h | 2 | ||||
-rw-r--r-- | src/styles/qmotifplusstyle.cpp | 44 | ||||
-rw-r--r-- | src/styles/qmotifstyle.cpp | 60 | ||||
-rw-r--r-- | src/styles/qsgistyle.cpp | 66 | ||||
-rw-r--r-- | src/styles/qsgistyle.h | 2 | ||||
-rw-r--r-- | src/styles/qwindowsstyle.cpp | 43 |
8 files changed, 243 insertions, 33 deletions
diff --git a/src/kernel/qstyle.h b/src/kernel/qstyle.h index 5731f8f..341473e 100644 --- a/src/kernel/qstyle.h +++ b/src/kernel/qstyle.h @@ -835,6 +835,11 @@ public: PM_MenuBarItemSpacing, PM_ToolBarItemSpacing, + PM_MenuIndicatorFrameHBorder, + PM_MenuIndicatorFrameVBorder, + PM_MenuIconIndicatorFrameHBorder, + PM_MenuIconIndicatorFrameVBorder, + PM_ArrowSize, // do not add any values below/greater than this @@ -1036,6 +1041,9 @@ public: // bool - hide underlined accelerators uless Alt key is currently down SH_HideUnderlineAcceleratorWhenAltUp, + // int - width of menu check column + SH_MenuIndicatorColumnWidth, + // do not add any values below/greater than this SH_CustomBase = 0xf0000000 }; diff --git a/src/styles/qcompactstyle.cpp b/src/styles/qcompactstyle.cpp index 5b83f0e..63c5be5 100644 --- a/src/styles/qcompactstyle.cpp +++ b/src/styles/qcompactstyle.cpp @@ -67,6 +67,12 @@ int QCompactStyle::pixelMetric( PixelMetric metric, QStyleControlElementData ceD case PM_MaximumDragDistance: ret = -1; break; + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + ret = 0; + break; default: ret = QWindowsStyle::pixelMetric( metric, ceData, elementFlags, widget ); break; @@ -189,7 +195,7 @@ void QCompactStyle::drawControl( ControlElement element, QPainter *p, QStyleCont return; if ( mi->isChecked() ) { - drawPrimitive( PE_MenuItemIndicatorFrame, p, ceData, elementFlags, QRect(x, y, checkcol, h), itemg, flags, opt ); + drawPrimitive( PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, itemg, flags, opt ); } else if ( !act ) { p->fillRect(x, y, checkcol , h, g.brush( QColorGroup::Button )); @@ -208,7 +214,7 @@ void QCompactStyle::drawControl( ControlElement element, QPainter *p, QStyleCont int pixh = pixmap.height(); if ( act && !dis ) { if ( !mi->isChecked() ) - drawPrimitive( PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, QRect(x, y, checkcol, h), itemg, flags, opt ); + drawPrimitive( PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, itemg, flags, opt ); } QRect cr( x, y, checkcol, h ); QRect pmr( 0, 0, pixw, pixh ); @@ -221,7 +227,7 @@ void QCompactStyle::drawControl( ControlElement element, QPainter *p, QStyleCont p->fillRect( x+checkcol + 1, y, w - checkcol - 1, h, fill); } else if ( checkable ) { // just "checking"... if ( mi->isChecked() ) { - drawPrimitive( PE_MenuItemIndicatorCheck, p, ceData, elementFlags, QRect(x, y, checkcol, h), itemg, flags, opt ); + drawPrimitive( PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, itemg, flags, opt ); } } @@ -322,21 +328,27 @@ void QCompactStyle::drawPrimitive( PrimitiveElement pe, switch (pe) { case PE_MenuItemIndicatorFrame: { + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + if ( act && !dis ) { - qDrawShadePanel( p, x, y, w, h, cg, TRUE, 1, &cg.brush( QColorGroup::Button ) ); + qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( QColorGroup::Button ) ); } else { - qDrawShadePanel( p, x, y, w, h, cg, TRUE, 1, &cg.brush( QColorGroup::Midlight ) ); + qDrawShadePanel( p, x, y, checkcol, h, cg, TRUE, 1, &cg.brush( QColorGroup::Midlight ) ); } } break; case PE_MenuItemIndicatorIconFrame: { - qDrawShadePanel( p, x, y, w, h, cg, FALSE, 1, &cg.brush( QColorGroup::Button ) ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + qDrawShadePanel( p, x, y, checkcol, h, cg, FALSE, 1, &cg.brush( QColorGroup::Button ) ); } break; case PE_MenuItemIndicatorCheck: { - int mw = w + motifItemFrame; + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + int mw = checkcol + motifItemFrame; int mh = h - 2*motifItemFrame; SFlags cflags = Style_Default; @@ -355,4 +367,29 @@ void QCompactStyle::drawPrimitive( PrimitiveElement pe, } } +/*! \reimp */ +int QCompactStyle::styleHint(StyleHint sh, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QStyleOption &opt, QStyleHintReturn *returnData, const QWidget *w) const +{ + int ret; + + switch (sh) { + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = (elementFlags & CEF_IsCheckable); + + if ( checkable ) + maxpmw = QMAX( maxpmw, 8 ); // space for the checkmarks + + ret = maxpmw; + } + break; + default: + ret = QWindowsStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w); + break; + } + + return ret; +} + #endif diff --git a/src/styles/qcompactstyle.h b/src/styles/qcompactstyle.h index 3b209cf..6002055 100644 --- a/src/styles/qcompactstyle.h +++ b/src/styles/qcompactstyle.h @@ -72,6 +72,8 @@ public: void drawControl( ControlElement element, QPainter *p, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QRect &r, const QColorGroup &cg, SFlags how = Style_Default, const QStyleOption& = QStyleOption::Default, const QWidget *w = 0 ); + int styleHint(StyleHint sh, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QStyleOption &, QStyleHintReturn *, const QWidget *) const; + private: // Disabled copy constructor and operator= #if defined(Q_DISABLE_COPY) QCompactStyle( const QCompactStyle & ); diff --git a/src/styles/qmotifplusstyle.cpp b/src/styles/qmotifplusstyle.cpp index 86db691..113716c 100644 --- a/src/styles/qmotifplusstyle.cpp +++ b/src/styles/qmotifplusstyle.cpp @@ -263,6 +263,13 @@ int QMotifPlusStyle::pixelMetric(PixelMetric metric, QStyleControlElementData ce ret = 11; break; + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + ret = 2; + break; + default: ret = QMotifStyle::pixelMetric(metric, ceData, elementFlags, widget); break; @@ -647,11 +654,30 @@ void QMotifPlusStyle::drawPrimitive( PrimitiveElement pe, break; } + case PE_MenuItemIndicatorFrame: + { + // Draw nothing + break; + } + case PE_MenuItemIndicatorIconFrame: + { + int x, y, w, h; + r.rect(&x, &y, &w, &h); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + QRect vrect = visualRect( QRect( x+2, y+2, checkcol, h-2 ), r ); + + qDrawShadePanel( p, vrect.x(), y+2, checkcol, h-2*2, cg, TRUE, 1, &cg.brush( QColorGroup::Midlight ) ); + break; + } + case PE_MenuItemIndicatorCheck: { int x, y, w, h; r.rect(&x, &y, &w, &h); - QRect vrect = visualRect( QRect( x+2, y+2, w, h-2 ), r ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + QRect vrect = visualRect( QRect( x+2, y+2, checkcol, h-2 ), r ); SFlags cflags = Style_Default; if (! dis) @@ -820,8 +846,7 @@ void QMotifPlusStyle::drawControl( ControlElement element, QRect vrect = visualRect( QRect( x+2, y+2, checkcol, h-2 ), r ); if ( mi->isChecked() ) { if ( mi->iconSet() ) { - qDrawShadePanel( p, vrect.x(), y+2, checkcol, h-2*2, - cg, TRUE, 1, &cg.brush( QColorGroup::Midlight ) ); + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); } } else if ( !act ) { p->fillRect(vrect, @@ -853,7 +878,7 @@ void QMotifPlusStyle::drawControl( ControlElement element, } else if (checkable) { if (mi->isChecked()) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, QRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } @@ -1582,6 +1607,17 @@ int QMotifPlusStyle::styleHint(StyleHint hint, case SH_PopupMenu_MouseTracking: ret = 1; break; + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = (elementFlags & CEF_IsCheckable); + + if (checkable) + maxpmw = QMAX(maxpmw, 15); + + ret = maxpmw; + break; + } default: ret = QMotifStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget); break; diff --git a/src/styles/qmotifstyle.cpp b/src/styles/qmotifstyle.cpp index 422dacb..826cd16 100644 --- a/src/styles/qmotifstyle.cpp +++ b/src/styles/qmotifstyle.cpp @@ -770,22 +770,44 @@ void QMotifStyle::drawPrimitive( PrimitiveElement pe, &cg.brush(QColorGroup::Mid)); break; + case PE_MenuItemIndicatorFrame: + { + // Draw nothing + break; + } + + case PE_MenuItemIndicatorIconFrame: + { + int x, y, w, h; + r.rect( &x, &y, &w, &h ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + QRect vrect = visualRect( QRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r ); + int xvis = vrect.x(); + + qDrawShadePanel( p, xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame, cg, TRUE, 1, &cg.brush( QColorGroup::Midlight ) ); + break; + } + case PE_MenuItemIndicatorCheck: { int x, y, w, h; r.rect( &x, &y, &w, &h ); - QRect vrect = visualRect( QRect( x+motifItemFrame, y+motifItemFrame, w, h-2*motifItemFrame ), r ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + QRect vrect = visualRect( QRect( x+motifItemFrame, y+motifItemFrame, checkcol, h-2*motifItemFrame ), r ); int xvis = vrect.x(); - int mw = w; + int mw = checkcol; int mh = h - 2*motifItemFrame; SFlags cflags = Style_Default; - if (! dis) - cflags |= Style_Enabled; - if (act) - cflags |= Style_On; + if (! dis) + cflags |= Style_Enabled; + if (act) + cflags |= Style_On; - drawPrimitive(PE_CheckMark, p, ceData, elementFlags, QRect(xvis, y+motifItemFrame, mw, mh), cg, cflags); + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, QRect(xvis, y+motifItemFrame, mw, mh), cg, cflags); + break; } default: @@ -1077,8 +1099,7 @@ void QMotifStyle::drawControl( ControlElement element, int xvis = vrect.x(); if ( mi->isChecked() ) { if ( mi->iconSet() ) { - qDrawShadePanel( p, xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame, - cg, TRUE, 1, &cg.brush( QColorGroup::Midlight ) ); + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); } } else if ( !act ) { p->fillRect(xvis, y+motifItemFrame, checkcol, h-2*motifItemFrame, @@ -1104,7 +1125,7 @@ void QMotifStyle::drawControl( ControlElement element, } else if ( checkable ) { // just "checking"... if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, QRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } @@ -1556,6 +1577,13 @@ int QMotifStyle::pixelMetric( PixelMetric metric, QStyleControlElementData ceDat ret = 13; break; + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + ret = motifItemFrame; + break; + default: ret = QCommonStyle::pixelMetric( metric, ceData, elementFlags, widget ); break; @@ -2364,6 +2392,18 @@ int QMotifStyle::styleHint(StyleHint hint, ret = 0; break; + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = (elementFlags & CEF_IsCheckable); + + if ( checkable ) + maxpmw = QMAX( maxpmw, motifCheckMarkSpace ); + + ret = maxpmw; + break; + } + default: ret = QCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget); break; diff --git a/src/styles/qsgistyle.cpp b/src/styles/qsgistyle.cpp index b65100c..eb59d11 100644 --- a/src/styles/qsgistyle.cpp +++ b/src/styles/qsgistyle.cpp @@ -398,6 +398,14 @@ int QSGIStyle::pixelMetric( PixelMetric metric, QStyleControlElementData ceData, case PM_SplitterWidth: return QMAX( 10, QApplication::globalStrut().width() ); + case PM_MenuIndicatorFrameHBorder: + return (sgiItemFrame+2); + case PM_MenuIndicatorFrameVBorder: + return (sgiItemFrame+4); + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + return sgiItemFrame; + default: break; } @@ -881,7 +889,7 @@ void QSGIStyle::drawPrimitive( PrimitiveElement pe, } break; - case PE_MenuItemIndicatorCheck: + case PE_MenuItemIndicatorFrame: { int x, y, w, h; r.rect(&x, &y, &w, &h); @@ -895,6 +903,32 @@ void QSGIStyle::drawPrimitive( PrimitiveElement pe, QRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) ); er.addCoords( 1, 1, -1, -1 ); drawPrimitive( PE_ButtonBevel, p, ceData, elementFlags, er, cg, cflags, opt ); + } + break; + + case PE_MenuItemIndicatorIconFrame: + { + int x, y, w, h; + r.rect(&x, &y, &w, &h); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); + + drawPanel( p, x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame, cg, TRUE, 1, &cg.brush( QColorGroup::Light ) ); + } + break; + + case PE_MenuItemIndicatorCheck: + { + int x, y, w, h; + r.rect(&x, &y, &w, &h); + + SFlags cflags = Style_Default; + if (! dis) + cflags |= Style_Enabled; + if (act) + cflags |= Style_On; + + QRect er( x+sgiItemFrame+1, y+sgiItemFrame+3, pixelMetric(PM_IndicatorWidth, ceData, elementFlags), pixelMetric(PM_IndicatorHeight, ceData, elementFlags) ); + er.addCoords( 1, 1, -1, -1 ); er.addCoords( 0, 1, 1, 1 ); drawPrimitive( PE_CheckMark, p, ceData, elementFlags, er, cg, cflags | Style_On, opt ); } @@ -1012,8 +1046,7 @@ void QSGIStyle::drawControl( ControlElement element, if ( mi->isChecked() ) { if ( mi->iconSet() ) { - drawPanel( p, x+sgiItemFrame, y+sgiItemFrame, checkcol, h-2*sgiItemFrame, - cg, TRUE, 1, &cg.brush( QColorGroup::Light ) ); + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); } } else { if ( !act ) @@ -1041,7 +1074,8 @@ void QSGIStyle::drawControl( ControlElement element, } else { if ( checkable ) { if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, QRect(x, y, w, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } } @@ -1477,4 +1511,28 @@ QRect QSGIStyle::querySubControlMetrics( ComplexControl control, return QMotifStyle::querySubControlMetrics( control, ceData, elementFlags, sub, opt, widget ); } +/*! \reimp */ +int QSGIStyle::styleHint(StyleHint sh, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QStyleOption &opt, QStyleHintReturn *returnData, const QWidget *w) const +{ + int ret; + + switch (sh) { + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = ( elementFlags & CEF_IsCheckable ); + + if ( checkable ) + maxpmw = QMAX( maxpmw, sgiCheckMarkSpace ); + ret = maxpmw; + } + break; + default: + ret = QMotifStyle::styleHint(sh, ceData, elementFlags, opt, returnData, w); + break; + } + + return ret; +} + #endif // QT_NO_STYLE_SGI diff --git a/src/styles/qsgistyle.h b/src/styles/qsgistyle.h index 0afacd6..17bdb05 100644 --- a/src/styles/qsgistyle.h +++ b/src/styles/qsgistyle.h @@ -124,6 +124,8 @@ public: const QStyleOption& = QStyleOption::Default, const QWidget *widget = 0 ) const; + int styleHint(StyleHint sh, QStyleControlElementData ceData, ControlElementFlags elementFlags, const QStyleOption &, QStyleHintReturn *, const QWidget *) const; + bool objectEventHandler( QStyleControlElementData ceData, ControlElementFlags elementFlags, void* source, QEvent *e ); private: diff --git a/src/styles/qwindowsstyle.cpp b/src/styles/qwindowsstyle.cpp index 578b32f..f93e31a 100644 --- a/src/styles/qwindowsstyle.cpp +++ b/src/styles/qwindowsstyle.cpp @@ -575,12 +575,13 @@ void QWindowsStyle::drawPrimitive( PrimitiveElement pe, { int x, y, w, h; r.rect( &x, &y, &w, &h ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - QRect vrect = visualRect( QRect( x, y, w, h ), r ); + QRect vrect = visualRect( QRect( x, y, checkcol, h ), r ); int xvis = vrect.x(); if ( act && !dis ) { - qDrawShadePanel( p, xvis, y, w, h, cg, TRUE, 1, &cg.brush( QColorGroup::Button ) ); + qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &cg.brush( QColorGroup::Button ) ); } else { QBrush fill( cg.light(), Dense4Pattern ); @@ -589,7 +590,7 @@ void QWindowsStyle::drawPrimitive( PrimitiveElement pe, // a consistent look QPoint origin = p->brushOrigin(); p->setBrushOrigin( xvis, y ); - qDrawShadePanel( p, xvis, y, w, h, cg, TRUE, 1, &fill ); + qDrawShadePanel( p, xvis, y, checkcol, h, cg, TRUE, 1, &fill ); // restore the previous brush origin p->setBrushOrigin( origin ); } @@ -600,8 +601,9 @@ void QWindowsStyle::drawPrimitive( PrimitiveElement pe, { int x, y, w, h; r.rect( &x, &y, &w, &h ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); - QRect vrect = visualRect( QRect( x, y, w, h ), r ); + QRect vrect = visualRect( QRect( x, y, checkcol, h ), r ); int xvis = vrect.x(); qDrawShadePanel( p, xvis, y, w, h, cg, FALSE, 1, &cg.brush( QColorGroup::Button ) ); @@ -612,6 +614,7 @@ void QWindowsStyle::drawPrimitive( PrimitiveElement pe, { int x, y, w, h; r.rect( &x, &y, &w, &h ); + int checkcol = styleHint(SH_MenuIndicatorColumnWidth, ceData, elementFlags, opt, NULL, NULL); int xp = x + windowsItemFrame; @@ -621,7 +624,7 @@ void QWindowsStyle::drawPrimitive( PrimitiveElement pe, if (act) cflags |= Style_On; - drawPrimitive(PE_CheckMark, p, ceData, elementFlags, visualRect( QRect(xp, y + windowsItemFrame, w - 2*windowsItemFrame, h - 2*windowsItemFrame), r ), cg, cflags); + drawPrimitive(PE_CheckMark, p, ceData, elementFlags, visualRect( QRect(xp, y + windowsItemFrame, checkcol - 2*windowsItemFrame, h - 2*windowsItemFrame), r ), cg, cflags); } break; @@ -866,7 +869,7 @@ void QWindowsStyle::drawControl( ControlElement element, QRect vrect = visualRect( QRect( xpos, y, checkcol, h ), r ); int xvis = vrect.x(); if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, QRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorFrame, p, ceData, elementFlags, r, cg, flags, opt); } else if (! act) p->fillRect(xvis, y, checkcol , h, cg.brush( QColorGroup::Button )); @@ -882,7 +885,7 @@ void QWindowsStyle::drawControl( ControlElement element, int pixw = pixmap.width(); int pixh = pixmap.height(); if ( act && !dis && !mi->isChecked() ) - drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, QRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorIconFrame, p, ceData, elementFlags, r, cg, flags, opt); QRect pmr( 0, 0, pixw, pixh ); pmr.moveCenter( vrect.center() ); p->setPen( cg.text() ); @@ -895,7 +898,7 @@ void QWindowsStyle::drawControl( ControlElement element, p->fillRect( visualRect( QRect( xp, y, w - checkcol - 1, h ), r ), fill); } else if ( checkable ) { // just "checking"... if ( mi->isChecked() ) { - drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, QRect(x, y, checkcol, h), cg, flags); + drawPrimitive(PE_MenuItemIndicatorCheck, p, ceData, elementFlags, r, cg, flags, opt); } } @@ -1073,6 +1076,13 @@ int QWindowsStyle::pixelMetric(PixelMetric metric, QStyleControlElementData ceDa ret = QMAX( 6, QApplication::globalStrut().width() ); break; + case PM_MenuIndicatorFrameHBorder: + case PM_MenuIndicatorFrameVBorder: + case PM_MenuIconIndicatorFrameHBorder: + case PM_MenuIconIndicatorFrameVBorder: + ret = windowsItemFrame; + break; + default: ret = QCommonStyle::pixelMetric(metric, ceData, elementFlags, widget); break; @@ -1996,6 +2006,23 @@ int QWindowsStyle::styleHint( StyleHint hint, ret = 0; break; + case SH_MenuIndicatorColumnWidth: + { + int maxpmw = opt.maxIconWidth(); + bool checkable = ( elementFlags & CEF_IsCheckable ); + + if ( checkable ) { + // space for the checkmarks + if (use2000style) + maxpmw = QMAX( maxpmw, 20 ); + else + maxpmw = QMAX( maxpmw, 12 ); + } + + ret = maxpmw; + break; + } + default: ret = QCommonStyle::styleHint(hint, ceData, elementFlags, opt, returnData, widget); break; |