void QgsLabelingWidget::setLayer( QgsMapLayer* mapLayer ) { if ( !mapLayer || mapLayer->type() != QgsMapLayer::VectorLayer ) { setEnabled( false ); return; } else { setEnabled( true ); } QgsVectorLayer *layer = qobject_cast<QgsVectorLayer*>( mapLayer ); mLayer = layer; if ( mLayer->labeling() ) { QDomDocument doc; QDomElement oldSettings = mLayer->labeling()->save( doc ); mOldSettings.reset( QgsAbstractVectorLayerLabeling::create( oldSettings ) ); mOldPalSettings.readFromLayer( mLayer ); } else mOldSettings.reset(); adaptToLayer(); }
QgsLabelingWidget::QgsLabelingWidget( QgsVectorLayer* layer, QgsMapCanvas* canvas, QWidget* parent ) : QWidget( parent ) , mLayer( layer ) , mCanvas( canvas ) , mWidget( nullptr ) { setupUi( this ); connect( mEngineSettingsButton, SIGNAL( clicked() ), this, SLOT( showEngineConfigDialog() ) ); mLabelModeComboBox->setCurrentIndex( -1 ); connect( mLabelModeComboBox, SIGNAL( currentIndexChanged( int ) ), this, SLOT( labelModeChanged( int ) ) ); adaptToLayer(); }
void QgsLabelingWidget::setLayer( QgsMapLayer *mapLayer ) { if ( !mapLayer || mapLayer->type() != QgsMapLayer::VectorLayer ) { setEnabled( false ); return; } else { setEnabled( true ); } QgsVectorLayer *layer = qobject_cast<QgsVectorLayer *>( mapLayer ); mLayer = layer; if ( mLayer->labeling() ) { mOldSettings.reset( mLayer->labeling()->clone() ); } else mOldSettings.reset(); adaptToLayer(); }