QGIS API Documentation  2.18.21-Las Palmas (9fba24a)
qgscharacterselectdialog.cpp
Go to the documentation of this file.
1 /***************************************************************************
2  qgscharacterselectdialog.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 "characterwidget.h"
19 
20 
22  : QDialog( parent, fl )
23  , mChar( QChar::Null )
24 {
25  setupUi( this );
26  mCharWidget = new CharacterWidget( this );
27  mCharSelectScrollArea->setWidget( mCharWidget );
28  connect( mCharWidget, SIGNAL( characterSelected( const QChar & ) ), this, SLOT( setCharacter( const QChar & ) ) );
29 }
30 
32 {
33 }
34 
36 {
37  mCharSelectLabelFont->setText( QString( "%1 %2" ).arg( font.family(), style ) );
38  mCharWidget->updateFont( font );
39  mCharWidget->updateStyle( style );
40  mCharWidget->updateSize( 22.0 );
41  mCharSelectScrollArea->viewport()->update();
42 
43  QApplication::setOverrideCursor( Qt::ArrowCursor );
44  int res = exec();
46 
47  if ( res == QDialog::Accepted )
48  {
49  if ( !mChar.isNull() && gotChar )
50  {
51  *gotChar = true;
52  }
53  }
54  return mChar;
55 }
56 
57 void QgsCharacterSelectorDialog::setCharacter( QChar chr )
58 {
59  mChar = chr;
60 }
void setupUi(QWidget *widget)
void updateFont(const QFont &font)
[0]
void updateStyle(const QString &fontStyle)
[2]
QStyle * style() const
QgsCharacterSelectorDialog(QWidget *parent=nullptr, const Qt::WindowFlags &fl=QgisGui::ModalDialogFlags)
int exec()
void updateSize(double fontSize)
[1]
void setOverrideCursor(const QCursor &cursor)
void restoreOverrideCursor()
bool isNull() const
const QChar & selectCharacter(bool *gotChar, const QFont &font, const QString &style)
const QFont & font() const
QString family() const
typedef WindowFlags
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)