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 **************************************************************************/
36 #include <QWeakPointer>
38 #include <qdeclarative.h>
47 namespace QmlDesigner {
49 class FontWidget : public QWidget
52 Q_PROPERTY(QString text READ text WRITE setText)
53 Q_PROPERTY(QString family READ family WRITE setFamily NOTIFY familyChanged)
54 Q_PROPERTY(bool bold READ isBold WRITE setBold NOTIFY boldChanged)
55 Q_PROPERTY(bool italic READ isItalic WRITE setItalic NOTIFY italicChanged)
56 Q_PROPERTY(qreal fontSize READ fontSize WRITE setFontSize NOTIFY fontSizeChanged)
57 Q_PROPERTY(QFont dataFont READ font WRITE setFont NOTIFY dataFontChanged)
60 FontWidget(QWidget *parent = 0);
64 void setText(const QString &text);
66 QString family() const;
67 void setFamily(const QString &fontFamily);
70 void setBold(bool isBold);
72 bool isItalic() const;
73 void setItalic(bool isItalic);
75 qreal fontSize() const;
76 void setFontSize(qreal size);
79 void setFont(QFont size);
81 static void registerDeclarativeTypes();
87 void fontSizeChanged();
88 void dataFontChanged();
91 void openFontEditor(bool show);
93 void resetFontButton();
98 QPushButton *m_fontButton;
99 QWeakPointer<QFontDialog> m_fontDialog;
102 } // namespace QmlDesigner
104 QML_DECLARE_TYPE(QmlDesigner::FontWidget)
106 #endif // FONTWIDGET_H