Commit 7e96badc authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

Flatten menu in preview

parent f70de795
......@@ -44,6 +44,7 @@
#include <ktoolbar.h>
#include <kmenubar.h>
#include <QPointer>
#include <QWidgetAction>
class RKXMLGUIPreviewArea : public KXmlGuiWindow {
public:
......@@ -90,7 +91,20 @@ protected:
menu->clear ();
QList<QAction*> entries = menuBar ()->actions ();
for (int i = 0; i < entries.size (); ++i) {
menu->addAction (entries[i]);
QMenu *smenu = entries[i]->menu ();
if (!smenu) continue;
QList<QAction*> subentries = smenu->actions ();
if (subentries.isEmpty ()) continue;
QWidgetAction *act = new QWidgetAction (this);
QLabel *lab = new QLabel ("<b>" + entries[i]->text ().replace ('&', "") + "</b>");
lab->setAlignment (Qt::AlignCenter);
act->setDefaultWidget (lab);
menu->addAction (act);
for (int j = 0; j < subentries.size (); ++j) {
menu->addAction (subentries[j]);
}
}
}
}
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment