void QgsComposerAttributeTableWidget::on_mFeatureFilterCheckBox_stateChanged( int state ) { if ( !mComposerTable ) { return; } if ( state == Qt::Checked ) { mFeatureFilterEdit->setEnabled( true ); mFeatureFilterButton->setEnabled( true ); } else { mFeatureFilterEdit->setEnabled( false ); mFeatureFilterButton->setEnabled( false ); } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table feature filter toggled" ) ); } mComposerTable->setFilterFeatures( state == Qt::Checked ); mComposerTable->update(); if ( composition ) { composition->endMultiFrameCommand(); } }
void QgsComposerAttributeTableWidget::on_mFeatureFilterButton_clicked() { if ( !mComposerTable ) { return; } QgsExpressionBuilderDialog exprDlg( mComposerTable->vectorLayer(), mFeatureFilterEdit->text(), this ); exprDlg.setWindowTitle( tr( "Expression based filter" ) ); if ( exprDlg.exec() == QDialog::Accepted ) { QString expression = exprDlg.expressionText(); if ( !expression.isEmpty() ) { mFeatureFilterEdit->setText( expression ); QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table feature filter modified" ) ); } mComposerTable->setFeatureFilter( mFeatureFilterEdit->text() ); mComposerTable->update(); if ( composition ) { composition->endMultiFrameCommand(); } } } }
void QgsComposerAttributeTableWidget::on_mComposerMapComboBox_activated( int index ) { if ( !mComposerTable ) { return; } QVariant itemData = mComposerMapComboBox->itemData( index ); if ( itemData.type() == QVariant::Invalid ) { return; } int mapId = itemData.toInt(); const QgsComposition* tableComposition = mComposerTable->composition(); if ( tableComposition ) { QgsComposition* composition = mComposerTable->composition(); if ( sender() && composition ) //only create command if called from GUI { composition->beginMultiFrameCommand( mComposerTable, tr( "Table map changed" ) ); } mComposerTable->setComposerMap( tableComposition->getComposerMapById( mapId ) ); mComposerTable->update(); if ( sender() && composition ) { composition->endMultiFrameCommand(); } } }
void QgsComposerAttributeTableWidget::on_mContentFontPushButton_clicked() { if ( !mComposerTable ) { return; } bool ok; #if defined(Q_WS_MAC) && defined(QT_MAC_USE_COCOA) // Native Mac dialog works only for Qt Carbon QFont newFont = QFontDialog::getFont( &ok, mComposerTable->contentFont(), 0, tr( "Select Font" ), QFontDialog::DontUseNativeDialog ); #else QFont newFont = QFontDialog::getFont( &ok, mComposerTable->contentFont(), 0, tr( "Select Font" ) ); #endif if ( ok ) { QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table content font" ) ); } mComposerTable->setContentFont( newFont ); if ( composition ) { composition->endMultiFrameCommand(); } } }
void QgsComposerAttributeTableWidget::on_mAttributesPushButton_clicked() { if ( !mComposerTable ) { return; } //make deep copy of current columns, so we can restore them in case of cancellation QList<QgsComposerTableColumn*> currentColumns; QList<QgsComposerTableColumn*>::const_iterator it = mComposerTable->columns()->constBegin(); for ( ; it != mComposerTable->columns()->constEnd() ; ++it ) { QgsComposerTableColumn* copy = ( *it )->clone(); currentColumns.append( copy ); } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table attribute settings" ) ); } //temporarily block updates for the window, to stop table trying to repaint under windows (#11462) window()->setUpdatesEnabled( false ); QgsAttributeSelectionDialog d( mComposerTable, mComposerTable->sourceLayer(), 0 ); if ( d.exec() == QDialog::Accepted ) { mComposerTable->refreshAttributes(); //safe to unblock updates window()->setUpdatesEnabled( true ); mComposerTable->update(); if ( composition ) { composition->endMultiFrameCommand(); } //clear currentColumns to free memory qDeleteAll( currentColumns ); currentColumns.clear(); } else { //undo changes mComposerTable->setColumns( currentColumns ); window()->setUpdatesEnabled( true ); if ( composition ) { composition->cancelMultiFrameCommand(); } } }
void QgsComposerHtmlWidget::on_mInsertExpressionButton_clicked() { if ( !mHtml ) { return; } int line = 0; int index = 0; QString selText; if ( mHtmlEditor->hasSelectedText() ) { selText = mHtmlEditor->selectedText(); // edit the selected expression if there's one if ( selText.startsWith( "[%" ) && selText.endsWith( "%]" ) ) selText = selText.mid( 2, selText.size() - 4 ); } else { mHtmlEditor->getCursorPosition( &line, &index ); } // use the atlas coverage layer, if any QgsVectorLayer* coverageLayer = atlasCoverageLayer(); QScopedPointer<QgsExpressionContext> context( mHtml->createExpressionContext() ); QgsExpressionBuilderDialog exprDlg( coverageLayer, selText, this, "generic", *context ); exprDlg.setWindowTitle( tr( "Insert expression" ) ); if ( exprDlg.exec() == QDialog::Accepted ) { QString expression = exprDlg.expressionText(); QgsComposition* composition = mHtml->composition(); if ( !expression.isEmpty() && composition ) { blockSignals( true ); composition->beginMultiFrameCommand( mHtml, tr( "HTML source changed" ) ); if ( mHtmlEditor->hasSelectedText() ) { mHtmlEditor->replaceSelectedText( "[%" + expression + "%]" ); } else { mHtmlEditor->insertAt( "[%" + expression + "%]", line, index ); } composition->endMultiFrameCommand(); blockSignals( false ); } } }
void QgsComposerHtmlWidget::on_mResizeModeComboBox_currentIndexChanged( int index ) { if ( !mHtml ) { return; } QgsComposition* composition = mHtml->composition(); if ( composition ) { composition->beginMultiFrameCommand( mHtml, tr( "Change resize mode" ) ); mHtml->setResizeMode(( QgsComposerMultiFrame::ResizeMode )mResizeModeComboBox->itemData( index ).toInt() ); composition->endMultiFrameCommand(); } }
void QgsComposerHtmlWidget::on_mUserStylesheetCheckBox_toggled( bool checked ) { if ( !mHtml ) { return; } QgsComposition* composition = mHtml->composition(); if ( composition ) { blockSignals( true ); composition->beginMultiFrameCommand( mHtml, tr( "User stylesheet toggled" ) ); mHtml->setUserStylesheetEnabled( checked ); composition->endMultiFrameCommand(); blockSignals( false ); } }
void QgsComposerAttributeTableWidget::on_mAttributesPushButton_clicked() { if ( !mComposerTable ) { return; } //make deep copy of current columns, so we can restore them in case of cancellation QList<QgsComposerTableColumn*> currentColumns; QList<QgsComposerTableColumn*>::const_iterator it = mComposerTable->columns()->constBegin(); for ( ; it != mComposerTable->columns()->constEnd() ; ++it ) { QgsComposerTableColumn* copy = ( *it )->clone(); currentColumns.append( copy ); } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table attribute settings" ) ); } QgsAttributeSelectionDialog d( mComposerTable, mComposerTable->vectorLayer(), 0 ); if ( d.exec() == QDialog::Accepted ) { mComposerTable->refreshAttributes(); mComposerTable->update(); if ( composition ) { composition->endMultiFrameCommand(); } //clear currentColumns to free memory qDeleteAll( currentColumns ); currentColumns.clear(); } else { //undo changes mComposerTable->setColumns( currentColumns ); if ( composition ) { composition->cancelMultiFrameCommand(); } } }
void QgsComposerHtmlWidget::on_mEvaluateExpressionsCheckbox_toggled( bool checked ) { if ( !mHtml ) { return; } QgsComposition* composition = mHtml->composition(); if ( composition ) { blockSignals( true ); composition->beginMultiFrameCommand( mHtml, tr( "Evaluate expressions changed" ) ); mHtml->setEvaluateExpressions( checked ); composition->endMultiFrameCommand(); blockSignals( false ); } }
void QgsComposerHtmlWidget::on_mMaxDistanceSpinBox_valueChanged( double val ) { if ( !mHtml ) { return; } QgsComposition* composition = mHtml->composition(); if ( composition ) { blockSignals( true ); composition->beginMultiFrameCommand( mHtml, tr( "Page break distance changed" ) ); mHtml->setMaxBreakDistance( val ); composition->endMultiFrameCommand(); blockSignals( false ); } }
void QgsComposerHtmlWidget::stylesheetEditorChanged() { if ( !mHtml ) { return; } QgsComposition* composition = mHtml->composition(); if ( composition ) { blockSignals( true ); composition->beginMultiFrameCommand( mHtml, tr( "User stylesheet changed" ), QgsComposerMultiFrameMergeCommand::HtmlStylesheet ); mHtml->setUserStylesheet( mStylesheetEditor->text() ); composition->endMultiFrameCommand(); blockSignals( false ); } }
void QgsComposerAttributeTableWidget::on_mResizeModeComboBox_currentIndexChanged( int index ) { if ( !mComposerTable ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Change resize mode" ) ); mComposerTable->setResizeMode(( QgsComposerMultiFrame::ResizeMode )mResizeModeComboBox->itemData( index ).toInt() ); composition->endMultiFrameCommand(); } mAddFramePushButton->setEnabled( mComposerTable->resizeMode() == QgsComposerMultiFrame::UseExistingFrames ); }
void QgsComposerHtmlWidget::on_mUseSmartBreaksCheckBox_toggled( bool checked ) { if ( !mHtml ) { return; } QgsComposition* composition = mHtml->composition(); if ( composition ) { blockSignals( true ); composition->beginMultiFrameCommand( mHtml, tr( "Use smart breaks changed" ) ); mHtml->setUseSmartBreaks( checked ); composition->endMultiFrameCommand(); blockSignals( false ); } }
void QgsComposerAttributeTableWidget::on_mGridColorButton_colorChanged( const QColor& newColor ) { if ( !mComposerTable ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table grid color" ), QgsComposerMultiFrameMergeCommand::TableGridColor ); } mComposerTable->setGridColor( newColor ); if ( composition ) { composition->endMultiFrameCommand(); } }
void QgsComposerAttributeTableWidget::on_mHeaderModeComboBox_currentIndexChanged( int index ) { if ( !mComposerTable ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table header mode changed" ) ); } mComposerTable->setHeaderMode(( QgsComposerTableV2::HeaderMode )index ); if ( composition ) { composition->endMultiFrameCommand(); } }
void QgsComposerHtmlWidget::htmlEditorChanged() { if ( !mHtml ) { return; } QgsComposition* composition = mHtml->composition(); if ( composition ) { blockSignals( true ); composition->beginMultiFrameCommand( mHtml, tr( "HTML changed" ) ); mHtml->setHtml( mHtmlEditor->text() ); composition->endMultiFrameCommand(); blockSignals( false ); } }
void QgsComposerAttributeTableWidget::on_mBackgroundColorButton_colorChanged( const QColor& newColor ) { if ( !mComposerTable ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table background color" ) ); } mComposerTable->setBackgroundColor( newColor ); if ( composition ) { composition->endMultiFrameCommand(); } }
void QgsComposerAttributeTableWidget::on_mGridStrokeWidthSpinBox_valueChanged( double d ) { if ( !mComposerTable ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table grid stroke" ), QgsComposerMultiFrameMergeCommand::TableGridStrokeWidth ); } mComposerTable->setGridStrokeWidth( d ); if ( composition ) { composition->endMultiFrameCommand(); } }
void QgsComposerAttributeTableWidget::on_mShowGridGroupCheckBox_toggled( bool state ) { if ( !mComposerTable ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table grid toggled" ) ); } mComposerTable->setShowGrid( state ); if ( composition ) { composition->endMultiFrameCommand(); } }
void QgsComposerAttributeTableWidget::on_mMarginSpinBox_valueChanged( double d ) { if ( !mComposerTable ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table margin changed" ), QgsComposerMultiFrameMergeCommand::TableMargin ); } mComposerTable->setCellMargin( d ); if ( composition ) { composition->endMultiFrameCommand(); } }
void QgsComposerAttributeTableWidget::on_mContentFontColorButton_colorChanged( const QColor &newColor ) { if ( !mComposerTable ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table content font color" ) ); } mComposerTable->setContentFontColor( newColor ); mComposerTable->update(); if ( composition ) { composition->endMultiFrameCommand(); } }
void QgsComposerAttributeTableWidget::on_mFeatureFilterEdit_editingFinished() { if ( !mComposerTable ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table feature filter modified" ) ); } mComposerTable->setFeatureFilter( mFeatureFilterEdit->text() ); mComposerTable->update(); if ( composition ) { composition->endMultiFrameCommand(); } }
void QgsComposerAttributeTableWidget::on_mMaximumRowsSpinBox_valueChanged( int i ) { if ( !mComposerTable ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table maximum columns" ), QgsComposerMultiFrameMergeCommand::TableMaximumFeatures ); } mComposerTable->setMaximumNumberOfFeatures( i ); mComposerTable->update(); if ( composition ) { composition->endMultiFrameCommand(); } }
void QgsComposerAttributeTableWidget::on_mHeaderFontPushButton_clicked() { if ( !mComposerTable ) return; bool ok; QFont newFont = QgisGui::getFont( ok, mComposerTable->headerFont(), tr( "Select Font" ) ); if ( ok ) { QgsComposition *composition = mComposerTable->composition(); if ( composition ) composition->beginMultiFrameCommand( mComposerTable, tr( "Table header font" ) ); mComposerTable->setHeaderFont( newFont ); if ( composition ) composition->endMultiFrameCommand(); } }
void QgsComposerHtmlWidget::on_mUrlLineEdit_editingFinished() { if ( mHtml ) { QUrl newUrl( mUrlLineEdit->text() ); if ( newUrl == mHtml->url() ) { return; } QgsComposition* composition = mHtml->composition(); if ( composition ) { composition->beginMultiFrameCommand( mHtml, tr( "Change html url" ) ); mHtml->setUrl( newUrl ); mHtml->update(); composition->endMultiFrameCommand(); } } }
void QgsComposerHtmlWidget::on_mRadioUrlSource_clicked( bool checked ) { if ( !mHtml ) { return; } QgsComposition* composition = mHtml->composition(); if ( composition ) { blockSignals( true ); composition->beginMultiFrameCommand( mHtml, tr( "HTML source changed" ) ); mHtml->setContentMode( checked ? QgsComposerHtml::Url : QgsComposerHtml::ManualHtml ); composition->endMultiFrameCommand(); blockSignals( false ); } mHtmlEditor->setEnabled( !checked ); mInsertExpressionButton->setEnabled( !checked ); mUrlLineEdit->setEnabled( checked ); mFileToolButton->setEnabled( checked ); mHtml->loadHtml(); }
void QgsComposerAttributeTableWidget::composerMapChanged( const QgsComposerItem* item ) { if ( !mComposerTable ) { return; } const QgsComposition* tableComposition = mComposerTable->composition(); if ( tableComposition ) { QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table map changed" ) ); } mComposerTable->setComposerMap( dynamic_cast< const QgsComposerMap* >( item ) ); mComposerTable->update(); if ( composition ) { composition->endMultiFrameCommand(); } } }
void QgsComposerAttributeTableWidget::changeLayer( QgsMapLayer *layer ) { if ( !mComposerTable ) { return; } QgsVectorLayer* vl = dynamic_cast<QgsVectorLayer*>( layer ); if ( !vl ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table layer changed" ) ); } mComposerTable->setVectorLayer( vl ); mComposerTable->update(); if ( composition ) { composition->endMultiFrameCommand(); } if ( vl->geometryType() == QGis::NoGeometry ) { //layer has no geometry, so uncheck & disable controls which require geometry mShowOnlyVisibleFeaturesCheckBox->setChecked( false ); mShowOnlyVisibleFeaturesCheckBox->setEnabled( false ); } else { mShowOnlyVisibleFeaturesCheckBox->setEnabled( true ); } }
void QgsComposerAttributeTableWidget::on_mShowOnlyVisibleFeaturesCheckBox_stateChanged( int state ) { if ( !mComposerTable ) { return; } QgsComposition* composition = mComposerTable->composition(); if ( composition ) { composition->beginMultiFrameCommand( mComposerTable, tr( "Table visible only toggled" ) ); } bool showOnlyVisibleFeatures = ( state == Qt::Checked ); mComposerTable->setDisplayOnlyVisibleFeatures( showOnlyVisibleFeatures ); mComposerTable->update(); if ( composition ) { composition->endMultiFrameCommand(); } //enable/disable map combobox based on state of checkbox mComposerMapComboBox->setEnabled( state == Qt::Checked ); mComposerMapLabel->setEnabled( state == Qt::Checked ); }