OpenStructure
Loading...
Searching...
No Matches
context_menu.hh
Go to the documentation of this file.
1//------------------------------------------------------------------------------
2// This file is part of the OpenStructure project <www.openstructure.org>
3//
4// Copyright (C) 2008-2020 by the OpenStructure authors
5//
6// This library is free software; you can redistribute it and/or modify it under
7// the terms of the GNU Lesser General Public License as published by the Free
8// Software Foundation; either version 3.0 of the License, or (at your option)
9// any later version.
10// This library is distributed in the hope that it will be useful, but WITHOUT
11// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
12// FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
13// details.
14//
15// You should have received a copy of the GNU Lesser General Public License
16// along with this library; if not, write to the Free Software Foundation, Inc.,
17// 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
18//------------------------------------------------------------------------------
19#ifndef OST_GUI_SCENE_WIN_CONTEXT_MENU_HH
20#define OST_GUI_SCENE_WIN_CONTEXT_MENU_HH
21
22/*
23 Author: Stefan Scheuber
24 */
25
26
29
30#include <QFlags>
31#include <QVector>
32#include <QAbstractItemModel>
33#include <QTreeView>
34namespace ost { namespace gui {
35
54
55Q_DECLARE_FLAGS(ContextActionTypes, ContextActionType)
56
57
58class DLLEXPORT_OST_GUI ContextMenu : public QObject {
59 Q_OBJECT
60public:
61 ContextMenu(QTreeView* view, SceneWinModel* model);
63
64 void ShowMenu(const QPoint& pos);
65 void Rename(QModelIndex index);
66
67 void AddAction(QAction* action,ContextActionTypes type);
68
69private slots:
70 void AddView();
71 void Rename();
72 void DeleteView();
73
74private:
75 QVector<std::pair<QAction*, ContextActionTypes> > actions_;
76
77 QTreeView* view_;
78 SceneWinModel* model_;
79};
80
81}}
82
83Q_DECLARE_OPERATORS_FOR_FLAGS(ost::gui::ContextActionTypes)
84
85#endif
void ShowMenu(const QPoint &pos)
ContextMenu(QTreeView *view, SceneWinModel *model)
void AddAction(QAction *action, ContextActionTypes type)
void Rename(QModelIndex index)
data model for scene win
#define DLLEXPORT_OST_GUI
@ MAP_DSAMPLED_AVAIL
@ VIEWS_SAME_OBJECT
Definition base.dox:1