diff --git a/src/app/qgslabelinggui.cpp b/src/app/qgslabelinggui.cpp index 6c030e60760..e12d65fb1c7 100644 --- a/src/app/qgslabelinggui.cpp +++ b/src/app/qgslabelinggui.cpp @@ -48,7 +48,8 @@ QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsMapCanvas* mapCanvas, QWidget* parent ) : QWidget( parent ), mLBL( lbl ), mLayer( layer ), mMapCanvas( mapCanvas ) { - if ( !layer ) return; + if ( !layer ) + return; setupUi( this ); mCharDlg = new QgsCharacterSelectorDialog( this ); @@ -111,8 +112,8 @@ QgsLabelingGui::QgsLabelingGui( QgsPalLabeling* lbl, QgsVectorLayer* layer, QgsM break; case QGis::NoGeometry: break; - default: - Q_ASSERT( 0 && "NOOOO!" ); + case QGis::UnknownGeometry: + qFatal( "unknown geometry type unexpected" ); } // show/hide options based upon geometry type @@ -281,8 +282,6 @@ void QgsLabelingGui::init() case QgsPalLayerSettings::Free: radPolygonFree->setChecked( true ); break; - default: - Q_ASSERT( 0 && "NOOO!" ); } if ( lyr.placement == QgsPalLayerSettings::Line || lyr.placement == QgsPalLayerSettings::Curved ) @@ -366,9 +365,9 @@ void QgsLabelingGui::init() updateFont( mRefFont ); // show 'font not found' if substitution has occurred (should come after updateFont()) + mFontMissingLabel->setVisible( !lyr.mTextFontFound ); if ( !lyr.mTextFontFound ) { - mFontMissingLabel->setVisible( true ); QString missingTxt = tr( "%1 not found. Default substituted." ); QString txtPrepend = tr( "Chosen font" ); if ( !lyr.mTextFontFamily.isEmpty() ) @@ -565,7 +564,9 @@ QgsPalLayerSettings QgsLabelingGui::layerSettings() lyr.placement = QgsPalLayerSettings::Free; } else - Q_ASSERT( 0 && "NOOO!" ); + { + qFatal( "Invalid settings" ); + } lyr.textColor = btnTextColor->color(); @@ -1048,7 +1049,7 @@ void QgsLabelingGui::updateFont( QFont font ) } // test if font is actually available - mFontMissingLabel->setVisible( QgsFontUtils::fontMatchOnSystem( mRefFont ) ); + mFontMissingLabel->setVisible( !QgsFontUtils::fontMatchOnSystem( mRefFont ) ); mDirectSymbLeftLineEdit->setFont( mRefFont ); mDirectSymbRightLineEdit->setFont( mRefFont ); @@ -1115,7 +1116,8 @@ void QgsLabelingGui::updatePreview() } else // in points { - previewFont.setPointSize( fontSize ); + if ( fontSize > 0 ) + previewFont.setPointSize( fontSize ); mPreviewSizeSlider->setEnabled( false ); grpboxtitle = sampleTxt; diff --git a/src/core/qgsfontutils.cpp b/src/core/qgsfontutils.cpp index d1d4f70e730..96f34872e3a 100644 --- a/src/core/qgsfontutils.cpp +++ b/src/core/qgsfontutils.cpp @@ -53,7 +53,8 @@ bool QgsFontUtils::fontFamilyMatchOnSystem( const QString& family, QString* chos { // full 'family [foundry]' strings have to match *match = ( *it == family ); - if ( match ) { break; } + if ( *match ) + break; } else { diff --git a/src/core/qgspallabeling.cpp b/src/core/qgspallabeling.cpp index e8150591fe3..a13e975d896 100644 --- a/src/core/qgspallabeling.cpp +++ b/src/core/qgspallabeling.cpp @@ -1778,6 +1778,7 @@ void QgsPalLayerSettings::registerFeature( QgsVectorLayer* layer, QgsFeature& f } catch ( QgsCsException &cse ) { + Q_UNUSED( cse ); QgsDebugMsgLevel( QString( "Ignoring feature %1 due transformation exception" ).arg( f.id() ), 4 ); return; } @@ -2085,6 +2086,7 @@ void QgsPalLayerSettings::registerFeature( QgsVectorLayer* layer, QgsFeature& f } catch ( QgsCsException &e ) { + Q_UNUSED( e ); QgsDebugMsgLevel( QString( "Ignoring feature %1 due transformation exception on data-defined position" ).arg( f.id() ), 4 ); return; } diff --git a/src/ui/qgslabelingguibase.ui b/src/ui/qgslabelingguibase.ui index aa3ce2d095f..326ddd03d7a 100644 --- a/src/ui/qgslabelingguibase.ui +++ b/src/ui/qgslabelingguibase.ui @@ -1287,7 +1287,7 @@ font-style: italic; - missing font text + Font is missing. Qt::AlignLeading|Qt::AlignLeft|Qt::AlignVCenter