Index: gtk2/common/common.h =================================================================== --- gtk2/common/common.h +++ gtk2/common/common.h @@ -705,6 +705,7 @@ Strings noMenuStripeApps; // for completeness: bool onlyTicksInMenu; + bool buttonStyleMenuSections; } Options; void qtcSetupGradient(Gradient *grad, EGradientBorder border, int numStops, ...); Index: gtk2/common/config_file.cpp =================================================================== --- gtk2/common/config_file.cpp +++ gtk2/common/config_file.cpp @@ -1355,6 +1355,7 @@ CFG_READ_BOOL(colorSliderMouseOver); CFG_READ_BOOL(menuIcons); CFG_READ_BOOL(onlyTicksInMenu); + CFG_READ_BOOL(buttonStyleMenuSections); CFG_READ_BOOL(forceAlternateLvCols); CFG_READ_BOOL(invertBotTab); CFG_READ_INT_BOOL(menubarHiding, HIDE_KEYBOARD); @@ -1711,8 +1712,10 @@ opts->menuIcons=true; #ifdef __APPLE__ opts->onlyTicksInMenu=true; + opts->buttonStyleMenuSections=false; #else opts->onlyTicksInMenu=false; + opts->buttonStyleMenuSections=true; #endif opts->forceAlternateLvCols=false; opts->invertBotTab=true; Index: qt4/common/common.h =================================================================== --- qt4/common/common.h +++ qt4/common/common.h @@ -894,6 +894,7 @@ Strings currentNonnativeMenubarApps; #endif bool onlyTicksInMenu; + bool buttonStyleMenuSections; } Options; void qtcSetupGradient(Gradient *grad, EGradientBorder border, int numStops, ...); Index: qt4/common/config_file.cpp =================================================================== --- qt4/common/config_file.cpp +++ qt4/common/config_file.cpp @@ -1278,6 +1278,7 @@ CFG_READ_BOOL(colorSliderMouseOver); CFG_READ_BOOL(menuIcons); CFG_READ_BOOL(onlyTicksInMenu); + CFG_READ_BOOL(buttonStyleMenuSections); CFG_READ_BOOL(forceAlternateLvCols); CFG_READ_BOOL(invertBotTab); CFG_READ_INT_BOOL(menubarHiding, HIDE_KEYBOARD); @@ -1560,8 +1561,10 @@ opts->menuIcons=true; #ifdef Q_OS_MAC opts->onlyTicksInMenu=true; + opts->buttonStyleMenuSections=false; #else opts->onlyTicksInMenu=false; + opts->buttonStyleMenuSections=true; #endif opts->forceAlternateLvCols=false; opts->invertBotTab=true; @@ -2290,6 +2293,7 @@ CFG_WRITE_ENTRY(colorSliderMouseOver); CFG_WRITE_ENTRY(menuIcons); CFG_WRITE_ENTRY(onlyTicksInMenu); + CFG_WRITE_ENTRY(buttonStyleMenuSections); CFG_WRITE_ENTRY(forceAlternateLvCols); CFG_WRITE_ENTRY_NUM(square); CFG_WRITE_ENTRY(invertBotTab); Index: qt4/config/qtcurveconfig.cpp =================================================================== --- qt4/config/qtcurveconfig.cpp +++ qt4/config/qtcurveconfig.cpp @@ -1134,6 +1134,7 @@ connect(fadeLines, SIGNAL(toggled(bool)), SLOT(updateChanged())); connect(menuIcons, SIGNAL(toggled(bool)), SLOT(updateChanged())); connect(onlyTicksInMenu, SIGNAL(toggled(bool)), SLOT(updateChanged())); + connect(buttonStyleMenuSections, SIGNAL(toggled(bool)), SLOT(updateChanged())); connect(stdBtnSizes, SIGNAL(toggled(bool)), SLOT(updateChanged())); connect(forceAlternateLvCols, SIGNAL(toggled(bool)), SLOT(updateChanged())); connect(titlebarAlignment, SIGNAL(currentIndexChanged(int)), SLOT(updateChanged())); @@ -3097,6 +3098,7 @@ opts.fadeLines=fadeLines->isChecked(); opts.menuIcons=menuIcons->isChecked(); opts.onlyTicksInMenu=onlyTicksInMenu->isChecked(); + opts.buttonStyleMenuSections=buttonStyleMenuSections->isChecked(); opts.stdBtnSizes=stdBtnSizes->isChecked(); opts.boldProgress=boldProgress->isChecked(); opts.coloredTbarMo=coloredTbarMo->isChecked(); @@ -3351,6 +3353,7 @@ fadeLines->setChecked(opts.fadeLines); menuIcons->setChecked(opts.menuIcons); onlyTicksInMenu->setChecked(opts.onlyTicksInMenu); + buttonStyleMenuSections->setChecked(opts.buttonStyleMenuSections); stdBtnSizes->setChecked(opts.stdBtnSizes); boldProgress->setChecked(opts.boldProgress); boldProgress_false->setChecked(!opts.boldProgress); Index: qt4/config/qtcurveconfigbase.ui =================================================================== --- qt4/config/qtcurveconfigbase.ui +++ qt4/config/qtcurveconfigbase.ui @@ -3170,14 +3170,14 @@ - + Shade background by: - + <p>Defines the amount by which the popup menu background will be lightened (or darkened). @@ -3187,14 +3187,14 @@ - + Background appearance: - + @@ -3212,21 +3212,21 @@ - + <p>Defines background gradient orientation. - + Background image: - + @@ -3245,14 +3245,14 @@ - + Sub-menu delay: - + <p>Defines the delay before a sub-menu appears. @@ -3265,21 +3265,21 @@ - + Stripe: - + <p>Defines the coloration of the menu-stripe that will be drawn on the left of popup menus - but only if this option is not set to 'none'. - + false @@ -3295,7 +3295,7 @@ - + false @@ -3305,14 +3305,14 @@ - + Border popupmenus: - + <p>If enabled, the whole popup menu will have a border, otherwise no border will be drawn. This option should be enabled unless you have also enabled shadows in your window manager. @@ -3322,20 +3322,33 @@ - + Use menubar colour settings: - + Enabled + + + + <html><head/><body><p>When enabled, menu section titles look a bit like buttons.</p><p>When disabled, they are left-aligned under a separator line and use a bold, underlined typeface.</p></body></html> + + + Use button-like menu section headers + + + true + + + Index: qt4/style/qtcurve.cpp =================================================================== --- qt4/style/qtcurve.cpp +++ qt4/style/qtcurve.cpp @@ -6132,17 +6132,47 @@ if(!menuItem->text.isEmpty()) { - QStyleOption opt; - opt.rect = r.adjusted(2, 2, -3, -2); - opt.state=State_Raised|State_Enabled|State_Horizontal; - drawLightBevel(painter, opt.rect, &opt, widget, ROUNDED_ALL, getFill(&opt, use), use, true, WIDGET_NO_ETCH_BTN); - + int textAlignment; QFont font(menuItem->font); - - font.setBold(true); - painter->setFont(font); - drawItemTextWithRole(painter, r, Qt::AlignHCenter | Qt::AlignVCenter, - palette, state&State_Enabled, menuItem->text, QPalette::Text); + QRect textRect; + if (opts.buttonStyleMenuSections) { + QStyleOption opt; + opt.rect = r.adjusted(2, 2, -3, -2); + opt.state = State_Raised | State_Enabled | State_Horizontal; + drawLightBevel(painter, opt.rect, &opt, widget, ROUNDED_ALL, + getFill(&opt, use), use, true, + WIDGET_NO_ETCH_BTN); + + font.setBold(true); + painter->setFont(font); + textAlignment = Qt::AlignHCenter | Qt::AlignVCenter; + textRect = r; + } else { + font.setBold(true); + font.setUnderline(true); +#ifdef Q_OS_MACOS + if (QGuiApplication::platformName() == QLatin1String("cocoa")) { + font.setLetterSpacing(QFont::PercentageSpacing, 95); + } +#endif + painter->setFont(font); + QRect miRect(menuItem->rect.left() + 5 + + (!reverse && doStripe ? stripeWidth : 0), + menuItem->rect.center().y() - painter->fontMetrics().ascent() / 2 - 5, + menuItem->rect.width() - + (9 + (doStripe ? stripeWidth : 0)), 1); + QColor lineCol = use[MENU_SEP_SHADE]; + if (miRect.y() >= rx.height() / 2) { + drawFadedLine(painter, miRect, lineCol, reverse, + !reverse, true); + } + textAlignment = Qt::AlignLeft | Qt::AlignBottom; + textRect = r.adjusted(5, 5, -5, -5); + } + drawItemTextWithRole(painter, textRect, + textAlignment, + palette, state & State_Enabled, + menuItem->text, QPalette::Text); } else { @@ -9529,7 +9559,15 @@ int maxpmw = mi->maxIconWidth, tabSpacing = 20; - if (mi->text.contains(QLatin1Char('\t'))) + if (!opts.buttonStyleMenuSections && QStyleOptionMenuItem::Separator == mi->menuItemType && !mi->text.isEmpty()) + { + QFont fontBold = mi->font; + fontBold.setBold(true); + QFontMetrics fmBold(fontBold); + // _set_ w, it will have been initialised to something inappropriately small + w = fmBold.width(mi->text); + } + else if (mi->text.contains(QLatin1Char('\t'))) w += tabSpacing; else if (mi->menuItemType == QStyleOptionMenuItem::SubMenu) w += 2 * windowsArrowHMargin; @@ -9544,8 +9582,16 @@ w += fmBold.width(mi->text) - fm.width(mi->text); } - int checkcol = qMax(maxpmw, windowsCheckMarkWidth); // Windows always shows a check column - w += checkcol + windowsRightBorder + 10; + if (QStyleOptionMenuItem::Separator != mi->menuItemType || opts.buttonStyleMenuSections) + { + int checkcol = qMax(maxpmw, windowsCheckMarkWidth); // Windows always shows a check column + w += checkcol + windowsRightBorder; + } + else + { + w += 5; + } + w += 10; newSize.setWidth(w); // .... Index: qt5/common/common.h =================================================================== --- qt5/common/common.h +++ qt5/common/common.h @@ -891,6 +891,7 @@ QFont tickFont; QString menuTick; int fontTickWidth; + bool buttonStyleMenuSections; } Options; void qtcSetupGradient(Gradient *grad, EGradientBorder border, int numStops, ...); Index: qt5/common/config_file.cpp =================================================================== --- qt5/common/config_file.cpp +++ qt5/common/config_file.cpp @@ -1284,6 +1284,7 @@ CFG_READ_BOOL(colorSliderMouseOver); CFG_READ_BOOL(menuIcons); CFG_READ_BOOL(onlyTicksInMenu); + CFG_READ_BOOL(buttonStyleMenuSections); CFG_READ_BOOL(forceAlternateLvCols); CFG_READ_BOOL(invertBotTab); CFG_READ_INT_BOOL(menubarHiding, HIDE_KEYBOARD); @@ -1629,8 +1630,10 @@ opts->titlebarButtonAppearance=APPEARANCE_GRADIENT; #ifdef Q_OS_MACOS opts->onlyTicksInMenu=true; + opts->buttonStyleMenuSections=false; #else opts->onlyTicksInMenu=false; + opts->buttonStyleMenuSections=true; #endif /* Read system config file... */ @@ -2302,6 +2305,7 @@ CFG_WRITE_ENTRY(colorSliderMouseOver); CFG_WRITE_ENTRY(menuIcons); CFG_WRITE_ENTRY(onlyTicksInMenu); + CFG_WRITE_ENTRY(buttonStyleMenuSections); CFG_WRITE_ENTRY(forceAlternateLvCols); CFG_WRITE_ENTRY_NUM(square); CFG_WRITE_ENTRY(invertBotTab); Index: qt5/config/qtcurveconfig.cpp =================================================================== --- qt5/config/qtcurveconfig.cpp +++ qt5/config/qtcurveconfig.cpp @@ -1036,7 +1036,7 @@ dwtTextAsPerTitleBar, dwtEffectAsPerTitleBar, dwtRoundTopOnly, smallRadio, gtkComboMenus, mapKdeIcons, colorMenubarMouseOver, useHighlightForMenu, gbLabel_bold, gbLabel_centred, fadeLines, - menuIcons, onlyTicksInMenu, stdBtnSizes, forceAlternateLvCols, boldProgress, + menuIcons, onlyTicksInMenu, buttonStyleMenuSections, stdBtnSizes, forceAlternateLvCols, boldProgress, coloredTbarMo, borderSelection, squareEntry, squareLvSelection, squareScrollViews, squareFrame, squareTabFrame, squareSlider, squareScrollbarSlider, squareWindows, squareTooltips, @@ -3061,6 +3061,7 @@ opts.fadeLines=fadeLines->isChecked(); opts.menuIcons=menuIcons->isChecked(); opts.onlyTicksInMenu=onlyTicksInMenu->isChecked(); + opts.buttonStyleMenuSections=buttonStyleMenuSections->isChecked(); opts.stdBtnSizes=stdBtnSizes->isChecked(); opts.boldProgress=boldProgress->isChecked(); opts.coloredTbarMo=coloredTbarMo->isChecked(); @@ -3318,6 +3319,7 @@ fadeLines->setChecked(opts.fadeLines); menuIcons->setChecked(opts.menuIcons); onlyTicksInMenu->setChecked(opts.onlyTicksInMenu); + buttonStyleMenuSections->setChecked(opts.buttonStyleMenuSections); stdBtnSizes->setChecked(opts.stdBtnSizes); boldProgress->setChecked(opts.boldProgress); boldProgress_false->setChecked(!opts.boldProgress); @@ -3699,6 +3701,7 @@ fadeLines->isChecked()!=opts.fadeLines || menuIcons->isChecked()!=opts.menuIcons || onlyTicksInMenu->isChecked()!=opts.onlyTicksInMenu || + buttonStyleMenuSections->isChecked()!=opts.buttonStyleMenuSections || stdBtnSizes->isChecked()!=opts.stdBtnSizes || boldProgress->isChecked()!=opts.boldProgress || coloredTbarMo->isChecked()!=opts.coloredTbarMo || Index: qt5/config/qtcurveconfigbase.ui =================================================================== --- qt5/config/qtcurveconfigbase.ui +++ qt5/config/qtcurveconfigbase.ui @@ -3234,14 +3234,14 @@ - + Shade background by: - + <p>Defines the amount by which the popup menu background will be lightened (or darkened). @@ -3251,14 +3251,14 @@ - + Background appearance: - + @@ -3276,21 +3276,21 @@ - + <p>Defines background gradient orientation. - + Background image: - + @@ -3309,14 +3309,14 @@ - + Sub-menu delay: - + <p>Defines the delay before a sub-menu appears. @@ -3329,21 +3329,21 @@ - + Stripe: - + <p>Defines the coloration of the menu-stripe that will be drawn on the left of popup menus - but only if this option is not set to 'none'. - + false @@ -3359,7 +3359,7 @@ - + false @@ -3369,14 +3369,14 @@ - + Border popupmenus: - + <p>If enabled, the whole popup menu will have a border, otherwise no border will be drawn. This option should be enabled unless you have also enabled shadows in your window manager. @@ -3386,20 +3386,33 @@ - + Use menubar colour settings: - + Enabled + + + + <html><head/><body><p>When enabled, menu section titles look a bit like buttons.</p><p>When disabled, they are left-aligned under a separator line and use a bold, underlined typeface.</p></body></html> + + + Use button-like menu section headers + + + true + + + @@ -4487,15 +4500,15 @@ qPixmapFromMimeSource - KColorButton - QPushButton -
kcolorbutton.h
-
- KLineEdit QLineEdit
klineedit.h
+ + KColorButton + QPushButton +
kcolorbutton.h
+
stackList Index: qt5/style/qtcurve_api.cpp =================================================================== --- qt5/style/qtcurve_api.cpp +++ qt5/style/qtcurve_api.cpp @@ -3043,19 +3043,45 @@ opts.menuStripeAppearance, WIDGET_OTHER); if (!menuItem->text.isEmpty()) { - QStyleOption opt; - opt.rect = r.adjusted(2, 2, -3, -2); - opt.state = State_Raised | State_Enabled | State_Horizontal; - drawLightBevel(painter, opt.rect, &opt, widget, ROUNDED_ALL, - getFill(&opt, use), use, true, - WIDGET_NO_ETCH_BTN); - + int textAlignment; QFont font(menuItem->font); - - font.setBold(true); - painter->setFont(font); - drawItemTextWithRole(painter, r, - Qt::AlignHCenter | Qt::AlignVCenter, + QRect textRect; + if (opts.buttonStyleMenuSections) { + QStyleOption opt; + opt.rect = r.adjusted(2, 2, -3, -2); + opt.state = State_Raised | State_Enabled | State_Horizontal; + drawLightBevel(painter, opt.rect, &opt, widget, ROUNDED_ALL, + getFill(&opt, use), use, true, + WIDGET_NO_ETCH_BTN); + + font.setBold(true); + painter->setFont(font); + textAlignment = Qt::AlignHCenter | Qt::AlignVCenter; + textRect = r; + } else { + font.setBold(true); + font.setUnderline(true); +#ifdef Q_OS_MACOS + if (QGuiApplication::platformName() == QLatin1String("cocoa")) { + font.setLetterSpacing(QFont::PercentageSpacing, 95); + } +#endif + painter->setFont(font); + QRect miRect(menuItem->rect.left() + 5 + + (!reverse && doStripe ? stripeWidth : 0), + menuItem->rect.center().y() - painter->fontMetrics().ascent() / 2 - 5, + menuItem->rect.width() - + (9 + (doStripe ? stripeWidth : 0)), 1); + QColor lineCol = use[MENU_SEP_SHADE]; + if (miRect.y() >= rx.height() / 2) { + drawFadedLine(painter, miRect, lineCol, reverse, + !reverse, true); + } + textAlignment = Qt::AlignLeft | Qt::AlignBottom; + textRect = r.adjusted(5, 5, -5, -5); + } + drawItemTextWithRole(painter, textRect, + textAlignment, palette, state & State_Enabled, menuItem->text, QPalette::Text); } else { @@ -6287,7 +6313,15 @@ int maxpmw = mi->maxIconWidth, tabSpacing = 20; - if (mi->text.contains(QLatin1Char('\t'))) + if (!opts.buttonStyleMenuSections && QStyleOptionMenuItem::Separator == mi->menuItemType && !mi->text.isEmpty()) + { + QFont fontBold = mi->font; + fontBold.setBold(true); + QFontMetrics fmBold(fontBold); + // _set_ w, it will have been initialised to something inappropriately small + w = fmBold.width(mi->text); + } + else if (mi->text.contains(QLatin1Char('\t'))) w += tabSpacing; else if (mi->menuItemType == QStyleOptionMenuItem::SubMenu) w += 2 * windowsArrowHMargin; @@ -6302,8 +6336,16 @@ w += fmBold.width(mi->text) - fm.width(mi->text); } - int checkcol = qMax(maxpmw, windowsCheckMarkWidth); // Windows always shows a check column - w += checkcol + windowsRightBorder + 10; + if (QStyleOptionMenuItem::Separator != mi->menuItemType || opts.buttonStyleMenuSections) + { + int checkcol = qMax(maxpmw, windowsCheckMarkWidth); // Windows always shows a check column + w += checkcol + windowsRightBorder; + } + else + { + w += 5; + } + w += 10; newSize.setWidth(w); // ....