Skip to content
Permalink
Browse files

implement #1769

git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@11061 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef
jef committed Jul 13, 2009
1 parent 572f01e commit c6bb6b75ff96dead78b89283e0eb7d678992f57a
Showing with 24 additions and 27 deletions.
  1. +15 −8 src/app/qgslabeldialog.cpp
  2. +3 −1 src/app/qgslabeldialog.h
  3. +6 −18 src/ui/qgslabeldialogbase.ui
@@ -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 )
@@ -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() );
@@ -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
{
@@ -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
{
@@ -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 );
@@ -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
{
@@ -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() );
@@ -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:
@@ -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>
@@ -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>
@@ -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" >
@@ -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>
@@ -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>
@@ -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>

0 comments on commit c6bb6b7

Please sign in to comment.
You can’t perform that action at this time.