|
Quantum GIS API Documentation
master-693a1fe
|
00001 /**************************************************************************** 00002 ** 00003 ** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies). 00004 ** All rights reserved. 00005 ** Contact: Nokia Corporation (qt-info@nokia.com) 00006 ** 00007 ** This library/program is free software; you can redistribute it 00008 ** and/or modify it under the terms of the GNU Library General Public 00009 ** License as published by the Free Software Foundation; either 00010 ** version 2 of the License, or ( at your option ) any later version. 00011 ** 00012 ** This file is part of the examples of the Qt Toolkit. 00013 ** 00014 ** $QT_BEGIN_LICENSE:LGPL$ 00015 ** Commercial Usage 00016 ** Licensees holding valid Qt Commercial licenses may use this file in 00017 ** accordance with the Qt Commercial License Agreement provided with the 00018 ** Software or, alternatively, in accordance with the terms contained in 00019 ** a written agreement between you and Nokia. 00020 ** 00021 ** GNU Lesser General Public License Usage 00022 ** Alternatively, this file may be used under the terms of the GNU Lesser 00023 ** General Public License version 2.1 as published by the Free Software 00024 ** Foundation and appearing in the file LICENSE.LGPL included in the 00025 ** packaging of this file. Please review the following information to 00026 ** ensure the GNU Lesser General Public License version 2.1 requirements 00027 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. 00028 ** 00029 ** In addition, as a special exception, Nokia gives you certain additional 00030 ** rights. These rights are described in the Nokia Qt LGPL Exception 00031 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. 00032 ** 00033 ** GNU General Public License Usage 00034 ** Alternatively, this file may be used under the terms of the GNU 00035 ** General Public License version 3.0 as published by the Free Software 00036 ** Foundation and appearing in the file LICENSE.GPL included in the 00037 ** packaging of this file. Please review the following information to 00038 ** ensure the GNU General Public License version 3.0 requirements will be 00039 ** met: http://www.gnu.org/copyleft/gpl.html. 00040 ** 00041 ** If you have questions regarding the use of this file, please contact 00042 ** Nokia at qt-info@nokia.com. 00043 ** $QT_END_LICENSE$ 00044 ** 00045 ****************************************************************************/ 00046 00047 #ifndef CHARACTERWIDGET_H 00048 #define CHARACTERWIDGET_H 00049 00050 #include <QFont> 00051 #include <QPoint> 00052 #include <QSize> 00053 #include <QString> 00054 #include <QWidget> 00055 00056 QT_BEGIN_NAMESPACE 00057 class QMouseEvent; 00058 class QPaintEvent; 00059 QT_END_NAMESPACE 00060 00062 class CharacterWidget : public QWidget 00063 { 00064 Q_OBJECT 00065 00066 public: 00067 CharacterWidget( QWidget *parent = 0 ); 00068 QSize sizeHint() const; 00069 00070 int getColumns() const { return columns; } 00071 int getSquareSize() const { return squareSize; } 00072 00073 public slots: 00074 void updateFont( const QFont &font ); 00075 void updateSize( double fontSize ); 00076 void updateStyle( const QString &fontStyle ); 00077 void updateFontMerging( bool enable ); 00078 void updateColumns( int cols ); 00079 00080 signals: 00081 void characterSelected( const QChar &character ); 00082 00083 protected: 00084 void mouseMoveEvent( QMouseEvent *event ); 00085 void mousePressEvent( QMouseEvent *event ); 00086 void paintEvent( QPaintEvent *event ); 00087 00088 private: 00089 QFont displayFont; 00090 int columns; 00091 int lastKey; 00092 int squareSize; 00093 }; 00095 00096 #endif