|
Quantum GIS API Documentation
master-693a1fe
|
00001 /*************************************************************************** 00002 qgscharacterselectdialog.cpp - single font character selector dialog 00003 00004 --------------------- 00005 begin : November 2012 00006 copyright : (C) 2012 by Larry Shaffer 00007 email : larrys at dakcarto dot com 00008 *************************************************************************** 00009 * * 00010 * This program is free software; you can redistribute it and/or modify * 00011 * it under the terms of the GNU General Public License as published by * 00012 * the Free Software Foundation; either version 2 of the License, or * 00013 * (at your option) any later version. * 00014 * * 00015 ***************************************************************************/ 00016 00017 #include "characterwidget.h" 00018 #include "qgscharacterselectdialog.h" 00019 00020 00021 QgsCharacterSelectorDialog::QgsCharacterSelectorDialog( QWidget *parent, Qt::WFlags fl ) 00022 : QDialog( parent, fl ), mChar( QChar::Null ) 00023 { 00024 setupUi( this ); 00025 mCharWidget = new CharacterWidget( this ); 00026 mCharSelectScrollArea->setWidget( mCharWidget ); 00027 connect( mCharWidget, SIGNAL( characterSelected( const QChar & ) ), this, SLOT( setCharacter( const QChar & ) ) ); 00028 } 00029 00030 QgsCharacterSelectorDialog::~QgsCharacterSelectorDialog() 00031 { 00032 } 00033 00034 const QChar& QgsCharacterSelectorDialog::selectCharacter( bool* gotChar, const QFont& font, const QString& style ) 00035 { 00036 mCharSelectLabelFont->setText( QString( "%1 %2" ).arg( font.family() ).arg( style ) ); 00037 mCharWidget->updateFont( font ); 00038 mCharWidget->updateStyle( style ); 00039 mCharWidget->updateSize( 22.0 ); 00040 mCharSelectScrollArea->viewport()->update(); 00041 00042 QApplication::setOverrideCursor( Qt::ArrowCursor ); 00043 int res = exec(); 00044 QApplication::restoreOverrideCursor(); 00045 00046 if ( res == QDialog::Accepted ) 00047 { 00048 if ( !mChar.isNull() && gotChar ) 00049 { 00050 *gotChar = true; 00051 } 00052 } 00053 return mChar; 00054 } 00055 00056 void QgsCharacterSelectorDialog::setCharacter( const QChar & chr ) 00057 { 00058 mChar = chr; 00059 }