itom  4.1.0
lastCommandDockWidget.h
1 /* ********************************************************************
2  itom software
3  URL: http://www.uni-stuttgart.de/ito
4  Copyright (C) 2020, Institut fuer Technische Optik (ITO),
5  Universitaet Stuttgart, Germany
6 
7  This file is part of itom.
8 
9  itom is free software; you can redistribute it and/or modify it
10  under the terms of the GNU Library General Public Licence as published by
11  the Free Software Foundation; either version 2 of the Licence, or (at
12  your option) any later version.
13 
14  itom is distributed in the hope that it will be useful, but
15  WITHOUT ANY WARRANTY; without even the implied warranty of
16  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library
17  General Public Licence for more details.
18 
19  You should have received a copy of the GNU Library General Public License
20  along with itom. If not, see <http://www.gnu.org/licenses/>.
21 *********************************************************************** */
22 
23 #ifndef LASTCOMMANDDOCKWIDGET_H
24 #define LASTCOMMANDDOCKWIDGET_H
25 
26 #include "abstractDockWidget.h"
27 
28 #include <qwidget.h>
29 #include <qaction.h>
30 #include <qtoolbar.h>
31 #include <qpoint.h>
32 
33 #include <qtreewidget.h>
34 
35 namespace ito
36 {
37  class LastCommandTreeWidget : public QTreeWidget
38  {
39  Q_OBJECT
40 
41  public:
42  LastCommandTreeWidget(QWidget * parent = 0) : QTreeWidget(parent) {};
43  virtual ~LastCommandTreeWidget() {};
44 
45  protected:
46  QStringList mimeTypes() const;
47  QMimeData * mimeData(const QList<QTreeWidgetItem *> items) const;
48  };
49 
51  {
52  Q_OBJECT
53 
54  public:
55  LastCommandDockWidget(const QString &title, const QString &objName, QWidget *parent = NULL, bool docked = true, bool isDockAvailable = true, tFloatingStyle floatingStyle = floatingNone, tMovingStyle movingStyle = movingEnabled);
57 
58  protected:
59  void createActions();
60  void createMenus();
61  void createToolBars();
62  void createStatusBar(){};
63  void updateActions();
64  void updatePythonActions(){ updateActions(); }
65 
66  private:
67  LastCommandTreeWidget *m_lastCommandTreeWidget;
68  QMenu* m_pContextMenu;
69  ShortcutAction* m_pActClearList;
70  QTreeWidgetItem *m_lastTreeWidgetParent;
71  bool m_enabled;
72  QString m_dateColor;
73  bool m_hideDuplicatedCommands;
74 
75  signals:
76  void runPythonCommand(const QString cmd);
77 
78  private slots:
79  void itemDoubleClicked(QTreeWidgetItem *item, int column);
80  void mnuClearList();
81  void treeWidgetContextMenuRequested(const QPoint &pos);
82 
83  public slots:
84  void addLastCommand(QString cmd);
85  void propertiesChanged();
86  };
87 
88 } //end namespace ito
89 
90 #endif
Definition: lastCommandDockWidget.h:50
Definition: apiFunctionsGraph.cpp:39
Definition: shortcutAction.h:40
abstract dock widget class which inherits QDockWidget. The content of QDockWidget consists of an inst...
Definition: abstractDockWidget.h:54
Definition: lastCommandDockWidget.h:37
tFloatingStyle
The floating style of a widget, derived from AbstractDockWidget.
Definition: abstractDockWidget.h:88
Definition: abstractDockWidget.h:90
Definition: abstractDockWidget.h:99
bool docked() const
Definition: abstractDockWidget.h:128
tMovingStyle
The configuration if a docked AbstractDockWidget can be moved from one docking area to another one...
Definition: abstractDockWidget.h:96
void addLastCommand(QString cmd)
adds a command string 'cmd' to the list of recently executed commands
Definition: lastCommandDockWidget.cpp:222