QGIS API Documentation  2.0.1-Dufour
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
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 ), mChar( QChar::Null )
23 {
24  setupUi( this );
25  mCharWidget = new CharacterWidget( this );
26  mCharSelectScrollArea->setWidget( mCharWidget );
27  connect( mCharWidget, SIGNAL( characterSelected( const QChar & ) ), this, SLOT( setCharacter( const QChar & ) ) );
28 }
29 
31 {
32 }
33 
34 const QChar& QgsCharacterSelectorDialog::selectCharacter( bool* gotChar, const QFont& font, const QString& style )
35 {
36  mCharSelectLabelFont->setText( QString( "%1 %2" ).arg( font.family() ).arg( style ) );
37  mCharWidget->updateFont( font );
38  mCharWidget->updateStyle( style );
39  mCharWidget->updateSize( 22.0 );
40  mCharSelectScrollArea->viewport()->update();
41 
42  QApplication::setOverrideCursor( Qt::ArrowCursor );
43  int res = exec();
44  QApplication::restoreOverrideCursor();
45 
46  if ( res == QDialog::Accepted )
47  {
48  if ( !mChar.isNull() && gotChar )
49  {
50  *gotChar = true;
51  }
52  }
53  return mChar;
54 }
55 
57 {
58  mChar = chr;
59 }