From 2771f79232c273bc2a57d23bf335dd81ccf6af28 Mon Sep 17 00:00:00 2001 From: V3n3RiX Date: Sun, 5 Dec 2021 02:47:11 +0000 Subject: gentoo resync : 05.12.2021 --- kde-frameworks/kconfigwidgets/Manifest | 6 +- ...onfigwidgets-5.88.0-KCommandBar-alignment.patch | 494 +++++++++++++++++++++ ....88.0-hamburger-menu-no-window-on-wayland.patch | 87 ++++ .../kconfigwidgets/kconfigwidgets-5.87.0.ebuild | 41 -- .../kconfigwidgets/kconfigwidgets-5.88.0-r1.ebuild | 46 ++ 5 files changed, 631 insertions(+), 43 deletions(-) create mode 100644 kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-KCommandBar-alignment.patch create mode 100644 kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-hamburger-menu-no-window-on-wayland.patch delete mode 100644 kde-frameworks/kconfigwidgets/kconfigwidgets-5.87.0.ebuild create mode 100644 kde-frameworks/kconfigwidgets/kconfigwidgets-5.88.0-r1.ebuild (limited to 'kde-frameworks/kconfigwidgets') diff --git a/kde-frameworks/kconfigwidgets/Manifest b/kde-frameworks/kconfigwidgets/Manifest index 146ae37544b7..f035bf5a95bb 100644 --- a/kde-frameworks/kconfigwidgets/Manifest +++ b/kde-frameworks/kconfigwidgets/Manifest @@ -1,5 +1,7 @@ +AUX kconfigwidgets-5.88.0-KCommandBar-alignment.patch 19750 BLAKE2B f4d2cfeb271238067217b0b45a990c5decd766dd225c9c88ea0976b699c96c2cacb2cde8c336be297902234a22c77d12f3e80cb32f82de3a1a5b3fe0c30809f0 SHA512 40875e9f7b6eeedd5ddfdebade4faca2b8f9a86485a656ef83b3e65b925233c97af3daafa0f41d042451a98a198523117cf5cc10f4c2ec8e209be7ea4734a4ad +AUX kconfigwidgets-5.88.0-hamburger-menu-no-window-on-wayland.patch 3542 BLAKE2B 87448642741508dc6d259500a6539f83f270a9ad473146e76f527d22843149245b296ccaac67bed0b1566b45f97e2e6f77fc19ed8c7698101daf81d7d7fa988a SHA512 6aabfbe4923882d8d3dbd2271120a2a748f8299f4a9ff3a413ff107442319c698f47adc248b548f2fb33ee61313365d346154175e5edab481fb19f5891c92d94 DIST kconfigwidgets-5.85.0.tar.xz 410632 BLAKE2B cbeb31c40a5cd22c5a0ebbb83089387482e1b54571d02a7c7dff8e373ce11bcb9215ce778be45b9deda544e82140080edce6408282af1ecdcad7ef790178b75a SHA512 dddcfd54e36b2c45ab42d5e61811141eff2bb8d2d70a5bd09993e742bee05bf18a3b2e94b2ff8bcf6199db84044542a8d3d01a36f6b29d7d9b33e6c82392ac7b -DIST kconfigwidgets-5.87.0.tar.xz 412048 BLAKE2B 3c92349b901a5b45b0bd616b894e7df88aee4f1ab56bd979b80d6c3c9dbe3a3e862d2c64944663006b5fa7d42282d423eed1e0ca786a6f80f8b133f10800f3ca SHA512 5d35f1f02e2f60d5306170cfb08fd7eeb38ba52837445c133ebd29e593817cfaec57a8b08069abd050bf9c23efdbafd4849956ebc76e38a896d696496eb426a5 +DIST kconfigwidgets-5.88.0.tar.xz 412648 BLAKE2B 45b08f839fea13f848a8c6f0990b0da1fad44c27659d18102fcba9ec407fed7588cafc20d401f9b0253fb26baba484bb901b5ffe310f2e8ad4b666673773968d SHA512 cbc4af1f19509325528cef138746b081552547bbbd5c741dada8d9b58e6d510eb3611867335d94b892d42fa1eb771f0ab4b93c56014cede65bf6769cf10b5a3e EBUILD kconfigwidgets-5.85.0.ebuild 1002 BLAKE2B 958936e17ed05c186735feb4dbcd97eec0efc70b40553b35e08266f1f069becd479ca5a1f1bcd8069c37828d0496fa61446ae3acb98ef8395147d51a87c12b7b SHA512 3f9cbb3a3faeb3a631b2c9c04e7888129c48cea4c1a3363a23926cca00206758cd1ae82dd1bb524d1b6e83128653202208b99a0c57ef5ca6e76f17c99de14525 -EBUILD kconfigwidgets-5.87.0.ebuild 1005 BLAKE2B a182c531ffcef1c1ab83c1e1f7a08154c8567288b946a4c80cc06c06473b3c338afa3710e073204ec1f1a60c9d4dfaf5954f6316bbdd10c31e862ff264fea472 SHA512 6ebf47a55a061c7039a8d52e97158cca9f9076e36f2e08bb8eff91040f8bdeff6de9db8d3958e418dbf0c9c3e62718f390a6d58e8252f4b439d60e0a0b3983e4 +EBUILD kconfigwidgets-5.88.0-r1.ebuild 1128 BLAKE2B e1cace065a0691871f42273d71b82a8f537d9ef874fa925f7ac50a0475dd414855c7cab60fe0d616cadfb20cb90d357b225e8e808050380281f495450fa62eed SHA512 29437815f9368cc622bbb794ae7958ee018f5b4e3e6480fdec7cc8d2a49673644daf4522125342f41f583f6dd1a00f1bcf3cab492c533a676543ac2e6934a3fb MISC metadata.xml 547 BLAKE2B 127ee4110b748cd3e3c26b63248d35f78b233b00cf4466ccc0145a613062a5aa9cc2e9ebd91d0e7482c67f6e265938176b169a9c52eda30bfcddf02549ec8f06 SHA512 2d36585b1af6205dc1bfcff7c3cb24c85376716159317b5c105c866143d49e89e91e501c9a4cf2d63265c30a09e8df71bca841319bd3f2b551e79fde90b1d96e diff --git a/kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-KCommandBar-alignment.patch b/kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-KCommandBar-alignment.patch new file mode 100644 index 000000000000..1ebd8e3dd551 --- /dev/null +++ b/kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-KCommandBar-alignment.patch @@ -0,0 +1,494 @@ +From 34d5352c1f30d92b10667574cb7fcc1cf7e9af66 Mon Sep 17 00:00:00 2001 +From: Eugene Popov +Date: Sat, 6 Nov 2021 18:49:37 +0000 +Subject: [PATCH] [KCommandBar] Dynamic column widths + shortcuts alignment + +--- + src/kcommandbar.cpp | 278 +++++++++++++++++++++---------------- + src/kcommandbarmodel_p.cpp | 17 +-- + src/kcommandbarmodel_p.h | 9 +- + tests/kcommandbartest.cpp | 9 ++ + 4 files changed, 176 insertions(+), 137 deletions(-) + +diff --git a/src/kcommandbar.cpp b/src/kcommandbar.cpp +index 0d17ffa0..4d0987d7 100644 +--- a/src/kcommandbar.cpp ++++ b/src/kcommandbar.cpp +@@ -16,6 +16,7 @@ + #include + #include + #include ++#include + + #include + #include +@@ -147,32 +148,24 @@ public: + + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override + { +- QStyleOptionViewItem options = option; +- initStyleOption(&options, index); +- + painter->save(); + +- // paint background +- if (option.state & QStyle::State_Selected) { +- painter->fillRect(option.rect, option.palette.highlight()); +- } else { +- painter->fillRect(option.rect, option.palette.base()); +- } +- + /** + * Draw everything, (widget, icon etc) except the text + */ +- options.text = QString(); // clear old text +- QStyle *style = options.widget->style(); +- style->drawControl(QStyle::CE_ItemViewItem, &options, painter, options.widget); ++ QStyleOptionViewItem optionCopy = option; ++ initStyleOption(&optionCopy, index); ++ optionCopy.text.clear(); // clear old text ++ QStyle *style = option.widget->style(); ++ style->drawControl(QStyle::CE_ItemViewItem, &optionCopy, painter, option.widget); + +- const int hMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, &options, options.widget); ++ const int hMargin = style->pixelMetric(QStyle::PM_FocusFrameHMargin, &option, option.widget); + + QRect outputRect = option.rect; + + const CommandBarFilterModel *model = static_cast(index.model()); + if (model->hasActionsWithIcons()) { +- const int iconWidth = options.decorationSize.width() + hMargin; ++ const int iconWidth = option.decorationSize.width() + hMargin; + if (option.direction == Qt::RightToLeft) { + outputRect.adjust(0, 0, -iconWidth, 0); + } else { +@@ -198,7 +191,7 @@ public: + } + + QTextCharFormat fmt; +- fmt.setForeground(options.palette.link().color()); ++ fmt.setForeground(option.palette.link().color()); + fmt.setFontWeight(QFont::Bold); + + /** +@@ -206,13 +199,13 @@ public: + */ + const auto fmtRanges = KFuzzyMatcher::matchedRanges(m_filterString, str); + QTextCharFormat f; +- f.setForeground(options.palette.link()); ++ f.setForeground(option.palette.link()); + std::transform(fmtRanges.begin(), fmtRanges.end(), std::back_inserter(formats), [f, actionNameStart](const KFuzzyMatcher::Range &fr) { + return QTextLayout::FormatRange{fr.start + actionNameStart, fr.length, f}; + }); + + outputRect.adjust(hMargin, 0, -hMargin, 0); +- paintItemText(painter, original, outputRect, options, std::move(formats)); ++ paintItemText(painter, original, outputRect, option, std::move(formats)); + + painter->restore(); + } +@@ -240,122 +233,159 @@ public: + return shortcutString.split(QLatin1String(", "), Qt::SkipEmptyParts); + } + ++ // returns the width needed to draw the shortcut ++ static int shortcutDrawingWidth(const QStyleOptionViewItem &option, const QString &shortcut, int hMargin) ++ { ++ int width = 0; ++ if (!shortcut.isEmpty()) { ++ // adapt the shortcut as it will be drawn ++ // "Ctrl+A, Alt+B" => "Ctrl+A+Alt+B" ++ QString adaptedShortcut = shortcut; ++ adaptedShortcut.replace(QStringLiteral(", "), QStringLiteral("+")); ++ ++ width = option.fontMetrics.horizontalAdvance(adaptedShortcut); ++ ++ // count the number of segments ++ // "Ctrl+A+Alt+B" => ["Ctrl", "+", "A", "+", "Alt", "+", "B"] ++ static const QRegularExpression regExp(QStringLiteral("(\\+(?!\\+)|\\+(?=\\+{2}))")); ++ const int segmentsCount = 2 * adaptedShortcut.count(regExp) + 1; ++ ++ // add left and right margins for each segment ++ width += segmentsCount * 2 * hMargin; ++ } ++ ++ return width; ++ } ++ + void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override + { +- QStyleOptionViewItem options = option; +- initStyleOption(&options, index); +- painter->save(); ++ // draw background ++ option.widget->style()->drawPrimitive(QStyle::PE_PanelItemViewItem, &option, painter); + + const QString shortcutString = index.data().toString(); +- +- // paint background +- if (option.state & QStyle::State_Selected) { +- painter->fillRect(option.rect, option.palette.highlight()); +- } else { +- painter->fillRect(option.rect, option.palette.base()); ++ if (shortcutString.isEmpty()) { ++ return; + } + +- options.text = QString(); // clear old text +- options.widget->style()->drawControl(QStyle::CE_ItemViewItem, &options, painter, options.widget); +- +- if (!shortcutString.isEmpty()) { +- /** +- * Shortcut string splitting +- * +- * We do it in two steps +- * 1. Split on ", " so that if we have multi modifier shortcuts they are nicely +- * split into strings. +- * 2. Split each shortcut from step 1 into individual string. +- * +- * Example: +- * +- * "Ctrl+,, Alt+:" +- * Step 1: [ "Ctrl+," , "Alt+:"] +- * Step 2: [ "Ctrl", ",", "Alt", ":"] +- */ +- const QStringList spaceSplitted = splitShortcutString(shortcutString); +- QStringList list; +- list.reserve(spaceSplitted.size() * 2); +- for (const QString &shortcut : spaceSplitted) { +- list += shortcut.split(QLatin1Char('+'), Qt::SkipEmptyParts); +- if (shortcut.endsWith(QLatin1Char('+'))) { +- list.append(QStringLiteral("+")); +- } ++ /** ++ * Shortcut string splitting ++ * ++ * We do it in two steps ++ * 1. Split on ", " so that if we have multi modifier shortcuts they are nicely ++ * split into strings. ++ * 2. Split each shortcut from step 1 into individual string. ++ * ++ * Example: ++ * ++ * "Ctrl+,, Alt+:" ++ * Step 1: [ "Ctrl+," , "Alt+:"] ++ * Step 2: [ "Ctrl", ",", "Alt", ":"] ++ */ ++ const QStringList spaceSplitted = splitShortcutString(shortcutString); ++ QStringList list; ++ list.reserve(spaceSplitted.size() * 2); ++ for (const QString &shortcut : spaceSplitted) { ++ list += shortcut.split(QLatin1Char('+'), Qt::SkipEmptyParts); ++ if (shortcut.endsWith(QLatin1Char('+'))) { ++ list.append(QStringLiteral("+")); + } ++ } + +- /** +- * Create rects for each string from the previous step +- * +- * @todo boundingRect may give issues here, use horizontalAdvance +- * @todo We probably dont need the full rect, just the width so the +- * "btns" vector can just be vector> +- */ +- QVector> btns; +- btns.reserve(list.size()); +- const int height = options.rect.height(); +- for (const QString &text : std::as_const(list)) { +- if (text.isEmpty()) { +- continue; +- } +- QRect r = option.fontMetrics.boundingRect(text); +- // this happens on gnome so we manually decrease the +- // height a bit +- if (r.height() == height) { +- r.setHeight(r.height() - 4); +- } +- r.setWidth(r.width() + 8); +- btns.append({r, text}); ++ /** ++ * Create rects for each string from the previous step ++ * ++ * @todo We probably dont need the full rect, just the width so the ++ * "btns" vector can just be vector> ++ */ ++ QVector> btns; ++ btns.reserve(list.size()); ++ const int height = option.rect.height(); ++ const int hMargin = horizontalMargin(option); ++ for (const QString &text : std::as_const(list)) { ++ if (text.isEmpty()) { ++ continue; + } +- +- // we have nothing, just return +- if (btns.isEmpty()) { +- return; ++ QRect r(0, 0, option.fontMetrics.horizontalAdvance(text), option.fontMetrics.lineSpacing()); ++ // this happens on gnome so we manually decrease the ++ // height a bit ++ if (r.height() == height) { ++ r.setHeight(r.height() - 4); + } ++ r.setWidth(r.width() + 2 * hMargin); ++ btns.append({r, text}); ++ } ++ ++ // we have nothing, just return ++ if (btns.isEmpty()) { ++ return; ++ } ++ ++ const QRect plusRect = option.fontMetrics.boundingRect(QLatin1Char('+')); + +- const QRect plusRect = option.fontMetrics.boundingRect(QLatin1Char('+')); +- +- // draw them +- int x = option.rect.x(); +- const int y = option.rect.y(); +- const int plusY = option.rect.y() + plusRect.height() / 2; +- const int total = btns.size(); +- +- // make sure our rects are nicely V-center aligned in the row +- painter->translate(QPoint(0, (option.rect.height() - btns.at(0).first.height()) / 2)); +- +- int i = 0; +- painter->setRenderHint(QPainter::Antialiasing); +- for (const auto &btn : std::as_const(btns)) { +- painter->setPen(Qt::NoPen); +- const QRect &rect = btn.first; +- +- QRect buttonRect(x, y, rect.width(), rect.height()); +- +- // draw rounded rect shadow +- auto shadowRect = buttonRect.translated(0, 1); +- painter->setBrush(option.palette.shadow()); +- painter->drawRoundedRect(shadowRect, 3.0, 3.0); +- +- // draw rounded rect itself +- painter->setBrush(option.palette.button()); +- painter->drawRoundedRect(buttonRect, 3.0, 3.0); +- +- // draw text inside rounded rect +- painter->setPen(option.palette.buttonText().color()); +- painter->drawText(buttonRect, Qt::AlignCenter, btn.second); +- +- // draw '+' +- if (i + 1 < total) { +- x += rect.width() + 5; +- painter->drawText(QPoint(x, plusY + (rect.height() / 2)), QStringLiteral("+")); +- x += plusRect.width() + 5; +- } +- i++; ++ // draw them ++ int x; ++ if (option.direction == Qt::RightToLeft) { ++ x = option.rect.x() + hMargin; ++ } else { ++ x = option.rect.right() - shortcutDrawingWidth(option, shortcutString, hMargin) - hMargin; ++ } ++ const int y = option.rect.y() + (option.rect.height() - btns.at(0).first.height()) / 2; ++ const int plusY = option.rect.y() + (option.rect.height() - plusRect.height()) / 2; ++ const int total = btns.size(); ++ ++ int i = 0; ++ painter->save(); ++ painter->setRenderHint(QPainter::Antialiasing); ++ for (const auto &btn : std::as_const(btns)) { ++ painter->setPen(Qt::NoPen); ++ const QRect &rect = btn.first; ++ ++ QRect buttonRect(x, y, rect.width(), rect.height()); ++ ++ // draw rounded rect shadow ++ auto shadowRect = buttonRect.translated(0, 1); ++ painter->setBrush(option.palette.shadow()); ++ painter->drawRoundedRect(shadowRect, 3.0, 3.0); ++ ++ // draw rounded rect itself ++ painter->setBrush(option.palette.button()); ++ painter->drawRoundedRect(buttonRect, 3.0, 3.0); ++ ++ // draw text inside rounded rect ++ painter->setPen(option.palette.buttonText().color()); ++ painter->drawText(buttonRect, Qt::AlignCenter, btn.second); ++ ++ // draw '+' ++ if (i + 1 < total) { ++ x += rect.width() + hMargin; ++ painter->drawText(QPoint(x, plusY + (rect.height() / 2)), QStringLiteral("+")); ++ x += plusRect.width() + hMargin; + } ++ i++; + } + + painter->restore(); + } ++ ++ QSize sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const override ++ { ++ if (index.isValid() && index.column() == KCommandBarModel::Column_Shortcut) { ++ QString shortcut = index.data().toString(); ++ if (!shortcut.isEmpty()) { ++ const int hMargin = horizontalMargin(option); ++ const int width = shortcutDrawingWidth(option, shortcut, hMargin) + 2 * hMargin; ++ ++ return QSize(width, 0); ++ } ++ } ++ ++ return QStyledItemDelegate::sizeHint(option, index); ++ } ++ ++ int horizontalMargin(const QStyleOptionViewItem &option) const ++ { ++ return option.widget->style()->pixelMetric(QStyle::PM_FocusFrameHMargin, &option) + 2; ++ } + }; + + // BEGIN KCommandBarPrivate +@@ -410,9 +440,6 @@ void KCommandBarPrivate::updateViewGeometry(KCommandBar *q) + + const QSize viewMaxSize(centralSize.width() / 2.4, centralSize.height() / 2); + +- // First column occupies 60% of the width +- m_treeView.setColumnWidth(0, viewMaxSize.width() * 0.6); +- + // Position should be central over window + const int xPos = std::max(0, (centralSize.width() - viewMaxSize.width()) / 2); + const int yPos = std::max(0, (centralSize.height() - viewMaxSize.height()) * 1 / 4); +@@ -505,8 +532,8 @@ KCommandBar::KCommandBar(QWidget *parent) + + CommandBarStyleDelegate *delegate = new CommandBarStyleDelegate(this); + ShortcutStyleDelegate *del = new ShortcutStyleDelegate(this); +- d->m_treeView.setItemDelegateForColumn(0, delegate); +- d->m_treeView.setItemDelegateForColumn(1, del); ++ d->m_treeView.setItemDelegateForColumn(KCommandBarModel::Column_Command, delegate); ++ d->m_treeView.setItemDelegateForColumn(KCommandBarModel::Column_Shortcut, del); + + connect(&d->m_lineEdit, &QLineEdit::returnPressed, this, [this]() { + d->slotReturnPressed(this); +@@ -525,6 +552,11 @@ KCommandBar::KCommandBar(QWidget *parent) + d->m_treeView.setSortingEnabled(true); + d->m_treeView.setModel(&d->m_proxyModel); + ++ d->m_treeView.header()->setMinimumSectionSize(0); ++ d->m_treeView.header()->setStretchLastSection(false); ++ d->m_treeView.header()->setSectionResizeMode(KCommandBarModel::Column_Command, QHeaderView::Stretch); ++ d->m_treeView.header()->setSectionResizeMode(KCommandBarModel::Column_Shortcut, QHeaderView::ResizeToContents); ++ + d->m_treeView.installEventFilter(this); + d->m_lineEdit.installEventFilter(this); + +diff --git a/src/kcommandbarmodel_p.cpp b/src/kcommandbarmodel_p.cpp +index fee271c5..6a172c9c 100644 +--- a/src/kcommandbarmodel_p.cpp ++++ b/src/kcommandbarmodel_p.cpp +@@ -69,12 +69,9 @@ void KCommandBarModel::refresh(const QVector &actionGr + QVector temp_rows; + std::unordered_set uniqueActions; + temp_rows.reserve(totalActions); +- int actionGroupIdx = 0; + for (const auto &ag : actionGroups) { + const auto &agActions = ag.actions; + fillRows(temp_rows, ag.name, agActions, uniqueActions); +- +- actionGroupIdx++; + } + + /** +@@ -117,22 +114,16 @@ QVariant KCommandBarModel::data(const QModelIndex &index, int role) const + + switch (role) { + case Qt::DisplayRole: +- if (col == 0) { ++ if (col == Column_Command) { + return entry.displayName(); +- } else { +- return entry.action->shortcut().toString(); + } ++ Q_ASSERT(col == Column_Shortcut); ++ return entry.action->shortcut().toString(); + case Qt::DecorationRole: +- if (col == 0) { ++ if (col == Column_Command) { + return entry.action->icon(); + } + break; +- case Qt::TextAlignmentRole: +- if (col == 0) { +- return Qt::AlignLeft; +- } else { +- return Qt::AlignRight; +- } + case Qt::ToolTipRole: { + QString toolTip = entry.displayName(); + if (!entry.action->shortcut().isEmpty()) { +diff --git a/src/kcommandbarmodel_p.h b/src/kcommandbarmodel_p.h +index 29a0249c..af547104 100644 +--- a/src/kcommandbarmodel_p.h ++++ b/src/kcommandbarmodel_p.h +@@ -29,6 +29,13 @@ public: + + enum Role { Score = Qt::UserRole + 1 }; + ++ enum Column ++ { ++ Column_Command, ++ Column_Shortcut, ++ Column_Count ++ }; ++ + /** + * Resets the model + * +@@ -48,7 +55,7 @@ public: + int columnCount(const QModelIndex &parent = QModelIndex()) const override + { + Q_UNUSED(parent); +- return 2; ++ return Column_Count; + } + + /** +diff --git a/tests/kcommandbartest.cpp b/tests/kcommandbartest.cpp +index 46e1bc86..1c631bbb 100644 +--- a/tests/kcommandbartest.cpp ++++ b/tests/kcommandbartest.cpp +@@ -103,6 +103,9 @@ public: + for (; i < 2; ++i) { + acts[1].actions.append(genAction(this, QStringLiteral("folder"), i)); + } ++ acts[1].actions[0]->setShortcut(QStringLiteral("G")); ++ acts[1].actions[1]->setCheckable(true); ++ acts[1].actions[1]->setShortcut(QStringLiteral("Ctrl++")); + + acts[2].name = QStringLiteral("Second Menu Group - Disabled acts"); + for (; i < 4; ++i) { +@@ -116,6 +119,8 @@ public: + for (; i < 6; ++i) { + acts[3].actions.append(genAction(this, QStringLiteral("security-low"), i, Qt::CTRL | Qt::ALT)); + } ++ acts[3].actions[0]->setCheckable(true); ++ acts[3].actions[0]->setShortcut(QStringLiteral("Ctrl+,, Ctrl++, Ctrl+K")); + + return acts; + } +@@ -128,10 +133,14 @@ public: + acts[0].name = QStringLiteral("مینو گروپ"); + acts[0].actions = {new QAction(QIcon::fromTheme("folder"), QStringLiteral("یہ فولڈر ایکشن ہے"), this), + new QAction(QIcon::fromTheme("folder"), QStringLiteral("یہ ایک اور فولڈر ایکشن ہے"), this)}; ++ acts[0].actions[1]->setCheckable(true); ++ acts[0].actions[1]->setShortcut(QStringLiteral("Ctrl+Shift++")); + + acts[1].name = QStringLiteral("گروپ"); + acts[1].actions = {new QAction(QIcon::fromTheme("zoom-out"), QStringLiteral("یہ فولڈر ایکشن ہے"), this), + new QAction(QIcon::fromTheme("security-low"), QStringLiteral("یہ ایک اور فولڈر ایکشن ہے"), this)}; ++ acts[1].actions[1]->setCheckable(true); ++ acts[1].actions[1]->setShortcut(QStringLiteral("Ctrl+-")); + + return acts; + } +-- +GitLab + diff --git a/kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-hamburger-menu-no-window-on-wayland.patch b/kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-hamburger-menu-no-window-on-wayland.patch new file mode 100644 index 000000000000..8cf60aeb7594 --- /dev/null +++ b/kde-frameworks/kconfigwidgets/files/kconfigwidgets-5.88.0-hamburger-menu-no-window-on-wayland.patch @@ -0,0 +1,87 @@ +From 82c40f18709484fd462643aa113a8ccf961b646a Mon Sep 17 00:00:00 2001 +From: Felix Ernst +Date: Tue, 26 Oct 2021 17:28:09 +0200 +Subject: [PATCH] Fix hamburger menu opening as a window on Wayland + +Before this commit, if an app window is unfocused and the first +click on the window is the hamburger menu button, the menu would +appear displaced as a separate window on Wayland. + +This commit fixes this by setting a sane transientParent for the +menu. This is slightly difficult because there can be any number +of hamburger buttons in any number of different windows so we need +to figure out spontaneously which button was pressed to open the +menu. + +BUG: 442375 +--- + src/khamburgermenuhelpers.cpp | 26 ++++++++++++++++++++++++-- + src/khamburgermenuhelpers_p.h | 2 +- + 2 files changed, 25 insertions(+), 3 deletions(-) + +diff --git a/src/khamburgermenuhelpers.cpp b/src/khamburgermenuhelpers.cpp +index 88242aa5..d1ae2835 100644 +--- a/src/khamburgermenuhelpers.cpp ++++ b/src/khamburgermenuhelpers.cpp +@@ -10,7 +10,10 @@ + #include "khamburgermenu.h" + + #include ++#include ++#include + #include ++#include + + ListenerContainer::ListenerContainer(KHamburgerMenuPrivate *hamburgerMenuPrivate) + : QObject{hamburgerMenuPrivate}, +@@ -28,13 +31,32 @@ bool AddOrRemoveActionListener::eventFilter(QObject * /*watched*/, QEvent *event + return false; + } + +-bool ButtonPressListener::eventFilter(QObject * /*watched*/, QEvent *event) ++bool ButtonPressListener::eventFilter(QObject *watched, QEvent *event) + { + if (event->type() == QEvent::KeyPress || event->type() == QEvent::MouseButtonPress) { + auto hamburgerMenuPrivate = static_cast(parent()); + auto q = static_cast(hamburgerMenuPrivate->q_ptr); + Q_EMIT q->aboutToShowMenu(); +- hamburgerMenuPrivate->resetMenu(); ++ hamburgerMenuPrivate->resetMenu(); // This menu never has a parent which can be ++ // problematic because it can lead to situations in which the QMenu itself is ++ // treated like its own window. ++ // To avoid this we set a sane transientParent() now even if it already has one ++ // because the menu might be opened from another window this time. ++ const auto watchedButton = qobject_cast(watched); ++ if (!watchedButton) { ++ return false; ++ } ++ auto menu = watchedButton->menu(); ++ if (!menu) { ++ return false; ++ } ++ menu->winId(); // trigger being a native widget already, to ensure windowHandle created ++ // generic code if not known if the available parent widget is a native widget or not ++ auto parentWindowHandle = watchedButton->windowHandle(); ++ if (!parentWindowHandle) { ++ parentWindowHandle = watchedButton->nativeParentWidget()->windowHandle(); ++ } ++ menu->windowHandle()->setTransientParent(parentWindowHandle); + } + return false; + } +diff --git a/src/khamburgermenuhelpers_p.h b/src/khamburgermenuhelpers_p.h +index f0d98790..4993ee61 100644 +--- a/src/khamburgermenuhelpers_p.h ++++ b/src/khamburgermenuhelpers_p.h +@@ -80,7 +80,7 @@ class ButtonPressListener : public QObject + protected: + inline ButtonPressListener(QObject *parent) : QObject{parent} { }; + +- bool eventFilter(QObject * /*watched*/, QEvent *event) override; ++ bool eventFilter(QObject *watched, QEvent *event) override; + + friend class ListenerContainer; + }; +-- +GitLab + diff --git a/kde-frameworks/kconfigwidgets/kconfigwidgets-5.87.0.ebuild b/kde-frameworks/kconfigwidgets/kconfigwidgets-5.87.0.ebuild deleted file mode 100644 index 50e1c0fc6af5..000000000000 --- a/kde-frameworks/kconfigwidgets/kconfigwidgets-5.87.0.ebuild +++ /dev/null @@ -1,41 +0,0 @@ -# Copyright 1999-2021 Gentoo Authors -# Distributed under the terms of the GNU General Public License v2 - -EAPI=8 - -ECM_DESIGNERPLUGIN="true" -PVCUT=$(ver_cut 1-2) -QTMIN=5.15.2 -VIRTUALX_REQUIRED="test" -inherit ecm kde.org - -DESCRIPTION="Framework providing an assortment of configuration-related widgets" -LICENSE="LGPL-2+" -KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" -IUSE="+man" - -BDEPEND=" - man? ( >=kde-frameworks/kdoctools-${PVCUT}:5 ) -" -DEPEND=" - >=dev-qt/qtdbus-${QTMIN}:5 - >=dev-qt/qtgui-${QTMIN}:5 - >=dev-qt/qtwidgets-${QTMIN}:5 - =kde-frameworks/kauth-${PVCUT}*:5 - =kde-frameworks/kcodecs-${PVCUT}*:5 - =kde-frameworks/kconfig-${PVCUT}*:5 - =kde-frameworks/kcoreaddons-${PVCUT}*:5 - =kde-frameworks/kguiaddons-${PVCUT}*:5 - =kde-frameworks/ki18n-${PVCUT}*:5 - =kde-frameworks/kwidgetsaddons-${PVCUT}*:5 -" -RDEPEND="${DEPEND}" - -src_configure() { - local mycmakeargs=( - -DCMAKE_DISABLE_FIND_PACKAGE_PythonModuleGeneration=ON # bug 746866 - $(cmake_use_find_package man KF5DocTools) - ) - - ecm_src_configure -} diff --git a/kde-frameworks/kconfigwidgets/kconfigwidgets-5.88.0-r1.ebuild b/kde-frameworks/kconfigwidgets/kconfigwidgets-5.88.0-r1.ebuild new file mode 100644 index 000000000000..0528d343b7a1 --- /dev/null +++ b/kde-frameworks/kconfigwidgets/kconfigwidgets-5.88.0-r1.ebuild @@ -0,0 +1,46 @@ +# Copyright 1999-2021 Gentoo Authors +# Distributed under the terms of the GNU General Public License v2 + +EAPI=8 + +ECM_DESIGNERPLUGIN="true" +PVCUT=$(ver_cut 1-2) +QTMIN=5.15.2 +VIRTUALX_REQUIRED="test" +inherit ecm kde.org + +DESCRIPTION="Framework providing an assortment of configuration-related widgets" +LICENSE="LGPL-2+" +KEYWORDS="~amd64 ~arm ~arm64 ~ppc64 ~riscv ~x86" +IUSE="+man" + +BDEPEND=" + man? ( >=kde-frameworks/kdoctools-${PVCUT}:5 ) +" +DEPEND=" + >=dev-qt/qtdbus-${QTMIN}:5 + >=dev-qt/qtgui-${QTMIN}:5 + >=dev-qt/qtwidgets-${QTMIN}:5 + =kde-frameworks/kauth-${PVCUT}*:5 + =kde-frameworks/kcodecs-${PVCUT}*:5 + =kde-frameworks/kconfig-${PVCUT}*:5 + =kde-frameworks/kcoreaddons-${PVCUT}*:5 + =kde-frameworks/kguiaddons-${PVCUT}*:5 + =kde-frameworks/ki18n-${PVCUT}*:5 + =kde-frameworks/kwidgetsaddons-${PVCUT}*:5 +" +RDEPEND="${DEPEND}" + +PATCHES=( + "${FILESDIR}"/${P}-hamburger-menu-no-window-on-wayland.patch + "${FILESDIR}"/${P}-KCommandBar-alignment.patch +) + +src_configure() { + local mycmakeargs=( + -DCMAKE_DISABLE_FIND_PACKAGE_PythonModuleGeneration=ON # bug 746866 + $(cmake_use_find_package man KF5DocTools) + ) + + ecm_src_configure +} -- cgit v1.2.3