1 | /**************************************************************************** |
---|---|
2 | ** |
3 | ** Copyright (C) 2016 The Qt Company Ltd. |
4 | ** Contact: https://www.qt.io/licensing/ |
5 | ** |
6 | ** This file is part of the Qt Designer of the Qt Toolkit. |
7 | ** |
8 | ** $QT_BEGIN_LICENSE:GPL-EXCEPT$ |
9 | ** Commercial License Usage |
10 | ** Licensees holding valid commercial Qt licenses may use this file in |
11 | ** accordance with the commercial license agreement provided with the |
12 | ** Software or, alternatively, in accordance with the terms contained in |
13 | ** a written agreement between you and The Qt Company. For licensing terms |
14 | ** and conditions see https://www.qt.io/terms-conditions. For further |
15 | ** information use the contact form at https://www.qt.io/contact-us. |
16 | ** |
17 | ** GNU General Public License Usage |
18 | ** Alternatively, this file may be used under the terms of the GNU |
19 | ** General Public License version 3 as published by the Free Software |
20 | ** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT |
21 | ** included in the packaging of this file. Please review the following |
22 | ** information to ensure the GNU General Public License requirements will |
23 | ** be met: https://www.gnu.org/licenses/gpl-3.0.html. |
24 | ** |
25 | ** $QT_END_LICENSE$ |
26 | ** |
27 | ****************************************************************************/ |
28 | |
29 | #ifndef TABORDEREDITOR_H |
30 | #define TABORDEREDITOR_H |
31 | |
32 | #include "tabordereditor_global.h" |
33 | |
34 | #include <QtCore/qpointer.h> |
35 | #include <QtWidgets/qwidget.h> |
36 | #include <QtGui/qregion.h> |
37 | #include <QtGui/qfont.h> |
38 | #include <QtGui/qfontmetrics.h> |
39 | |
40 | QT_BEGIN_NAMESPACE |
41 | |
42 | class QUndoStack; |
43 | class QDesignerFormWindowInterface; |
44 | |
45 | namespace qdesigner_internal { |
46 | |
47 | class QT_TABORDEREDITOR_EXPORT TabOrderEditor : public QWidget |
48 | { |
49 | Q_OBJECT |
50 | |
51 | public: |
52 | TabOrderEditor(QDesignerFormWindowInterface *form, QWidget *parent); |
53 | |
54 | QDesignerFormWindowInterface *formWindow() const; |
55 | |
56 | public slots: |
57 | void setBackground(QWidget *background); |
58 | void updateBackground(); |
59 | void widgetRemoved(QWidget*); |
60 | void initTabOrder(); |
61 | |
62 | private slots: |
63 | void showTabOrderDialog(); |
64 | |
65 | protected: |
66 | void paintEvent(QPaintEvent *e) override; |
67 | void mouseMoveEvent(QMouseEvent *e) override; |
68 | void mousePressEvent(QMouseEvent *e) override; |
69 | void mouseDoubleClickEvent(QMouseEvent *e) override; |
70 | void contextMenuEvent(QContextMenuEvent *e) override; |
71 | void resizeEvent(QResizeEvent *e) override; |
72 | void showEvent(QShowEvent *e) override; |
73 | |
74 | private: |
75 | QRect indicatorRect(int index) const; |
76 | int widgetIndexAt(const QPoint &pos) const; |
77 | bool skipWidget(QWidget *w) const; |
78 | |
79 | QPointer<QDesignerFormWindowInterface> m_form_window; |
80 | |
81 | QWidgetList m_tab_order_list; |
82 | |
83 | QWidget *m_bg_widget; |
84 | QUndoStack *m_undo_stack; |
85 | QRegion m_indicator_region; |
86 | |
87 | QFontMetrics m_font_metrics; |
88 | int m_current_index; |
89 | bool m_beginning; |
90 | }; |
91 | |
92 | } // namespace qdesigner_internal |
93 | |
94 | QT_END_NAMESPACE |
95 | |
96 | #endif |
97 |