Remove virtual

This commit is contained in:
Alessandro Pasotti 2018-10-18 11:07:05 +02:00
parent 7cbba8135a
commit dffd3b7311
4 changed files with 32 additions and 20 deletions

View File

@ -30,7 +30,7 @@ class QgsLayerTreeViewBadLayerIndicatorProvider : public QgsLayerTreeViewIndicat
explicit QgsLayerTreeViewBadLayerIndicatorProvider( QgsLayerTreeView *view );
private slots:
void onIndicatorClicked( const QModelIndex &index ) override;
void onIndicatorClicked( const QModelIndex &index );
private:
QString iconName( QgsMapLayer *layer ) override;

View File

@ -34,9 +34,9 @@ class QgsLayerTreeViewFilterIndicatorProvider : public QgsLayerTreeViewIndicator
// QgsLayerTreeViewIndicatorProvider interface
protected slots:
void onIndicatorClicked( const QModelIndex &index ) override;
void connectSignals( QgsMapLayer *layer ) override;
void disconnectSignals( QgsMapLayer *layer ) override;
void onIndicatorClicked( const QModelIndex &index ) ;
void connectSignals( QgsMapLayer *layer ) ;
void disconnectSignals( QgsMapLayer *layer ) ;
};
#endif // QGSLAYERTREEVIEWFILTERINDICATOR_H

View File

@ -38,8 +38,8 @@ class QgsMapLayer;
*
* Subclasses may override:
* - onIndicatorClicked() default implementation does nothing
* - connectSignals() default implementation connects vector layers to dataSourceChanged
* - disconnectSignals() default implementation disconnects vector layers from dataSourceChanged
* - connectSignals() default implementation connects vector layers to dataSourceChanged()
* - disconnectSignals() default implementation disconnects vector layers from dataSourceChanged()
*/
class QgsLayerTreeViewIndicatorProvider : public QObject
{
@ -49,27 +49,39 @@ class QgsLayerTreeViewIndicatorProvider : public QObject
explicit QgsLayerTreeViewIndicatorProvider( QgsLayerTreeView *view );
protected slots:
// Subclasses MAY override:
//! Action on indicator clicked, default implementation does nothing
void onIndicatorClicked( const QModelIndex &index ) { Q_UNUSED( index ) }
//! Connect signals, default implementation connects vector layers to dataSourceChanged()
void connectSignals( QgsMapLayer *layer );
//! Disconnect signals, default implementation disconnects vector layers from dataSourceChanged()
void disconnectSignals( QgsMapLayer *layer );
// End MAY overrides
//! Connects to signals of layers newly added to the tree
virtual void onAddedChildren( QgsLayerTreeNode *node, int indexFrom, int indexTo );
void onAddedChildren( QgsLayerTreeNode *node, int indexFrom, int indexTo );
//! Disconnects from layers about to be removed from the tree
virtual void onWillRemoveChildren( QgsLayerTreeNode *node, int indexFrom, int indexTo );
virtual void onLayerLoaded();
void onWillRemoveChildren( QgsLayerTreeNode *node, int indexFrom, int indexTo );
void onLayerLoaded();
//! Adds/removes indicator of a layer
virtual void onLayerChanged();
//! Action on indicator clicked
virtual void onIndicatorClicked( const QModelIndex &index ) { Q_UNUSED( index ) }
//! Connect signals
virtual void connectSignals( QgsMapLayer *layer );
//! Disconnect signals
virtual void disconnectSignals( QgsMapLayer *layer );
void onLayerChanged();
private:
//! Layer filter
// Subclasses MUST override:
//! Layer filter: layers that pass the test will get the indicator
virtual bool acceptLayer( QgsMapLayer *layer ) = 0;
//! Returns the icon name for the given \a layer, icon name is passed to QgsApplication::getThemeIcon()
virtual QString iconName( QgsMapLayer *layer ) = 0;
//! Returns the tooltip text for the given \a layer
virtual QString tooltipText( QgsMapLayer *layer ) = 0;
virtual std::unique_ptr< QgsLayerTreeViewIndicator > newIndicator( QgsMapLayer *layer );
virtual void addOrRemoveIndicator( QgsLayerTreeNode *node, QgsMapLayer *layer );
// End MUST overrides
//! Indicator factory
std::unique_ptr< QgsLayerTreeViewIndicator > newIndicator( QgsMapLayer *layer );
//! Add or remove the indicator to the given node
void addOrRemoveIndicator( QgsLayerTreeNode *node, QgsMapLayer *layer );
protected:
QgsLayerTreeView *mLayerTreeView = nullptr;

View File

@ -27,7 +27,7 @@ class QgsLayerTreeViewMemoryIndicatorProvider : public QgsLayerTreeViewIndicator
protected slots:
void onIndicatorClicked( const QModelIndex &index ) override;
void onIndicatorClicked( const QModelIndex &index );
private:
bool acceptLayer( QgsMapLayer *layer ) override;