Skip to content

Commit

Permalink
implement #1769
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11061 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jul 13, 2009
1 parent 572f01e commit c6bb6b7
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 27 deletions.
23 changes: 15 additions & 8 deletions src/app/qgslabeldialog.cpp
Expand Up @@ -152,7 +152,7 @@ void QgsLabelDialog::init( )
mFont.setFamily( myLabelAttributes->family() );
if ( myLabelAttributes->sizeIsSet() )
{
mFont.setPointSize( static_cast<int>( myLabelAttributes->size() ) );
mFont.setPointSizeF( myLabelAttributes->size() );

int myTypeInt = myLabelAttributes->sizeType();
if ( myTypeInt == QgsLabelAttributes::PointUnits )
Expand All @@ -166,10 +166,12 @@ void QgsLabelDialog::init( )
}
else //defaults for when no size has been set
{
mFont.setPointSize( static_cast<int>( myLabelAttributes->size() ) );
mFont.setPointSizeF( myLabelAttributes->size() );
radioFontSizeUnitsPoints->setChecked( true );
}

spinFontSize->setValue( myLabelAttributes->size() );

if ( myLabelAttributes->boldIsSet() )
{
mFont.setBold( myLabelAttributes->bold() );
Expand Down Expand Up @@ -200,8 +202,8 @@ void QgsLabelDialog::init( )
{
radioOffsetUnitsMap->setChecked( true );
}
spinXOffset->setValue( static_cast<int>( myLabelAttributes->xOffset() ) );
spinYOffset->setValue( static_cast<int>( myLabelAttributes->yOffset() ) );
spinXOffset->setValue( myLabelAttributes->xOffset() );
spinYOffset->setValue( myLabelAttributes->yOffset() );
}
else //defaults for when no offset is defined
{
Expand Down Expand Up @@ -247,7 +249,7 @@ void QgsLabelDialog::init( )
{
radioBufferUnitsMap->setChecked( true );
}
spinBufferSize->setValue( static_cast<int>( myLabelAttributes->bufferSize() ) );
spinBufferSize->setValue( myLabelAttributes->bufferSize() );
}
else //defaults for when no offset is defined
{
Expand All @@ -259,7 +261,7 @@ void QgsLabelDialog::init( )
chkUseBuffer->setChecked( myLabelAttributes->bufferEnabled() );

//NOTE: do we need this line too? TS
spinBufferSize->setValue( static_cast<int>( myLabelAttributes->bufferSize() ) );
spinBufferSize->setValue( myLabelAttributes->bufferSize() );
//TODO - transparency attributes for buffers

listWidget->setItemSelected( listWidget->item( 0 ), true );
Expand All @@ -271,11 +273,16 @@ void QgsLabelDialog::changeFont( void )
{
QgsDebugMsg( "entering." );

qreal fontSize = mFont.pointSizeF();
bool resultFlag;
mFont = QFontDialog::getFont( &resultFlag, mFont, this );
if ( resultFlag )
{
// font is set to the font the user selected
if ( mFont.pointSizeF() != fontSize )
{
// font is set to the font the user selected
spinFontSize->setValue( mFont.pointSizeF() );
}
}
else
{
Expand Down Expand Up @@ -341,7 +348,7 @@ void QgsLabelDialog::apply()
{
myTypeInt = QgsLabelAttributes::MapUnits;
}
myLabelAttributes->setSize( mFont.pointSize(), myTypeInt );
myLabelAttributes->setSize( mFont.pointSizeF(), myTypeInt );
myLabelAttributes->setBold( mFont.bold() );
myLabelAttributes->setItalic( mFont.italic() );
myLabelAttributes->setUnderline( mFont.underline() );
Expand Down
4 changes: 3 additions & 1 deletion src/app/qgslabeldialog.h
Expand Up @@ -74,8 +74,10 @@ class QgsLabelDialog: public QWidget, private Ui::QgsLabelDialogBase

void on_cboLabelField_activated( int ) {emit labelSourceSet(); }

void on_spinFontSize_valueChanged( double d ) { mFont.setPointSizeF( d ); lblSample->setFont( mFont ); }

signals:
/* emitted when anitem in label source list is chosen */
/* emitted when an item in label source list is chosen */
void labelSourceSet();

protected:
Expand Down
24 changes: 6 additions & 18 deletions src/ui/qgslabeldialogbase.ui
Expand Up @@ -180,22 +180,16 @@
</item>
<item row="0" column="1" >
<widget class="QLabel" name="textLabel5_2_2_3_2" >
<property name="enabled" >
<bool>false</bool>
</property>
<property name="text" >
<string>Font transparency</string>
<string>Font size</string>
</property>
<property name="alignment" >
<set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter</set>
</property>
</widget>
</item>
<item row="0" column="2" >
<widget class="QSpinBox" name="spinFontTransparency" >
<property name="enabled" >
<bool>false</bool>
</property>
<widget class="QDoubleSpinBox" name="spinFontSize" >
<property name="sizePolicy" >
<sizepolicy vsizetype="Fixed" hsizetype="Fixed" >
<horstretch>0</horstretch>
Expand All @@ -208,12 +202,6 @@
<height>0</height>
</size>
</property>
<property name="suffix" >
<string>%</string>
</property>
<property name="maximum" >
<number>100</number>
</property>
<property name="value" >
<number>0</number>
</property>
Expand Down Expand Up @@ -469,7 +457,7 @@
</widget>
</item>
<item row="1" column="1" >
<widget class="QSpinBox" name="spinBufferSize" />
<widget class="QDoubleSpinBox" name="spinBufferSize" />
</item>
<item row="2" column="0" >
<widget class="QLabel" name="textLabel5_2_2_3" >
Expand Down Expand Up @@ -575,7 +563,7 @@
</widget>
</item>
<item row="0" column="1" >
<widget class="QSpinBox" name="spinXOffset" >
<widget class="QDoubleSpinBox" name="spinXOffset" >
<property name="minimum" >
<number>-99</number>
</property>
Expand All @@ -589,7 +577,7 @@
</widget>
</item>
<item row="1" column="1" >
<widget class="QSpinBox" name="spinYOffset" >
<widget class="QDoubleSpinBox" name="spinYOffset" >
<property name="minimum" >
<number>-99</number>
</property>
Expand Down Expand Up @@ -1055,7 +1043,7 @@
<tabstop>leDefaultLabel</tabstop>
<tabstop>btnDefaultFont</tabstop>
<tabstop>pbnDefaultFontColor</tabstop>
<tabstop>spinFontTransparency</tabstop>
<tabstop>spinFontSize</tabstop>
<tabstop>radioFontSizeUnitsPoints</tabstop>
<tabstop>radioFontSizeUnitsMap</tabstop>
<tabstop>spinAngle</tabstop>
Expand Down

0 comments on commit c6bb6b7

Please sign in to comment.