QGIS API Documentation 3.99.0-Master (2fe06baccd8)
Loading...
Searching...
No Matches
qgsactionwidgetwrapper.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsactionwidgetwrapper.h - QgsActionWidgetWrapper
3
4 ---------------------
5 begin : 14.8.2021
6 copyright : (C) 2021 by Alessandro Pasotti
7 email : elpaso at itopen dot it
8 ***************************************************************************
9 * *
10 * This program is free software; you can redistribute it and/or modify *
11 * it under the terms of the GNU General Public License as published by *
12 * the Free Software Foundation; either version 2 of the License, or *
13 * (at your option) any later version. *
14 * *
15 ***************************************************************************/
16#ifndef QGSACTIONWIDGETWRAPPER_H
17#define QGSACTIONWIDGETWRAPPER_H
18
19#include "qgis_gui.h"
20#include "qgis_sip.h"
21#include "qgsaction.h"
22#include "qgswidgetwrapper.h"
23
24#include <QPushButton>
25
26class QgsMessageBar;
27
34{
35 Q_OBJECT
36
37 public:
46 QgsActionWidgetWrapper( QgsVectorLayer *layer, QWidget *editor, QWidget *parent, QgsMessageBar *messageBar = nullptr );
47
48 public:
52 void setAction( const QgsAction &action );
53
54 // QgsWidgetWrapper interface
55 bool valid() const override;
56 QWidget *createWidget( QWidget *parent ) override;
57 void initWidget( QWidget *editor ) override;
58
59 public slots:
60
61 void setFeature( const QgsFeature &feature ) override;
62 void setEnabled( bool enabled ) override;
63
64 private:
65 QgsMessageBar *mMessageBar = nullptr;
66 QPushButton *mActionButton = nullptr;
67 QgsAction mAction;
68 QgsFeature mFeature;
69};
70
71#endif // QGSACTIONWIDGETWRAPPER_H
void setAction(const QgsAction &action)
Sets the action.
QgsActionWidgetWrapper(QgsVectorLayer *layer, QWidget *editor, QWidget *parent, QgsMessageBar *messageBar=nullptr)
Create an action widget wrapper.
Utility class that encapsulates an action based on vector attributes.
Definition qgsaction.h:37
The feature class encapsulates a single feature including its unique ID, geometry and a list of field...
Definition qgsfeature.h:58
A bar for displaying non-blocking messages to the user.
Represents a vector layer which manages a vector based dataset.
virtual void setFeature(const QgsFeature &feature)=0
Is called when the value of the widget needs to be changed.
virtual bool valid() const =0
Returns true if the widget has been properly initialized.
virtual void initWidget(QWidget *editor)
This method should initialize the editor widget with runtime data.
QgsWidgetWrapper(QgsVectorLayer *vl, QWidget *editor=nullptr, QWidget *parent=nullptr)
Create a new widget wrapper.
QgsVectorLayer * layer() const
Returns the vector layer associated with the widget.
virtual QWidget * createWidget(QWidget *parent)=0
This method should create a new widget with the provided parent.
virtual void setEnabled(bool enabled)
Is used to enable or disable the edit functionality of the managed widget.