QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
symbology
characterwidget.h
Go to the documentation of this file.
1
/****************************************************************************
2
**
3
** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
4
** All rights reserved.
5
** Contact: Nokia Corporation (qt-info@nokia.com)
6
**
7
** This library/program is free software; you can redistribute it
8
** and/or modify it under the terms of the GNU Library General Public
9
** License as published by the Free Software Foundation; either
10
** version 2 of the License, or ( at your option ) any later version.
11
**
12
** This file is part of the examples of the Qt Toolkit.
13
**
14
** $QT_BEGIN_LICENSE:LGPL$
15
** Commercial Usage
16
** Licensees holding valid Qt Commercial licenses may use this file in
17
** accordance with the Qt Commercial License Agreement provided with the
18
** Software or, alternatively, in accordance with the terms contained in
19
** a written agreement between you and Nokia.
20
**
21
** GNU Lesser General Public License Usage
22
** Alternatively, this file may be used under the terms of the GNU Lesser
23
** General Public License version 2.1 as published by the Free Software
24
** Foundation and appearing in the file LICENSE.LGPL included in the
25
** packaging of this file. Please review the following information to
26
** ensure the GNU Lesser General Public License version 2.1 requirements
27
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
28
**
29
** In addition, as a special exception, Nokia gives you certain additional
30
** rights. These rights are described in the Nokia Qt LGPL Exception
31
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
32
**
33
** GNU General Public License Usage
34
** Alternatively, this file may be used under the terms of the GNU
35
** General Public License version 3.0 as published by the Free Software
36
** Foundation and appearing in the file LICENSE.GPL included in the
37
** packaging of this file. Please review the following information to
38
** ensure the GNU General Public License version 3.0 requirements will be
39
** met: http://www.gnu.org/copyleft/gpl.html.
40
**
41
** If you have questions regarding the use of this file, please contact
42
** Nokia at qt-info@nokia.com.
43
** $QT_END_LICENSE$
44
**
45
****************************************************************************/
46
47
#ifndef CHARACTERWIDGET_H
48
#define CHARACTERWIDGET_H
49
50
#include "qgis_gui.h"
51
#include "
qgis_sip.h
"
52
53
#include <QFont>
54
#include <QPoint>
55
#include <QSize>
56
#include <QString>
57
#include <QWidget>
58
59
class
QMouseEvent;
60
class
QPaintEvent;
61
68
class
GUI_EXPORT
CharacterWidget
:
public
QWidget
69
{
70
Q_OBJECT
71
Q_PROPERTY( QChar
character
READ
character
WRITE
setCharacter
NOTIFY
characterSelected
)
72
Q_PROPERTY(
int
columns
READ
columns
WRITE
setColumns
)
73
Q_PROPERTY( QFont
font
READ
font
WRITE
setFont
)
74
75
public:
79
CharacterWidget
( QWidget *parent
SIP_TRANSFERTHIS
=
nullptr
);
80
81
QSize
sizeHint
() const override;
82
86
int
columns
()
const
{
return
mColumns; }
87
91
int
squareSize
()
const
{
return
mSquareSize; }
92
97
QChar
character
()
const
{
return
QChar( mLastKey ); }
98
103
QFont
font
()
const
{
return
mDisplayFont; }
104
105
public
slots:
106
111
void
setFont(
const
QFont &font );
112
116
void
setFontSize(
double
fontSize );
117
121
void
setFontStyle(
const
QString &fontStyle );
122
123
void
updateFontMerging(
bool
enable );
124
128
void
setColumns(
int
columns );
129
135
void
setCharacter( QChar character );
136
142
void
clearCharacter();
143
144
signals:
145
149
void
characterSelected
( QChar
character
);
150
151
protected
:
152
void
keyPressEvent
( QKeyEvent *event )
override
;
153
void
mouseMoveEvent
( QMouseEvent *event )
override
;
154
void
mousePressEvent
( QMouseEvent *event )
override
;
155
void
paintEvent
( QPaintEvent *event )
override
;
156
void
resizeEvent
( QResizeEvent *event )
override
;
157
158
private
:
159
QFont mDisplayFont;
160
int
mColumns = 13;
161
int
mLastKey = -1;
162
int
mSquareSize = 24;
163
};
164
165
#endif
CharacterWidget::keyPressEvent
void keyPressEvent(QKeyEvent *event) override
Definition
characterwidget.cpp:149
CharacterWidget::character
QChar character() const
Returns the currently selected character in the widget.
Definition
characterwidget.h:97
CharacterWidget::font
QFont font() const
Returns the font shown in the widget.
Definition
characterwidget.h:103
CharacterWidget::characterSelected
void characterSelected(QChar character)
Emitted when a character is selected in the widget.
CharacterWidget::setCharacter
void setCharacter(QChar character)
Sets the currently selected character in the widget.
Definition
characterwidget.cpp:119
CharacterWidget::setFont
void setFont(const QFont &font)
Sets the font to show in the widget.
Definition
characterwidget.cpp:73
CharacterWidget::mousePressEvent
void mousePressEvent(QMouseEvent *event) override
Definition
characterwidget.cpp:231
CharacterWidget::sizeHint
QSize sizeHint() const override
Definition
characterwidget.cpp:144
CharacterWidget::paintEvent
void paintEvent(QPaintEvent *event) override
Definition
characterwidget.cpp:244
CharacterWidget::CharacterWidget
CharacterWidget(QWidget *parent=nullptr)
Constructor for CharacterWidget.
Definition
characterwidget.cpp:66
CharacterWidget::columns
int columns
Definition
characterwidget.h:72
CharacterWidget::font
QFont font
Definition
characterwidget.h:73
CharacterWidget::character
QChar character
Definition
characterwidget.h:71
CharacterWidget::setColumns
void setColumns(int columns)
Sets the number of columns of characters to show in the widget.
Definition
characterwidget.cpp:110
CharacterWidget::squareSize
int squareSize() const
Returns the size (in pixels) of the square used to render each character preview.
Definition
characterwidget.h:91
CharacterWidget::resizeEvent
void resizeEvent(QResizeEvent *event) override
Definition
characterwidget.cpp:288
CharacterWidget::mouseMoveEvent
void mouseMoveEvent(QMouseEvent *event) override
Definition
characterwidget.cpp:217
qgis_sip.h
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
Generated on
for QGIS API Documentation by
1.17.0