From 38be0d13830efd2d98281c645c3a60afe05ffece Mon Sep 17 00:00:00 2001 From: Qt by Nokia Date: Wed, 27 Apr 2011 12:05:43 +0200 Subject: Initial import from the monolithic Qt. This is the beginning of revision history for this module. If you want to look at revision history older than this, please refer to the Qt Git wiki for how to use Git history grafting. At the time of writing, this wiki is located here: http://qt.gitorious.org/qt/pages/GitIntroductionWithQt If you have already performed the grafting and you don't see any history beyond this commit, try running "git log" with the "--follow" argument. Branched from the monolithic repo, Qt master branch, at commit 896db169ea224deb96c59ce8af800d019de63f12 --- examples/widgets/charactermap/charactermap.pro | 13 ++ examples/widgets/charactermap/characterwidget.cpp | 177 ++++++++++++++++++++ examples/widgets/charactermap/characterwidget.h | 86 ++++++++++ examples/widgets/charactermap/main.cpp | 51 ++++++ examples/widgets/charactermap/mainwindow.cpp | 195 ++++++++++++++++++++++ examples/widgets/charactermap/mainwindow.h | 83 +++++++++ 6 files changed, 605 insertions(+) create mode 100644 examples/widgets/charactermap/charactermap.pro create mode 100644 examples/widgets/charactermap/characterwidget.cpp create mode 100644 examples/widgets/charactermap/characterwidget.h create mode 100644 examples/widgets/charactermap/main.cpp create mode 100644 examples/widgets/charactermap/mainwindow.cpp create mode 100644 examples/widgets/charactermap/mainwindow.h (limited to 'examples/widgets/charactermap') diff --git a/examples/widgets/charactermap/charactermap.pro b/examples/widgets/charactermap/charactermap.pro new file mode 100644 index 0000000000..290e7d6379 --- /dev/null +++ b/examples/widgets/charactermap/charactermap.pro @@ -0,0 +1,13 @@ +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 + +symbian: include($$QT_SOURCE_TREE/examples/symbianpkgrules.pri) diff --git a/examples/widgets/charactermap/characterwidget.cpp b/examples/widgets/charactermap/characterwidget.cpp new file mode 100644 index 0000000000..d9a59b68b2 --- /dev/null +++ b/examples/widgets/charactermap/characterwidget.cpp @@ -0,0 +1,177 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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::NoCategory) + 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/charactermap/characterwidget.h b/examples/widgets/charactermap/characterwidget.h new file mode 100644 index 0000000000..2ccb0aefed --- /dev/null +++ b/examples/widgets/charactermap/characterwidget.h @@ -0,0 +1,86 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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/charactermap/main.cpp b/examples/widgets/charactermap/main.cpp new file mode 100644 index 0000000000..01c8adae53 --- /dev/null +++ b/examples/widgets/charactermap/main.cpp @@ -0,0 +1,51 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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/charactermap/mainwindow.cpp b/examples/widgets/charactermap/mainwindow.cpp new file mode 100644 index 0000000000..bdff127423 --- /dev/null +++ b/examples/widgets/charactermap/mainwindow.cpp @@ -0,0 +1,195 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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; + QPushButton *clipboardButton = new QPushButton(tr("&To clipboard")); +//! [2] + +//! [3] + clipboard = QApplication::clipboard(); +//! [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))); + connect(clipboardButton, SIGNAL(clicked()), this, SLOT(updateClipboard())); +//! [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); + lineLayout->addWidget(clipboardButton); + + 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] +void MainWindow::updateClipboard() +{ +//! [11] + clipboard->setText(lineEdit->text(), QClipboard::Clipboard); +//! [11] + clipboard->setText(lineEdit->text(), QClipboard::Selection); +} +//! [10] diff --git a/examples/widgets/charactermap/mainwindow.h b/examples/widgets/charactermap/mainwindow.h new file mode 100644 index 0000000000..9c4e4f50ab --- /dev/null +++ b/examples/widgets/charactermap/mainwindow.h @@ -0,0 +1,83 @@ +/**************************************************************************** +** +** Copyright (C) 2011 Nokia Corporation and/or its subsidiary(-ies). +** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** 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); + void updateClipboard(); + +private: + CharacterWidget *characterWidget; + QClipboard *clipboard; + QComboBox *styleCombo; + QComboBox *sizeCombo; + QFontComboBox *fontCombo; + QLineEdit *lineEdit; + QScrollArea *scrollArea; + QCheckBox *fontMerging; +}; +//! [0] + +#endif -- cgit v1.2.3