Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
add copy and paste style actions to the layer node
- Loading branch information
Showing
with
11 additions
and
1 deletion.
-
+4
−1
src/core/qgsdataitem.h
-
+7
−0
src/providers/ows/qgsgeonodedataitems.cpp
|
@@ -141,7 +141,7 @@ class CORE_EXPORT QgsDataItem : public QObject |
|
|
/** Returns the list of actions available for this item. This is usually used for the popup menu on right-clicking |
|
|
* the item. Subclasses should override this to provide actions. |
|
|
*/ |
|
|
virtual QList<QAction *> actions() { return QList<QAction *>(); } |
|
|
virtual QList<QAction *> actions() { return mActions; } |
|
|
|
|
|
/** Returns whether the item accepts drag and dropped layers - e.g. for importing a dataset to a provider. |
|
|
* Subclasses should override this and handleDrop() to accept dropped layers. |
|
@@ -228,6 +228,8 @@ class CORE_EXPORT QgsDataItem : public QObject |
|
|
void setToolTip( const QString &msg ) { mToolTip = msg; } |
|
|
QString toolTip() const { return mToolTip; } |
|
|
|
|
|
void setActions( QList<QAction *> actions ) { mActions = actions; } |
|
|
|
|
|
// deleteLater() items anc clear the vector |
|
|
static void deleteLater( QVector<QgsDataItem *> &items ); |
|
|
|
|
@@ -265,6 +267,7 @@ class CORE_EXPORT QgsDataItem : public QObject |
|
|
QString mIconName; |
|
|
QIcon mIcon; |
|
|
QMap<QString, QIcon> mIconMap; |
|
|
QList<QAction *> mActions; |
|
|
|
|
|
public slots: |
|
|
|
|
|
|
@@ -176,6 +176,12 @@ QVector<QgsDataItem *> QgsGeoNodeServiceItem::createChildren() |
|
|
skipProvider = true; |
|
|
} |
|
|
|
|
|
// add new action menus to the layer item |
|
|
QAction *actionCopyStyle = new QAction( tr( "Copy Style" ), this ); |
|
|
QAction *actionPasteStyle = new QAction( tr( "Paste Style" ), this ); |
|
|
QList<QAction *> actions; |
|
|
actions << actionCopyStyle << actionPasteStyle; |
|
|
|
|
|
Q_FOREACH ( QgsDataItem *item, serviceItems.keys() ) |
|
|
{ |
|
|
QString providerKey = serviceItems.value( item ); |
|
@@ -190,6 +196,7 @@ QVector<QgsDataItem *> QgsGeoNodeServiceItem::createChildren() |
|
|
item->removeChildItem( subItem ); |
|
|
subItem->setParent( this ); |
|
|
replacePath( subItem, providerKey.toLower() + ":/", pathPrefix ); |
|
|
subItem->setActions( actions ); |
|
|
children.append( subItem ); |
|
|
} |
|
|
|
|
|