pqViewFrame.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: ParaView
4  Module: $RCSfile$
5 
6  Copyright (c) 2005,2006 Sandia Corporation, Kitware Inc.
7  All rights reserved.
8 
9  ParaView is a free software; you can redistribute it and/or modify it
10  under the terms of the ParaView license version 1.2.
11 
12  See License_v1.2.txt for the full ParaView license.
13  A copy of this license can be obtained by contacting
14  Kitware Inc.
15  28 Corporate Drive
16  Clifton Park, NY 12065
17  USA
18 
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR
23 CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24 EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25 PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26 PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27 LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28 NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29 SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 
31 ========================================================================*/
32 #ifndef pqViewFrame_h
33 #define pqViewFrame_h
34 
35 #include "pqComponentsModule.h"
36 #include <QMap>
37 #include <QPointer>
38 #include <QScopedPointer>
39 #include <QUuid>
40 #include <QWidget>
41 
42 class QDragEnterEvent;
43 class QDragMoveEvent;
44 class QDropEvent;
45 class QFrame;
46 class QLabel;
47 class QMenu;
48 class QToolBar;
49 class QToolButton;
51 class pqView;
52 
59 class PQCOMPONENTS_EXPORT pqViewFrame : public QWidget
60 {
61  Q_OBJECT
62  typedef QWidget Superclass;
63 
64 public:
65  pqViewFrame(QWidget* parent = nullptr);
66  ~pqViewFrame() override;
67 
72  void setTitle(const QString& text);
73  QString title() const;
74 
81  void setCentralWidget(QWidget* widget, pqView* view = nullptr);
82  QWidget* centralWidget() const;
83 
88  void setBorderColor(const QColor& clr);
89  const QColor& borderColor() const { return this->BorderColor; }
90 
94  bool isBorderVisible() const { return this->BorderVisible; }
95 
99  bool isTitleBarVisible() const { return this->TitleBarVisible; }
100 
102  {
103  NoButton = 0x0000,
104  SplitHorizontal = 0x0001,
105  SplitVertical = 0x0002,
106  Maximize = 0x0004,
107  Restore = 0x0008,
108  Close = 0x0010
109  };
110 
111  Q_DECLARE_FLAGS(StandardButtons, StandardButton);
112 
117  void setStandardButtons(StandardButtons buttons);
118  StandardButtons standardButtons() const { return this->Buttons; }
119 
123  void addTitleBarAction(QAction* action);
124  QAction* addTitleBarAction(const QString& title);
125  QAction* addTitleBarAction(const QIcon& icon, const QString& title);
126 
130  QAction* addTitleBarSeparator();
131 
135  void removeTitleBarActions();
136 
140  QMenu* contextMenu() const;
141 
145  QUuid uniqueID() const { return this->UniqueID; }
146 
147 Q_SIGNALS:
151  void buttonPressed(int button);
152 
156  void actionTriggered(QAction* action);
157 
161  void swapPositions(const QString& other);
162 
167  void finishDrag(pqViewFrame* source);
168 
169 public Q_SLOTS:
173  void setBorderVisibility(bool val)
174  {
175  this->BorderVisible = val;
176  this->updateComponentVisibilities();
177  }
178 
182  void setTitleBarVisibility(bool val)
183  {
184  this->TitleBarVisible = val;
185  this->updateComponentVisibilities();
186  }
187 
189  {
190  this->DecorationsVisible = val;
191  this->updateComponentVisibilities();
192  }
193 
194  void onViewNameChanged(pqServerManagerModelItem*);
195 
199  bool eventFilter(QObject*, QEvent*) override;
200 
201 protected:
206  virtual void updateComponentVisibilities();
207 
211  void drag();
212  void dragEnter(QDragEnterEvent*);
213  void drop(QDropEvent*);
214 
215 protected Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
216  void buttonClicked();
217  void contextMenuRequested(const QPoint&);
218 
219 protected: // NOLINT(readability-redundant-access-specifiers)
223  QColor BorderColor;
224  StandardButtons Buttons;
225  QPointer<QToolBar> ToolBar;
226  QPointer<QWidget> CentralWidget;
227  QPointer<QMenu> ContextMenu;
228  QUuid UniqueID;
230  typedef QMap<StandardButton, QPointer<QToolButton>> StandardToolButtonsMap;
231  StandardToolButtonsMap StandardToolButtons;
234  QString PlainTitle;
235 
236 private:
237  Q_DISABLE_COPY(pqViewFrame)
238 
239 
242  QToolButton* createButton(QAction* action);
243 
244  class pqInternals;
245  const QScopedPointer<pqInternals> Internals;
246 private Q_SLOTS: // NOLINT(readability-redundant-access-specifiers)
247  void finishedDrag(pqViewFrame* source);
248 };
249 
250 Q_DECLARE_OPERATORS_FOR_FLAGS(pqViewFrame::StandardButtons);
251 
252 #endif
QPalette PaletteWithoutBorder
Definition: pqViewFrame.h:233
QUuid uniqueID() const
provides access to the unique id assigned to the frame.
Definition: pqViewFrame.h:145
#define PQCOMPONENTS_EXPORT
QString PlainTitle
Definition: pqViewFrame.h:234
bool TitleBarVisible
Definition: pqViewFrame.h:221
pqViewFrame is used to represent a frame for any ParaView view shown in the pqMultiViewWidget.
Definition: pqViewFrame.h:59
StandardToolButtonsMap StandardToolButtons
Definition: pqViewFrame.h:231
bool BorderVisible
Definition: pqViewFrame.h:222
void setDecorationsVisibility(bool val)
Definition: pqViewFrame.h:188
pqServerManagerModelItem is a element maintained by pqServerManagerModel.
This is a PQ abstraction of a generic view module.
Definition: pqView.h:54
void setBorderVisibility(bool val)
set whether the border is visible.
Definition: pqViewFrame.h:173
QPointer< QToolBar > ToolBar
Definition: pqViewFrame.h:225
QPointer< QWidget > CentralWidget
Definition: pqViewFrame.h:226
const QColor & borderColor() const
Definition: pqViewFrame.h:89
bool isTitleBarVisible() const
Get whether the title-bar is shown.
Definition: pqViewFrame.h:99
source
QPalette PaletteWithBorder
Definition: pqViewFrame.h:232
void setTitleBarVisibility(bool val)
set whether the title-bar is visible.
Definition: pqViewFrame.h:182
QPoint DragStartPosition
Definition: pqViewFrame.h:229
QUuid UniqueID
Definition: pqViewFrame.h:228
StandardButtons Buttons
Definition: pqViewFrame.h:224
QColor BorderColor
Definition: pqViewFrame.h:223
bool isBorderVisible() const
Get/Set the border visibility.
Definition: pqViewFrame.h:94
Q_DECLARE_OPERATORS_FOR_FLAGS(pqViewFrame::StandardButtons)
QMap< StandardButton, QPointer< QToolButton > > StandardToolButtonsMap
Definition: pqViewFrame.h:230
StandardButtons standardButtons() const
Definition: pqViewFrame.h:118
QPointer< QMenu > ContextMenu
Definition: pqViewFrame.h:227
bool DecorationsVisible
Definition: pqViewFrame.h:220
title