1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
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
16 ** GNU Lesser General Public License Usage
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.
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.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
35 #ifndef LAYOUTWIDGET_H
36 #define LAYOUTWIDGET_H
38 #include <QtGui/QFrame>
40 #include <QPushButton>
45 class LayoutWidget : public QFrame
49 Q_PROPERTY(bool leftAnchor READ leftAnchor WRITE setLeftAnchor NOTIFY leftAnchorChanged)
50 Q_PROPERTY(bool rightAnchor READ rightAnchor WRITE setRightAnchor NOTIFY rightAnchorChanged)
51 Q_PROPERTY(bool bottomAnchor READ bottomAnchor WRITE setBottomAnchor NOTIFY bottomAnchorChanged)
52 Q_PROPERTY(bool topAnchor READ topAnchor WRITE setTopAnchor NOTIFY topAnchorChanged)
54 Q_PROPERTY(QUrl leftButtonIcon READ icon WRITE setLeftButtonIcon)
55 Q_PROPERTY(QUrl rightButtonIcon READ icon WRITE setRightButtonIcon)
56 Q_PROPERTY(QUrl topButtonIcon READ icon WRITE setTopButtonIcon)
57 Q_PROPERTY(QUrl bottomButtonIcon READ icon WRITE setBottomButtonIcon)
61 void setLeftButtonIcon(const QUrl &url)
62 { setIcon(m_leftButton, url); }
64 void setRightButtonIcon(const QUrl &url)
65 { setIcon(m_rightButton, url); }
67 void setTopButtonIcon(const QUrl &url)
68 { setIcon(m_topButton, url); }
70 void setBottomButtonIcon(const QUrl &url)
71 { setIcon(m_bottomButton, url); }
73 QUrl icon() const {return QUrl(); }
75 LayoutWidget(QWidget *parent = 0);
78 bool leftAnchor() const { return m_leftAnchor; }
79 bool rightAnchor() const { return m_rightAnchor; }
80 bool topAnchor() const { return m_topAnchor; }
81 bool bottomAnchor() const { return m_bottomAnchor; }
84 void setLeftAnchor(bool anchor)
86 if (anchor == m_leftAnchor)
88 m_leftAnchor = anchor;
89 m_leftButton->setChecked(anchor);
90 emit leftAnchorChanged();
93 void setRightAnchor(bool anchor)
95 if (anchor == m_rightAnchor)
97 m_rightAnchor = anchor;
98 m_rightButton->setChecked(anchor);
99 emit rightAnchorChanged();
102 void setTopAnchor(bool anchor)
104 if (anchor == m_topAnchor)
106 m_topAnchor = anchor;
107 m_topButton->setChecked(anchor);
108 emit topAnchorChanged();
111 void setBottomAnchor(bool anchor)
113 if (anchor == m_bottomAnchor)
115 m_bottomAnchor = anchor;
116 m_bottomButton->setChecked(anchor);
117 emit bottomAnchorChanged();
121 //void colorChanged(const QColor &color);
123 void topAnchorChanged();
124 void bottomAnchorChanged();
125 void leftAnchorChanged();
126 void rightAnchorChanged();
129 void setIcon(QPushButton *button, QUrl url);
130 bool m_leftAnchor, m_rightAnchor, m_topAnchor, m_bottomAnchor;
131 QPushButton *m_leftButton;
132 QPushButton *m_rightButton;
133 QPushButton *m_topButton;
134 QPushButton *m_bottomButton;
135 QPushButton *m_middleButton;