Skip to content
Permalink
Browse files

[composer] Fix update of gui controls when table and HTML properties

change (sponsored by City of Uster, Switzerland)
  • Loading branch information
nyalldawson committed Sep 16, 2014
1 parent 2d24b32 commit e9f4bbcb41fd6d0356c61bf9c7f88209c47d3133
@@ -60,8 +60,7 @@ QgsComposerAttributeTableWidget::QgsComposerAttributeTableWidget( QgsComposerAtt

if ( mComposerTable )
{
QObject::connect( mComposerTable, SIGNAL( maximumNumberOfFeaturesChanged( int ) ), this, SLOT( setMaximumNumberOfFeatures( int ) ) );
QObject::connect( mComposerTable, SIGNAL( itemChanged() ), this, SLOT( updateGuiElements() ) );
QObject::connect( mComposerTable, SIGNAL( changed() ), this, SLOT( updateGuiElements() ) );
}
}

@@ -55,7 +55,6 @@ QgsComposerTableWidget::QgsComposerTableWidget( QgsComposerAttributeTable* table

if ( mComposerTable )
{
QObject::connect( mComposerTable, SIGNAL( maximumNumberOfFeaturesChanged( int ) ), this, SLOT( setMaximumNumberOfFeatures( int ) ) );
QObject::connect( mComposerTable, SIGNAL( itemChanged() ), this, SLOT( updateGuiElements() ) );
}
}
@@ -281,9 +281,6 @@ class CORE_EXPORT QgsComposerAttributeTable: public QgsComposerTable
/**Checks if this vector layer will be removed (and sets mVectorLayer to 0 if yes) */
void removeLayer( QString layerId );

signals:
/**This signal is emitted if the maximum number of feature changes (interactively)*/
void maximumNumberOfFeaturesChanged( int n );
};

#endif // QGSCOMPOSERATTRIBUTETABLE_H
@@ -157,6 +157,8 @@ void QgsComposerAttributeTableV2::setVectorLayer( QgsVectorLayer* layer )

//listen for modifications to layer and refresh table when they occur
QObject::connect( mVectorLayer, SIGNAL( layerModified() ), this, SLOT( refreshAttributes() ) );

emit changed();
}

void QgsComposerAttributeTableV2::resetColumns()
@@ -202,6 +204,7 @@ void QgsComposerAttributeTableV2::setComposerMap( const QgsComposerMap* map )
QObject::connect( mComposerMap, SIGNAL( extentChanged() ), this, SLOT( refreshAttributes() ) );
}
refreshAttributes();
emit changed();
}

void QgsComposerAttributeTableV2::setMaximumNumberOfFeatures( int features )
@@ -213,6 +216,7 @@ void QgsComposerAttributeTableV2::setMaximumNumberOfFeatures( int features )

mMaximumNumberOfFeatures = features;
refreshAttributes();
emit changed();
}

void QgsComposerAttributeTableV2::setDisplayOnlyVisibleFeatures( bool visibleOnly )
@@ -224,6 +228,7 @@ void QgsComposerAttributeTableV2::setDisplayOnlyVisibleFeatures( bool visibleOnl

mShowOnlyVisibleFeatures = visibleOnly;
refreshAttributes();
emit changed();
}

void QgsComposerAttributeTableV2::setFilterFeatures( bool filter )
@@ -235,6 +240,7 @@ void QgsComposerAttributeTableV2::setFilterFeatures( bool filter )

mFilterFeatures = filter;
refreshAttributes();
emit changed();
}

void QgsComposerAttributeTableV2::setFeatureFilter( const QString& expression )
@@ -246,6 +252,7 @@ void QgsComposerAttributeTableV2::setFeatureFilter( const QString& expression )

mFeatureFilter = expression;
refreshAttributes();
emit changed();
}

void QgsComposerAttributeTableV2::setDisplayAttributes( const QSet<int>& attr, bool refresh )
@@ -228,9 +228,6 @@ class CORE_EXPORT QgsComposerAttributeTableV2: public QgsComposerTableV2
/**Checks if this vector layer will be removed (and sets mVectorLayer to 0 if yes) */
void removeLayer( QString layerId );

signals:
/**This signal is emitted if the maximum number of feature changes (interactively)*/
void maximumNumberOfFeaturesChanged( int n );
};

#endif // QGSCOMPOSERATTRIBUTETABLEV2_H
@@ -96,17 +96,23 @@ void QgsComposerHtml::setUrl( const QUrl& url )

mUrl = url;
loadHtml();
emit changed();
}

void QgsComposerHtml::setHtml( const QString html )
{
mHtml = html;
//TODO - this signal should be emitted, but without changing the signal which sets the html
//to an equivalent of editingFinished it causes a lot of problems. Need to investigate
//ways of doing this using QScintilla widgets.
//emit changed();
}

