Skip to content

Commit

Permalink
Remove virtual
Browse files Browse the repository at this point in the history
  • Loading branch information
elpaso committed Oct 21, 2018
1 parent 7cbba81 commit dffd3b7
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/app/qgslayertreeviewbadlayerindicator.h
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions src/app/qgslayertreeviewfilterindicator.h
Expand Up @@ -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
42 changes: 27 additions & 15 deletions src/app/qgslayertreeviewindicatorprovider.h
Expand Up @@ -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
{
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgslayertreeviewmemoryindicator.h
Expand Up @@ -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;
Expand Down

0 comments on commit dffd3b7

Please sign in to comment.