OSDN Git Service

a28fb74adef2a3e5674447f82d6d3ddbb6839e7e
[qt-creator-jp/qt-creator-jp.git] / src / plugins / qmldesigner / components / propertyeditor / qproxylayoutitem.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 QPROXYLAYOUTITEM_H
35 #define QPROXYLAYOUTITEM_H
36
37 #include <qdeclarative.h>
38 #include <QGraphicsLayout>
39
40 QT_BEGIN_HEADER
41
42 QT_BEGIN_NAMESPACE
43
44 QT_MODULE(Declarative)
45
46 class QProxyLayout : public QObject, public QGraphicsLayout
47 {
48     Q_OBJECT
49     Q_INTERFACES(QGraphicsLayout QGraphicsLayoutItem)
50     Q_PROPERTY(QGraphicsLayout *layout READ layout WRITE setLayout)
51 public:
52     QProxyLayout(QObject *parent=0);
53
54     void setLayout(QGraphicsLayout *);
55     QGraphicsLayout *layout() const;
56
57     virtual void setGeometry(const QRectF &);
58     virtual int count() const;
59     virtual QGraphicsLayoutItem *itemAt(int) const;
60     virtual void removeAt(int);
61     virtual void updateGeometry();
62
63 protected:
64     virtual QSizeF sizeHint(Qt::SizeHint which, const QSizeF &constraint) const;
65
66 private:
67     QRectF geometry;
68     QGraphicsLayout *proxy;
69 };
70
71 class QProxyLayoutItem : public QObject, public QGraphicsLayoutItem
72 {
73     Q_OBJECT
74     Q_INTERFACES(QGraphicsLayoutItem)
75     Q_PROPERTY(QGraphicsLayoutItem *widget READ item WRITE setItem)
76 public:
77     QProxyLayoutItem(QGraphicsLayoutItem * = 0);
78
79     virtual void setGeometry(const QRectF &);
80
81     QGraphicsLayoutItem *item() const;
82     void setItem(QGraphicsLayoutItem *);
83
84     void setEnabled(bool);
85
86     static void registerDeclarativeTypes();
87
88 protected:
89     virtual QSizeF sizeHint(Qt::SizeHint, const QSizeF &) const;
90
91 private:
92     bool enabled;
93     QRectF geometry;
94     QGraphicsLayoutItem *other;
95 };
96
97 QT_END_NAMESPACE
98
99 QML_DECLARE_TYPE(QProxyLayout)
100 QML_DECLARE_TYPE(QProxyLayoutItem)
101
102 QT_END_HEADER
103
104 #endif // QPROXYLAYOUTITEM_H
105