void QgsComposerHtml::setEvaluateExpressions( bool evaluateExpressions )
{
mEvaluateExpressions = evaluateExpressions;
loadHtml();
emit changed();
}

void QgsComposerHtml::loadHtml()
@@ -400,6 +406,10 @@ void QgsComposerHtml::setMaxBreakDistance( double maxBreakDistance )
void QgsComposerHtml::setUserStylesheet( const QString stylesheet )
{
mUserStylesheet = stylesheet;
//TODO - this signal should be emitted, but without changing the signal which sets the css
//to an equivalent of editingFinished it causes a lot of problems. Need to investigate
//ways of doing this using QScintilla widgets.
//emit changed();
}

void QgsComposerHtml::setUserStylesheetEnabled( const bool stylesheetEnabled )
@@ -408,6 +418,7 @@ void QgsComposerHtml::setUserStylesheetEnabled( const bool stylesheetEnabled )
{
mEnableUserStylesheet = stylesheetEnabled;
loadHtml();
emit changed();
}
}

@@ -61,6 +61,7 @@ bool QgsComposerTableV2::writeXML( QDomElement& elem, QDomDocument & doc, bool i
elem.setAttribute( "headerFont", mHeaderFont.toString() );
elem.setAttribute( "headerFontColor", QgsSymbolLayerV2Utils::encodeColor( mHeaderFontColor ) );
elem.setAttribute( "headerHAlignment", QString::number(( int )mHeaderHAlignment ) );
elem.setAttribute( "headerMode", QString::number(( int )mHeaderMode ) );
elem.setAttribute( "contentFont", mContentFont.toString() );
elem.setAttribute( "contentFontColor", QgsSymbolLayerV2Utils::encodeColor( mContentFontColor ) );
elem.setAttribute( "gridStrokeWidth", QString::number( mGridStrokeWidth ) );
@@ -288,8 +289,11 @@ void QgsComposerTableV2::setCellMargin( const double margin )
}

mCellMargin = margin;

//since spacing has changed, we need to recalculate the table size
adjustFrameToSize();

emit changed();
}

void QgsComposerTableV2::setHeaderFont( const QFont &font )
@@ -302,6 +306,8 @@ void QgsComposerTableV2::setHeaderFont( const QFont &font )
mHeaderFont = font;
//since font attributes have changed, we need to recalculate the table size
adjustFrameToSize();

emit changed();
}

void QgsComposerTableV2::setHeaderFontColor( const QColor &color )
@@ -313,6 +319,8 @@ void QgsComposerTableV2::setHeaderFontColor( const QColor &color )

mHeaderFontColor = color;
repaint();

emit changed();
}

void QgsComposerTableV2::setHeaderHAlignment( const QgsComposerTableV2::HeaderHAlignment alignment )
@@ -324,6 +332,8 @@ void QgsComposerTableV2::setHeaderHAlignment( const QgsComposerTableV2::HeaderHA

mHeaderHAlignment = alignment;
repaint();

emit changed();
}

void QgsComposerTableV2::setHeaderMode( const QgsComposerTableV2::HeaderMode mode )
@@ -336,6 +346,7 @@ void QgsComposerTableV2::setHeaderMode( const QgsComposerTableV2::HeaderMode mod
mHeaderMode = mode;
adjustFrameToSize();

emit changed();
}

void QgsComposerTableV2::setContentFont( const QFont &font )
@@ -348,6 +359,8 @@ void QgsComposerTableV2::setContentFont( const QFont &font )
mContentFont = font;
//since font attributes have changed, we need to recalculate the table size
adjustFrameToSize();

emit changed();
}

void QgsComposerTableV2::setContentFontColor( const QColor &color )
@@ -359,6 +372,8 @@ void QgsComposerTableV2::setContentFontColor( const QColor &color )

mContentFontColor = color;
repaint();

emit changed();
}

void QgsComposerTableV2::setShowGrid( const bool showGrid )
@@ -371,6 +386,8 @@ void QgsComposerTableV2::setShowGrid( const bool showGrid )
mShowGrid = showGrid;
//since grid spacing has changed, we need to recalculate the table size
adjustFrameToSize();

emit changed();
}

void QgsComposerTableV2::setGridStrokeWidth( const double width )
@@ -383,6 +400,8 @@ void QgsComposerTableV2::setGridStrokeWidth( const double width )
mGridStrokeWidth = width;
//since grid spacing has changed, we need to recalculate the table size
adjustFrameToSize();

emit changed();
}

void QgsComposerTableV2::setGridColor( const QColor &color )
@@ -394,6 +413,8 @@ void QgsComposerTableV2::setGridColor( const QColor &color )

mGridColor = color;
repaint();

emit changed();
}

void QgsComposerTableV2::setColumns( QgsComposerTableColumns columns )

0 comments on commit e9f4bbc

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