Bezig met plugin menu systeem

This commit is contained in:
eelke 2019-08-15 12:40:29 +02:00
parent 601d071d0f
commit 048843a1d4
10 changed files with 93 additions and 16 deletions

View file

@ -30,25 +30,25 @@ void QueryToolModule::init()
{
auto ca = makeContextAction<QueryTool>(tr("Save SQL"), &QueryTool::save);
ca->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_S));
// ca->setMenuLocation(MenuPath("File/Save"));
// ca->setToolbarLocation(ToolbarLocation("main", "save"));
ca->setMenuLocation(MenuPath("File/Save"));
ca->setToolbarLocation(ToolbarLocation("main", "save"));
// how we tell the system we want this to become a menu button with this as it's default action
registerContextAction(ca);
}
// {
// auto ca = makeContextAction<QueryTool>(tr("Save SQL as"), &QueryTool::saveAs);
// ca->setMenuLocation(MenuPath("File/Save"));
// ca->setToolbarLocation(ToolbarLocation("main", "save"));
// // how we tell the system we want this to become a secondary action for the previous button?
// registerContextAction(ca);
// }
// {
// auto ca = makeContextAction<QueryTool>(tr("Save copy of SQL as"), &QueryTool::saveCopyAs);
// ca->setMenuLocation(MenuPath("File/Save"));
// ca->setToolbarLocation(ToolbarLocation("main", "save"));
// // how we tell the system we want this to become a secondary action for the previous button?
// registerContextAction(ca);
// }
{
auto ca = makeContextAction<QueryTool>(tr("Save SQL as"), &QueryTool::saveAs);
ca->setMenuLocation(MenuPath("File/Save"));
ca->setToolbarLocation(ToolbarLocation("main", "save"));
// how we tell the system we want this to become a secondary action for the previous button?
registerContextAction(ca);
}
{
auto ca = makeContextAction<QueryTool>(tr("Save copy of SQL as"), &QueryTool::saveCopyAs);
ca->setMenuLocation(MenuPath("File/Save"));
ca->setToolbarLocation(ToolbarLocation("main", "save"));
// how we tell the system we want this to become a secondary action for the previous button?
registerContextAction(ca);
}
}

View file

@ -30,6 +30,10 @@ SOURCES += main.cpp\
ConnectionManagerWindow.cpp \
ConnectionListModel.cpp \
BackupRestore.cpp \
plugin_support/LMenu.cpp \
plugin_support/LMenuBar.cpp \
plugin_support/LMenuItem.cpp \
plugin_support/LMenuSection.cpp \
stopwatch.cpp \
TuplesResultWidget.cpp \
BackupDialog.cpp \
@ -104,6 +108,10 @@ HEADERS += \
CreateDatabaseDialog.h \
ConnectionManagerWindow.h \
ConnectionListModel.h \
plugin_support/LMenu.h \
plugin_support/LMenuBar.h \
plugin_support/LMenuItem.h \
plugin_support/LMenuSection.h \
stopwatch.h \
TuplesResultWidget.h \
BackupDialog.h \

View file

@ -0,0 +1,6 @@
#include "LMenu.h"
LMenu::LMenu()
{
}

View file

@ -0,0 +1,13 @@
#ifndef LMENU_H
#define LMENU_H
/** Represents a menu wraps QMenu to give it more dynamic functionality
*
*/
class LMenu
{
public:
LMenu();
};
#endif // LMENU_H

View file

@ -0,0 +1,6 @@
#include "LMenuBar.h"
LMenuBar::LMenuBar()
{
}

View file

@ -0,0 +1,11 @@
#ifndef LMENUBAR_H
#define LMENUBAR_H
/** Represents the main menubar. Linked to a QMenuBar
*/
class LMenuBar {
public:
LMenuBar();
};
#endif // LMENUBAR_H

View file

@ -0,0 +1,6 @@
#include "LMenuItem.h"
LMenuItem::LMenuItem()
{
}

View file

@ -0,0 +1,10 @@
#ifndef LMENUITEM_H
#define LMENUITEM_H
class LMenuItem {
public:
LMenuItem();
};
#endif // LMENUITEM_H

View file

@ -0,0 +1,6 @@
#include "LMenuSection.h"
LMenuSection::LMenuSection()
{
}

View file

@ -0,0 +1,11 @@
#ifndef LMENUSECTION_H
#define LMENUSECTION_H
/** Logical grouping within a menu
*/
class LMenuSection {
public:
LMenuSection();
};
#endif // LMENUSECTION_H