1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (info@qt.nokia.com)
10 ** GNU Lesser General Public License Usage
12 ** This file may be used under the terms of the GNU Lesser General Public
13 ** License version 2.1 as published by the Free Software Foundation and
14 ** appearing in the file LICENSE.LGPL included in the packaging of this file.
15 ** Please review the following information to ensure the GNU Lesser General
16 ** Public License version 2.1 requirements will be met:
17 ** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
19 ** In addition, as a special exception, Nokia gives you certain additional
20 ** rights. These rights are described in the Nokia Qt LGPL Exception
21 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
25 ** Alternatively, this file may be used in accordance with the terms and
26 ** conditions contained in a signed written agreement between you and Nokia.
28 ** If you have questions regarding the use of this file, please contact
29 ** Nokia at qt-info@nokia.com.
31 **************************************************************************/
34 #ifndef LAYOUTWIDGET_H
35 #define LAYOUTWIDGET_H
37 #include <QtGui/QFrame>
39 #include <QPushButton>
44 class LayoutWidget : public QFrame
48 Q_PROPERTY(bool leftAnchor READ leftAnchor WRITE setLeftAnchor NOTIFY leftAnchorChanged)
49 Q_PROPERTY(bool rightAnchor READ rightAnchor WRITE setRightAnchor NOTIFY rightAnchorChanged)
50 Q_PROPERTY(bool bottomAnchor READ bottomAnchor WRITE setBottomAnchor NOTIFY bottomAnchorChanged)
51 Q_PROPERTY(bool topAnchor READ topAnchor WRITE setTopAnchor NOTIFY topAnchorChanged)
53 Q_PROPERTY(QUrl leftButtonIcon READ icon WRITE setLeftButtonIcon)
54 Q_PROPERTY(QUrl rightButtonIcon READ icon WRITE setRightButtonIcon)
55 Q_PROPERTY(QUrl topButtonIcon READ icon WRITE setTopButtonIcon)
56 Q_PROPERTY(QUrl bottomButtonIcon READ icon WRITE setBottomButtonIcon)
60 void setLeftButtonIcon(const QUrl &url)
61 { setIcon(m_leftButton, url); }
63 void setRightButtonIcon(const QUrl &url)
64 { setIcon(m_rightButton, url); }
66 void setTopButtonIcon(const QUrl &url)
67 { setIcon(m_topButton, url); }
69 void setBottomButtonIcon(const QUrl &url)
70 { setIcon(m_bottomButton, url); }
72 QUrl icon() const {return QUrl(); }
74 LayoutWidget(QWidget *parent = 0);
77 bool leftAnchor() const { return m_leftAnchor; }
78 bool rightAnchor() const { return m_rightAnchor; }
79 bool topAnchor() const { return m_topAnchor; }
80 bool bottomAnchor() const { return m_bottomAnchor; }
83 void setLeftAnchor(bool anchor)
85 if (anchor == m_leftAnchor)
87 m_leftAnchor = anchor;
88 m_leftButton->setChecked(anchor);
89 emit leftAnchorChanged();
92 void setRightAnchor(bool anchor)
94 if (anchor == m_rightAnchor)
96 m_rightAnchor = anchor;
97 m_rightButton->setChecked(anchor);
98 emit rightAnchorChanged();
101 void setTopAnchor(bool anchor)
103 if (anchor == m_topAnchor)
105 m_topAnchor = anchor;
106 m_topButton->setChecked(anchor);
107 emit topAnchorChanged();
110 void setBottomAnchor(bool anchor)
112 if (anchor == m_bottomAnchor)
114 m_bottomAnchor = anchor;
115 m_bottomButton->setChecked(anchor);
116 emit bottomAnchorChanged();
120 //void colorChanged(const QColor &color);
122 void topAnchorChanged();
123 void bottomAnchorChanged();
124 void leftAnchorChanged();
125 void rightAnchorChanged();
128 void setIcon(QPushButton *button, QUrl url);
129 bool m_leftAnchor, m_rightAnchor, m_topAnchor, m_bottomAnchor;
130 QPushButton *m_leftButton;
131 QPushButton *m_rightButton;
132 QPushButton *m_topButton;
133 QPushButton *m_bottomButton;
134 QPushButton *m_middleButton;