From 806dda08d685bc5f9ed71dfe8b61f21848d48066 Mon Sep 17 00:00:00 2001 From: Gabriel de Dietrich Date: Fri, 17 Aug 2012 13:23:19 +0200 Subject: Moving .qdoc files under examples/widgets/doc Updated those .qdoc files to refer to the new relative examples emplacement. Images and snippets to be moved later. Also grouped all widgets related examples under widgets. Change-Id: Ib29696e2d8948524537f53e8dda88f9ee26a597f Reviewed-by: J-P Nurmi --- .../widgets/charactermap/charactermap.desktop | 11 ++ .../widgets/widgets/charactermap/charactermap.pro | 15 ++ .../widgets/charactermap/characterwidget.cpp | 177 ++++++++++++++++++ .../widgets/widgets/charactermap/characterwidget.h | 86 +++++++++ examples/widgets/widgets/charactermap/main.cpp | 51 ++++++ .../widgets/widgets/charactermap/mainwindow.cpp | 204 +++++++++++++++++++++ examples/widgets/widgets/charactermap/mainwindow.h | 87 +++++++++ 7 files changed, 631 insertions(+) create mode 100644 examples/widgets/widgets/charactermap/charactermap.desktop create mode 100644 examples/widgets/widgets/charactermap/charactermap.pro create mode 100644 examples/widgets/widgets/charactermap/characterwidget.cpp create mode 100644 examples/widgets/widgets/charactermap/characterwidget.h create mode 100644 examples/widgets/widgets/charactermap/main.cpp create mode 100644 examples/widgets/widgets/charactermap/mainwindow.cpp create mode 100644 examples/widgets/widgets/charactermap/mainwindow.h (limited to 'examples/widgets/widgets/charactermap') diff --git a/examples/widgets/widgets/charactermap/charactermap.desktop b/examples/widgets/widgets/charactermap/charactermap.desktop new file mode 100644 index 0000000000..7f1919470a --- /dev/null +++ b/examples/widgets/widgets/charactermap/charactermap.desktop @@ -0,0 +1,11 @@ +[Desktop Entry] +Encoding=UTF-8 +Version=1.0 +Type=Application +Terminal=false +Name=Character Map +Exec=/opt/usr/bin/charactermap +Icon=charactermap +X-Window-Icon= +X-HildonDesk-ShowInToolbar=true +X-Osso-Type=application/x-executable diff --git a/examples/widgets/widgets/charactermap/charactermap.pro b/examples/widgets/widgets/charactermap/charactermap.pro new file mode 100644 index 0000000000..0a9d6e7b5c --- /dev/null +++ b/examples/widgets/widgets/charactermap/charactermap.pro @@ -0,0 +1,15 @@ +HEADERS = characterwidget.h \ + mainwindow.h +SOURCES = characterwidget.cpp \ + mainwindow.cpp \ + main.cpp + +# install +target.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/charactermap +sources.files = $$SOURCES $$HEADERS $$RESOURCES $$FORMS charactermap.pro +sources.path = $$[QT_INSTALL_EXAMPLES]/qtbase/widgets/charactermap +INSTALLS += target sources + +QT += widgets + +simulator: warning(This example might not fully work on Simulator platform) diff --git a/examples/widgets/widgets/charactermap/characterwidget.cpp b/examples/widgets/widgets/charactermap/characterwidget.cpp new file mode 100644 index 0000000000..7ce5d61cf7 --- /dev/null +++ b/examples/widgets/widgets/charactermap/characterwidget.cpp @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "characterwidget.h" + +//! [0] +CharacterWidget::CharacterWidget(QWidget *parent) + : QWidget(parent) +{ + squareSize = 24; + columns = 16; + lastKey = -1; + setMouseTracking(true); +} +//! [0] + +//! [1] +void CharacterWidget::updateFont(const QFont &font) +{ + displayFont.setFamily(font.family()); + squareSize = qMax(24, QFontMetrics(displayFont).xHeight() * 3); + adjustSize(); + update(); +} +//! [1] + +//! [2] +void CharacterWidget::updateSize(const QString &fontSize) +{ + displayFont.setPointSize(fontSize.toInt()); + squareSize = qMax(24, QFontMetrics(displayFont).xHeight() * 3); + adjustSize(); + update(); +} +//! [2] + +void CharacterWidget::updateStyle(const QString &fontStyle) +{ + QFontDatabase fontDatabase; + const QFont::StyleStrategy oldStrategy = displayFont.styleStrategy(); + displayFont = fontDatabase.font(displayFont.family(), fontStyle, displayFont.pointSize()); + displayFont.setStyleStrategy(oldStrategy); + squareSize = qMax(24, QFontMetrics(displayFont).xHeight() * 3); + adjustSize(); + update(); +} + +void CharacterWidget::updateFontMerging(bool enable) +{ + if (enable) + displayFont.setStyleStrategy(QFont::PreferDefault); + else + displayFont.setStyleStrategy(QFont::NoFontMerging); + adjustSize(); + update(); +} + +//! [3] +QSize CharacterWidget::sizeHint() const +{ + return QSize(columns*squareSize, (65536/columns)*squareSize); +} +//! [3] + +//! [4] +void CharacterWidget::mouseMoveEvent(QMouseEvent *event) +{ + QPoint widgetPosition = mapFromGlobal(event->globalPos()); + uint key = (widgetPosition.y()/squareSize)*columns + widgetPosition.x()/squareSize; + + QString text = QString::fromLatin1("

