OSDN Git Service

25bf2aacb8d25acacd99c84a9d56c54414f4c15b
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qmldesigner / components / formeditor / formeditorwidget.h
1 /**************************************************************************
2 **
3 ** This file is part of Qt Creator
4 **
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
6 **
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
8 **
9 ** No Commercial Usage
10 **
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
14 ** this package.
15 **
16 ** GNU Lesser General Public License Usage
17 **
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file.  Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24 **
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights.  These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28 **
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
31 **
32 **************************************************************************/
33
34 #ifndef FORMEDITORWIDGET_H
35 #define FORMEDITORWIDGET_H
36
37 #include <QWidget>
38
39 QT_BEGIN_NAMESPACE
40 class QActionGroup;
41 QT_END_NAMESPACE
42
43 namespace QmlDesigner {
44
45 class ZoomAction;
46 class LineEditAction;
47 class FormEditorView;
48 class FormEditorScene;
49 class FormEditorGraphicsView;
50 class ToolBox;
51 class QmlItemNode;
52
53
54 class FormEditorWidget : public QWidget
55 {
56     Q_OBJECT
57 public:
58     FormEditorWidget(FormEditorView *view);
59
60     ZoomAction *zoomAction() const;
61     QAction *anchorToolAction() const;
62     QAction *transformToolAction() const;
63     QAction *showBoundingRectAction() const;
64     QAction *selectOnlyContentItemsAction() const;
65     QAction *snappingAction() const;
66     QAction *snappingAndAnchoringAction() const;
67
68     void setScene(FormEditorScene *scene);
69     ToolBox *toolBox() const;
70
71     double spacing() const;
72     double margins() const;
73
74     void setFeedbackNode(const QmlItemNode &node);
75
76     QString contextHelpId() const;
77
78     void setRootItemRect(const QRectF &rect);
79     QRectF rootItemRect() const;
80
81     void updateActions();
82
83     void resetView();
84     void centerScene();
85
86
87 protected:
88     void enterEvent(QEvent *event);
89     void wheelEvent(QWheelEvent *event);
90     QActionGroup *toolActionGroup() const;
91
92 private slots:
93     void changeTransformTool(bool checked);
94     void changeAnchorTool(bool checked);
95     void setZoomLevel(double zoomLevel);
96     void changeRootItemWidth(const QString &widthText);
97     void changeRootItemHeight(const QString &heightText);
98     void resetNodeInstanceView();
99
100 private:
101     QWeakPointer<FormEditorView> m_formEditorView;
102     QWeakPointer<FormEditorGraphicsView> m_graphicsView;
103     QWeakPointer<ZoomAction> m_zoomAction;
104     QWeakPointer<ToolBox> m_toolBox;
105     QWeakPointer<QAction> m_anchorToolAction;
106     QWeakPointer<QAction> m_transformToolAction;
107     QWeakPointer<QActionGroup> m_toolActionGroup;
108     QWeakPointer<QAction> m_snappingAction;
109     QWeakPointer<QAction> m_snappingAndAnchoringAction;
110     QWeakPointer<QAction> m_noSnappingAction;
111     QWeakPointer<QAction> m_showBoundingRectAction;
112     QWeakPointer<QAction> m_selectOnlyContentItemsAction;
113     QWeakPointer<LineEditAction> m_rootWidthAction;
114     QWeakPointer<LineEditAction> m_rootHeightAction;
115     QWeakPointer<QAction> m_resetAction;
116 };
117
118
119 }
120 #endif //FORMEDITORWIDGET_H
121