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 QgsComposerPictureWidget::on_mPictureExpressionButton_clicked() { if ( !mPicture ) { return; } QgsVectorLayer* vl = 0; QgsComposition* composition = mPicture->composition(); if ( composition ) { QgsAtlasComposition* atlasMap = &composition->atlasComposition(); if ( atlasMap ) { vl = atlasMap->coverageLayer(); } } QgsExpressionBuilderDialog exprDlg( vl, mPictureExpressionLineEdit->text(), this ); exprDlg.setWindowTitle( tr( "Expression based image path" ) ); if ( exprDlg.exec() == QDialog::Accepted ) { QString expression = exprDlg.expressionText(); if ( !expression.isEmpty() ) { mPictureExpressionLineEdit->setText( expression ); setPictureExpression(); } } }
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_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_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(); } }
QgsAtlasComposition* QgsComposerItemBaseWidget::atlasComposition() const { if ( !mComposerObject ) { return 0; } QgsComposition* composition = mComposerObject->composition(); if ( !composition ) { return 0; } return &composition->atlasComposition(); }
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_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 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 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::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 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::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_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_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_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_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_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_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_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_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 QgsComposerMapWidget::updateMapForAtlas() { //update map if in atlas preview mode QgsComposition* composition = mComposerMap->composition(); if ( !composition ) { return; } if ( composition->atlasMode() == QgsComposition::AtlasOff ) { return; } //update atlas based extent for map QgsAtlasComposition* atlas = &composition->atlasComposition(); atlas->prepareMap( mComposerMap ); //redraw map mComposerMap->cache(); mComposerMap->update(); }
void QgsComposerHtmlWidget::on_mAddFramePushButton_clicked() { if ( !mHtml || !mFrame ) { return; } //create a new frame based on the current frame QPointF pos = mFrame->pos(); //shift new frame so that it sits 10 units below current frame pos.ry() += mFrame->rect().height() + 10; QgsComposerFrame * newFrame = mHtml->createNewFrame( mFrame, pos, mFrame->rect().size() ); mHtml->recalculateFrameSizes(); //set new frame as selection QgsComposition* composition = mHtml->composition(); if ( composition ) { composition->setSelectedItem( newFrame ); } }