source: trunk/tools/designer/src/components/formeditor/qwizard_container.h

Last change on this file was 846, checked in by Dmitry A. Kuminov, 14 years ago

trunk: Merged in qt 4.7.2 sources from branches/vendor/nokia/qt.

File size: 4.3 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the Qt Designer of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
38** $QT_END_LICENSE$
39**
40****************************************************************************/
41
42#ifndef QWIZARD_CONTAINER_H
43#define QWIZARD_CONTAINER_H
44
45#include <QtDesigner/QDesignerContainerExtension>
46
47#include <qdesigner_propertysheet_p.h>
48#include <extensionfactory_p.h>
49
50#include <QtGui/QWizard>
51#include <QtGui/QWizardPage>
52
53QT_BEGIN_NAMESPACE
54
55class QWizardPage;
56
57namespace qdesigner_internal {
58
59// Container for QWizard. Care must be taken to position
60// the QWizard at some valid page after removal/insertion
61// as it is not used to having its pages ripped out.
62class QWizardContainer: public QObject, public QDesignerContainerExtension
63{
64 Q_OBJECT
65 Q_INTERFACES(QDesignerContainerExtension)
66public:
67 explicit QWizardContainer(QWizard *widget, QObject *parent = 0);
68
69 virtual int count() const;
70 virtual QWidget *widget(int index) const;
71 virtual int currentIndex() const;
72 virtual void setCurrentIndex(int index);
73 virtual void addWidget(QWidget *widget);
74 virtual void insertWidget(int index, QWidget *widget);
75 virtual void remove(int index);
76
77private:
78 QWizard *m_wizard;
79};
80
81// QWizardPagePropertySheet: Introduces a attribute string fake property
82// "pageId" that allows for specifying enumeration values (uic only).
83// This breaks the pattern of having a "currentSth" property for the
84// container, but was deemed to make sense here since the Page has
85// its own "title" properties.
86class QWizardPagePropertySheet: public QDesignerPropertySheet
87{
88 Q_OBJECT
89public:
90 explicit QWizardPagePropertySheet(QWizardPage *object, QObject *parent = 0);
91
92 virtual bool reset(int index);
93
94 static const char *pageIdProperty;
95
96private:
97 const int m_pageIdIndex;
98};
99
100// QWizardPropertySheet: Hides the "startId" property. It cannot be used
101// as QWizard cannot handle setting it as a property before the actual
102// page is added.
103
104class QWizardPropertySheet: public QDesignerPropertySheet
105{
106 Q_OBJECT
107public:
108 explicit QWizardPropertySheet(QWizard *object, QObject *parent = 0);
109 virtual bool isVisible(int index) const;
110
111private:
112 const QString m_startId;
113};
114
115// Factories
116typedef QDesignerPropertySheetFactory<QWizard, QWizardPropertySheet> QWizardPropertySheetFactory;
117typedef QDesignerPropertySheetFactory<QWizardPage, QWizardPagePropertySheet> QWizardPagePropertySheetFactory;
118typedef ExtensionFactory<QDesignerContainerExtension, QWizard, QWizardContainer> QWizardContainerFactory;
119} // namespace qdesigner_internal
120
121QT_END_NAMESPACE
122
123#endif // QWIZARD_CONTAINER_H
Note: See TracBrowser for help on using the repository browser.