mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Replace ADD_ACTION macro by member function in profilewidget2.cpp
Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
3d8b0e6d3f
commit
769c64fe5e
2 changed files with 19 additions and 16 deletions
|
@ -139,24 +139,14 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||||
addItemsToScene();
|
addItemsToScene();
|
||||||
scene()->installEventFilter(this);
|
scene()->installEventFilter(this);
|
||||||
#ifndef SUBSURFACE_MOBILE
|
#ifndef SUBSURFACE_MOBILE
|
||||||
QAction *action = NULL;
|
|
||||||
setAcceptDrops(true);
|
setAcceptDrops(true);
|
||||||
|
|
||||||
#define ADD_ACTION(SHORTCUT, Slot) \
|
addActionShortcut(Qt::Key_Escape, &ProfileWidget2::keyEscAction);
|
||||||
action = new QAction(this); \
|
addActionShortcut(Qt::Key_Delete, &ProfileWidget2::keyDeleteAction);
|
||||||
action->setShortcut(SHORTCUT); \
|
addActionShortcut(Qt::Key_Up, &ProfileWidget2::keyUpAction);
|
||||||
action->setShortcutContext(Qt::WindowShortcut); \
|
addActionShortcut(Qt::Key_Down, &ProfileWidget2::keyDownAction);
|
||||||
addAction(action); \
|
addActionShortcut(Qt::Key_Left, &ProfileWidget2::keyLeftAction);
|
||||||
connect(action, SIGNAL(triggered(bool)), this, SLOT(Slot)); \
|
addActionShortcut(Qt::Key_Right, &ProfileWidget2::keyRightAction);
|
||||||
actionsForKeys[SHORTCUT] = action;
|
|
||||||
|
|
||||||
ADD_ACTION(Qt::Key_Escape, keyEscAction());
|
|
||||||
ADD_ACTION(Qt::Key_Delete, keyDeleteAction());
|
|
||||||
ADD_ACTION(Qt::Key_Up, keyUpAction());
|
|
||||||
ADD_ACTION(Qt::Key_Down, keyDownAction());
|
|
||||||
ADD_ACTION(Qt::Key_Left, keyLeftAction());
|
|
||||||
ADD_ACTION(Qt::Key_Right, keyRightAction());
|
|
||||||
#undef ADD_ACTION
|
|
||||||
#endif // SUBSURFACE_MOBILE
|
#endif // SUBSURFACE_MOBILE
|
||||||
|
|
||||||
#if !defined(QT_NO_DEBUG) && defined(SHOW_PLOT_INFO_TABLE)
|
#if !defined(QT_NO_DEBUG) && defined(SHOW_PLOT_INFO_TABLE)
|
||||||
|
@ -166,6 +156,18 @@ ProfileWidget2::ProfileWidget2(QWidget *parent) : QGraphicsView(parent),
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef SUBSURFACE_MOBILE
|
||||||
|
void ProfileWidget2::addActionShortcut(const Qt::Key shortcut, void (ProfileWidget2::*slot)())
|
||||||
|
{
|
||||||
|
QAction *action = new QAction(this);
|
||||||
|
action->setShortcut(shortcut);
|
||||||
|
action->setShortcutContext(Qt::WindowShortcut);
|
||||||
|
addAction(action);
|
||||||
|
connect(action, &QAction::triggered, this, slot);
|
||||||
|
actionsForKeys[shortcut] = action;
|
||||||
|
}
|
||||||
|
#endif // SUBSURFACE_MOBILE
|
||||||
|
|
||||||
#define SUBSURFACE_OBJ_DATA 1
|
#define SUBSURFACE_OBJ_DATA 1
|
||||||
#define SUBSURFACE_OBJ_DC_TEXT 0x42
|
#define SUBSURFACE_OBJ_DC_TEXT 0x42
|
||||||
|
|
||||||
|
|
|
@ -160,6 +160,7 @@ private: /*methods*/
|
||||||
void setupItemOnScene();
|
void setupItemOnScene();
|
||||||
void disconnectTemporaryConnections();
|
void disconnectTemporaryConnections();
|
||||||
struct plot_data *getEntryFromPos(QPointF pos);
|
struct plot_data *getEntryFromPos(QPointF pos);
|
||||||
|
void addActionShortcut(const Qt::Key shortcut, void (ProfileWidget2::*slot)());
|
||||||
|
|
||||||
private:
|
private:
|
||||||
DivePlotDataModel *dataModel;
|
DivePlotDataModel *dataModel;
|
||||||
|
|
Loading…
Add table
Reference in a new issue