Character: ").arg(displayFont.family()) + + QChar(key) + + QString::fromLatin1("

Value: 0x") + + QString::number(key, 16); + QToolTip::showText(event->globalPos(), text, this); +} +//! [4] + +//! [5] +void CharacterWidget::mousePressEvent(QMouseEvent *event) +{ + if (event->button() == Qt::LeftButton) { + lastKey = (event->y()/squareSize)*columns + event->x()/squareSize; + if (QChar(lastKey).category() != QChar::Other_NotAssigned) + emit characterSelected(QString(QChar(lastKey))); + update(); + } + else + QWidget::mousePressEvent(event); +} +//! [5] + +//! [6] +void CharacterWidget::paintEvent(QPaintEvent *event) +{ + QPainter painter(this); + painter.fillRect(event->rect(), QBrush(Qt::white)); + painter.setFont(displayFont); +//! [6] + +//! [7] + QRect redrawRect = event->rect(); + int beginRow = redrawRect.top()/squareSize; + int endRow = redrawRect.bottom()/squareSize; + int beginColumn = redrawRect.left()/squareSize; + int endColumn = redrawRect.right()/squareSize; +//! [7] + +//! [8] + painter.setPen(QPen(Qt::gray)); + for (int row = beginRow; row <= endRow; ++row) { + for (int column = beginColumn; column <= endColumn; ++column) { + painter.drawRect(column*squareSize, row*squareSize, squareSize, squareSize); + } +//! [8] //! [9] + } +//! [9] + +//! [10] + QFontMetrics fontMetrics(displayFont); + painter.setPen(QPen(Qt::black)); + for (int row = beginRow; row <= endRow; ++row) { + + for (int column = beginColumn; column <= endColumn; ++column) { + + int key = row*columns + column; + painter.setClipRect(column*squareSize, row*squareSize, squareSize, squareSize); + + if (key == lastKey) + painter.fillRect(column*squareSize + 1, row*squareSize + 1, squareSize, squareSize, QBrush(Qt::red)); + + painter.drawText(column*squareSize + (squareSize / 2) - fontMetrics.width(QChar(key))/2, + row*squareSize + 4 + fontMetrics.ascent(), + QString(QChar(key))); + } + } +} +//! [10] diff --git a/examples/widgets/widgets/charactermap/characterwidget.h b/examples/widgets/widgets/charactermap/characterwidget.h new file mode 100644 index 0000000000..d523c13011 --- /dev/null +++ b/examples/widgets/widgets/charactermap/characterwidget.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef CHARACTERWIDGET_H +#define CHARACTERWIDGET_H + +#include +#include +#include +#include +#include + +QT_BEGIN_NAMESPACE +class QMouseEvent; +class QPaintEvent; +QT_END_NAMESPACE + +//! [0] +class CharacterWidget : public QWidget +{ + Q_OBJECT + +public: + CharacterWidget(QWidget *parent = 0); + QSize sizeHint() const; + +public slots: + void updateFont(const QFont &font); + void updateSize(const QString &fontSize); + void updateStyle(const QString &fontStyle); + void updateFontMerging(bool enable); + +signals: + void characterSelected(const QString &character); + +protected: + void mouseMoveEvent(QMouseEvent *event); + void mousePressEvent(QMouseEvent *event); + void paintEvent(QPaintEvent *event); + +private: + QFont displayFont; + int columns; + int lastKey; + int squareSize; +}; +//! [0] + +#endif diff --git a/examples/widgets/widgets/charactermap/main.cpp b/examples/widgets/widgets/charactermap/main.cpp new file mode 100644 index 0000000000..09a923477c --- /dev/null +++ b/examples/widgets/widgets/charactermap/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "mainwindow.h" + +int main(int argc, char *argv[]) +{ + QApplication app(argc, argv); + MainWindow window; + window.show(); + return app.exec(); +} diff --git a/examples/widgets/widgets/charactermap/mainwindow.cpp b/examples/widgets/widgets/charactermap/mainwindow.cpp new file mode 100644 index 0000000000..fbe0df616c --- /dev/null +++ b/examples/widgets/widgets/charactermap/mainwindow.cpp @@ -0,0 +1,204 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include + +#include "characterwidget.h" +#include "mainwindow.h" + +//! [0] +MainWindow::MainWindow() +{ + QWidget *centralWidget = new QWidget; + + QLabel *fontLabel = new QLabel(tr("Font:")); + fontCombo = new QFontComboBox; + QLabel *sizeLabel = new QLabel(tr("Size:")); + sizeCombo = new QComboBox; + QLabel *styleLabel = new QLabel(tr("Style:")); + styleCombo = new QComboBox; + QLabel *fontMergingLabel = new QLabel(tr("Automatic Font Merging:")); + fontMerging = new QCheckBox; + fontMerging->setChecked(true); + + scrollArea = new QScrollArea; + characterWidget = new CharacterWidget; + scrollArea->setWidget(characterWidget); +//! [0] + +//! [1] + findStyles(fontCombo->currentFont()); +//! [1] + findSizes(fontCombo->currentFont()); + +//! [2] + lineEdit = new QLineEdit; +#ifndef QT_NO_CLIPBOARD + QPushButton *clipboardButton = new QPushButton(tr("&To clipboard")); +//! [2] + +//! [3] + clipboard = QApplication::clipboard(); +#endif +//! [3] + +//! [4] + connect(fontCombo, SIGNAL(currentFontChanged(QFont)), + this, SLOT(findStyles(QFont))); + connect(fontCombo, SIGNAL(currentFontChanged(QFont)), + this, SLOT(findSizes(QFont))); + connect(fontCombo, SIGNAL(currentFontChanged(QFont)), + characterWidget, SLOT(updateFont(QFont))); + connect(sizeCombo, SIGNAL(currentIndexChanged(QString)), + characterWidget, SLOT(updateSize(QString))); + connect(styleCombo, SIGNAL(currentIndexChanged(QString)), + characterWidget, SLOT(updateStyle(QString))); +//! [4] //! [5] + connect(characterWidget, SIGNAL(characterSelected(QString)), + this, SLOT(insertCharacter(QString))); + +#ifndef QT_NO_CLIPBOARD + connect(clipboardButton, SIGNAL(clicked()), this, SLOT(updateClipboard())); +#endif +//! [5] + connect(fontMerging, SIGNAL(toggled(bool)), characterWidget, SLOT(updateFontMerging(bool))); + +//! [6] + QHBoxLayout *controlsLayout = new QHBoxLayout; + controlsLayout->addWidget(fontLabel); + controlsLayout->addWidget(fontCombo, 1); + controlsLayout->addWidget(sizeLabel); + controlsLayout->addWidget(sizeCombo, 1); + controlsLayout->addWidget(styleLabel); + controlsLayout->addWidget(styleCombo, 1); + controlsLayout->addWidget(fontMergingLabel); + controlsLayout->addWidget(fontMerging, 1); + controlsLayout->addStretch(1); + + QHBoxLayout *lineLayout = new QHBoxLayout; + lineLayout->addWidget(lineEdit, 1); + lineLayout->addSpacing(12); +#ifndef QT_NO_CLIPBOARD + lineLayout->addWidget(clipboardButton); +#endif + + QVBoxLayout *centralLayout = new QVBoxLayout; + centralLayout->addLayout(controlsLayout); + centralLayout->addWidget(scrollArea, 1); + centralLayout->addSpacing(4); + centralLayout->addLayout(lineLayout); + centralWidget->setLayout(centralLayout); + + setCentralWidget(centralWidget); + setWindowTitle(tr("Character Map")); +} +//! [6] + +//! [7] +void MainWindow::findStyles(const QFont &font) +{ + QFontDatabase fontDatabase; + QString currentItem = styleCombo->currentText(); + styleCombo->clear(); +//! [7] + +//! [8] + QString style; + foreach (style, fontDatabase.styles(font.family())) + styleCombo->addItem(style); + + int styleIndex = styleCombo->findText(currentItem); + + if (styleIndex == -1) + styleCombo->setCurrentIndex(0); + else + styleCombo->setCurrentIndex(styleIndex); +} +//! [8] + +void MainWindow::findSizes(const QFont &font) +{ + QFontDatabase fontDatabase; + QString currentSize = sizeCombo->currentText(); + sizeCombo->blockSignals(true); + sizeCombo->clear(); + + int size; + if(fontDatabase.isSmoothlyScalable(font.family(), fontDatabase.styleString(font))) { + foreach(size, QFontDatabase::standardSizes()) { + sizeCombo->addItem(QVariant(size).toString()); + sizeCombo->setEditable(true); + } + + } else { + foreach(size, fontDatabase.smoothSizes(font.family(), fontDatabase.styleString(font))) { + sizeCombo->addItem(QVariant(size).toString()); + sizeCombo->setEditable(false); + } + } + + sizeCombo->blockSignals(false); + + int sizeIndex = sizeCombo->findText(currentSize); + + if(sizeIndex == -1) + sizeCombo->setCurrentIndex(qMax(0, sizeCombo->count() / 3)); + else + sizeCombo->setCurrentIndex(sizeIndex); +} + +//! [9] +void MainWindow::insertCharacter(const QString &character) +{ + lineEdit->insert(character); +} +//! [9] + +//! [10] +#ifndef QT_NO_CLIPBOARD +void MainWindow::updateClipboard() +{ +//! [11] + clipboard->setText(lineEdit->text(), QClipboard::Clipboard); +//! [11] + clipboard->setText(lineEdit->text(), QClipboard::Selection); +} +#endif +//! [10] diff --git a/examples/widgets/widgets/charactermap/mainwindow.h b/examples/widgets/widgets/charactermap/mainwindow.h new file mode 100644 index 0000000000..37109827ab --- /dev/null +++ b/examples/widgets/widgets/charactermap/mainwindow.h @@ -0,0 +1,87 @@ +/**************************************************************************** +** +** Copyright (C) 2012 Nokia Corporation and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/ +** +** This file is part of the examples of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:BSD$ +** You may use this file under the terms of the BSD license as follows: +** +** "Redistribution and use in source and binary forms, with or without +** modification, are permitted provided that the following conditions are +** met: +** * Redistributions of source code must retain the above copyright +** notice, this list of conditions and the following disclaimer. +** * Redistributions in binary form must reproduce the above copyright +** notice, this list of conditions and the following disclaimer in +** the documentation and/or other materials provided with the +** distribution. +** * Neither the name of Nokia Corporation and its Subsidiary(-ies) nor +** the names of its contributors may be used to endorse or promote +** products derived from this software without specific prior written +** permission. +** +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +** "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +** LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +** A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +** OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +** SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +** LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE." +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef MAINWINDOW_H +#define MAINWINDOW_H + +#include +#include + +QT_BEGIN_NAMESPACE +class QClipboard; +class QComboBox; +class QFontComboBox; +class QLineEdit; +class QScrollArea; +class QCheckBox; +QT_END_NAMESPACE +class CharacterWidget; + +//! [0] +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(); + +public slots: + void findStyles(const QFont &font); + void findSizes(const QFont &font); + void insertCharacter(const QString &character); +#ifndef QT_NO_CLIPBOARD + void updateClipboard(); +#endif + +private: + CharacterWidget *characterWidget; +#ifndef QT_NO_CLIPBOARD + QClipboard *clipboard; +#endif + QComboBox *styleCombo; + QComboBox *sizeCombo; + QFontComboBox *fontCombo; + QLineEdit *lineEdit; + QScrollArea *scrollArea; + QCheckBox *fontMerging; +}; +//! [0] + +#endif -- cgit v1.2.3