QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
qgscharacterselectordialog.cpp
Go to the documentation of this file.
1
/***************************************************************************
2
qgscharacterselectordialog.cpp - single font character selector dialog
3
4
---------------------
5
begin : November 2012
6
copyright : (C) 2012 by Larry Shaffer
7
email : larrys at dakcarto dot com
8
***************************************************************************
9
* *
10
* This program is free software; you can redistribute it and/or modify *
11
* it under the terms of the GNU General Public License as published by *
12
* the Free Software Foundation; either version 2 of the License, or *
13
* (at your option) any later version. *
14
* *
15
***************************************************************************/
16
17
#include "
qgscharacterselectordialog.h
"
18
19
#include "
characterwidget.h
"
20
21
#include <QString>
22
23
#include "moc_qgscharacterselectordialog.cpp"
24
25
using namespace
Qt::StringLiterals;
26
27
QgsCharacterSelectorDialog::QgsCharacterSelectorDialog
( QWidget *parent, Qt::WindowFlags fl )
28
: QDialog( parent, fl )
29
,
mChar
( QChar::Null )
30
{
31
setupUi(
this
);
32
mCharWidget
=
new
CharacterWidget
(
this
);
33
mCharSelectScrollArea->setWidget(
mCharWidget
);
34
mCharSelectScrollArea->setVerticalOnly(
true
);
35
connect(
mCharWidget
, &
CharacterWidget::characterSelected
,
this
, &QgsCharacterSelectorDialog::setCharacter );
36
}
37
38
QChar
QgsCharacterSelectorDialog::selectCharacter
(
bool
*gotChar,
const
QFont &font,
const
QString &style, QChar initialSelection )
39
{
40
mCharSelectLabelFont->setText( u
"%1 %2"
_s.arg( font.family(), style ) );
41
mCharWidget
->setFont( font );
42
mCharWidget
->setFontStyle( style );
43
mCharWidget
->setFontSize( 22.0 );
44
mCharSelectScrollArea->viewport()->update();
45
46
mCharWidget
->setCharacter( initialSelection );
47
48
QApplication::setOverrideCursor( Qt::ArrowCursor );
49
const
int
res = exec();
50
QApplication::restoreOverrideCursor();
51
52
if
( res == QDialog::Accepted )
53
{
54
if
( !
mChar
.isNull() && gotChar )
55
{
56
*gotChar =
true
;
57
}
58
}
59
return
mChar
;
60
}
61
62
void
QgsCharacterSelectorDialog::setCharacter( QChar chr )
63
{
64
mChar
= chr;
65
}
characterwidget.h
CharacterWidget
A widget for displaying characters available in a preset font, and allowing users to select an indivi...
Definition
characterwidget.h:69
CharacterWidget::characterSelected
void characterSelected(QChar character)
Emitted when a character is selected in the widget.
QgsCharacterSelectorDialog::mCharWidget
CharacterWidget * mCharWidget
Definition
qgscharacterselectordialog.h:57
QgsCharacterSelectorDialog::selectCharacter
QChar selectCharacter(bool *gotChar, const QFont &font, const QString &style, QChar initialSelection=QChar())
Opens the dialog modally and returns when the user has selected a character.
Definition
qgscharacterselectordialog.cpp:38
QgsCharacterSelectorDialog::QgsCharacterSelectorDialog
QgsCharacterSelectorDialog(QWidget *parent=nullptr, Qt::WindowFlags fl=QgsGuiUtils::ModalDialogFlags)
Definition
qgscharacterselectordialog.cpp:27
QgsCharacterSelectorDialog::mChar
QChar mChar
Definition
qgscharacterselectordialog.h:56
qgscharacterselectordialog.h
Generated on
for QGIS API Documentation by
1.17.0