swift
navigatordialog.h
Go to the documentation of this file.
1 // SPDX-FileCopyrightText: Copyright (C) 2016 swift Project Community / Contributors
2 // SPDX-License-Identifier: GPL-3.0-or-later OR LicenseRef-swift-pilot-client-1
3 
5 
6 #ifndef SWIFT_GUI_COMPONENTS_NAVIGATORDIALOG_H
7 #define SWIFT_GUI_COMPONENTS_NAVIGATORDIALOG_H
8 
9 #include <QDialog>
10 #include <QGridLayout>
11 #include <QObject>
12 #include <QPoint>
13 #include <QScopedPointer>
14 #include <QTimer>
15 #include <QWidgetAction>
16 
19 #include "gui/swiftguiexport.h"
20 
21 class QEvent;
22 class QMenu;
23 class QMouseEvent;
24 class QMainWindow;
25 
26 namespace Ui
27 {
28  class CNavigatorDialog;
29 }
30 namespace swift::gui::components
31 {
32  class CMarginsInput;
33 
38  {
39  Q_OBJECT
40 
41  public:
43  CNavigatorDialog(QWidget *parent = nullptr);
44 
46  virtual ~CNavigatorDialog() override;
47 
49  void buildNavigator(int columns);
50 
52  virtual void reject() override;
53 
55  void toggleFrameless();
56 
58  void showNavigator(bool visible);
59 
61  void toggleNavigatorVisibility();
62 
64  void restoreFromSettings();
65 
67  void saveToSettings();
68 
70  void setMainWindow(QMainWindow *window) { m_mainWindow = window; }
71 
72  signals:
75 
76  protected:
79 
81  virtual void mouseMoveEvent(QMouseEvent *event) override;
82 
84  virtual void mousePressEvent(QMouseEvent *event) override;
85 
87  virtual void mouseReleaseEvent(QMouseEvent *event) override;
88 
90  virtual void changeEvent(QEvent *evt) override;
91 
93  virtual void windowFlagsChanged() override;
94 
96  virtual void paintEvent(QPaintEvent *event) override;
97 
99  virtual void enterEvent(QEnterEvent *event) override;
101 
102  private:
104  void menuChangeMargins(const QMargins &margins);
105 
107  void changeLayout();
108 
110  void dummyFunction();
111 
113  void showContextMenu(const QPoint &pos);
114 
116  void onStyleSheetsChanged();
117 
119  void onSettingsChanged();
120 
122  void insertOwnActions();
123 
125  void addToContextMenu(QMenu *contextMenu) const;
126 
128  int columnsForRows(int rows);
129 
131  QGridLayout *myGridLayout() const;
132 
134  void adjustNavigatorSize(QGridLayout *layout = nullptr);
135 
137  void onWatchdog();
138 
139  bool m_firstBuild = true;
140  bool m_originalQuitOnLastWindow = false;
141  int m_currentColumns = 1;
142  QScopedPointer<Ui::CNavigatorDialog> ui;
143  QMainWindow *m_mainWindow = nullptr;
144  QWidgetAction *m_marginMenuAction = nullptr;
145  CMarginsInput *m_input = nullptr;
146  QTimer m_watchdog;
148  &CNavigatorDialog::onSettingsChanged };
149  };
150 } // namespace swift::gui::components
151 
152 #endif // SWIFT_GUI_COMPONENTS_NAVIGATORDIALOG_H
Main window which can be frameless.
Widget alows to enter margins.
Definition: marginsinput.h:24
void navigatorClosed()
Navigator closed.
void setMainWindow(QMainWindow *window)
The main window.
High level reusable GUI components.
Definition: aboutdialog.cpp:13
#define SWIFT_GUI_EXPORT
Export a class or function from the library.