QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
19 #include <QDialogButtonBox>
20 #include <QMessageBox>
67 void QgsLegendPatchShapeWidget::saveShape()
74 saveDlg.setDefaultTags( mStyleItemsListWidget->currentTagFilter() );
75 if ( !saveDlg.exec() )
78 if ( saveDlg.name().isEmpty() )
84 int res = QMessageBox::warning(
this, tr(
"Save Legend Patch Shape" ),
85 tr(
"A legend patch shape with the name '%1' already exists. Overwrite?" )
86 .arg( saveDlg.name() ),
87 QMessageBox::Yes | QMessageBox::No );
88 if ( res != QMessageBox::Yes )
95 QStringList symbolTags = saveDlg.tags().split(
',' );
109 QVBoxLayout *vLayout =
new QVBoxLayout();
111 vLayout->addWidget( mWidget );
112 mButtonBox =
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok, Qt::Horizontal );
113 connect( mButtonBox, &QDialogButtonBox::accepted,
this, &QDialog::accept );
114 connect( mButtonBox, &QDialogButtonBox::rejected,
this, &QDialog::reject );
115 vLayout->addWidget( mButtonBox );
116 setLayout( vLayout );
117 setWindowTitle( tr(
"Legend Patch Shape" ) );
QgsGeometry geometry() const
Returns the geometry for the patch shape.
bool removeEntityByName(StyleEntity type, const QString &name)
Removes the entry of the specified type with matching name from the database.
QgsLegendPatchShape shape() const
Returns the legend patch shape defined by the dialog.
@ LegendPatchShapeEntity
Legend patch shape (since QGIS 3.14)
QgsSymbol::SymbolType symbolType() const
Returns the symbol type associated with this patch.
Represents a patch shape for use in map legends.
static QgsStyle * defaultStyle()
Returns default application-wide style.
bool preserveAspectRatio() const
Returns true if the patch shape should preserve its aspect ratio when it is resized to fit a desired ...
bool addLegendPatchShape(const QString &name, const QgsLegendPatchShape &shape, bool update=false)
Adds a legend patch shape with the specified name to the style.
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
static QgsGeometry fromWkt(const QString &wkt)
Creates a new geometry from a WKT string.
QString asWkt(int precision=17) const
Exports the geometry to WKT.
QgsLegendPatchShape legendPatchShape(const QString &name) const
Returns the legend patch shape with the specified name.
QgsLegendPatchShapeDialog(const QgsLegendPatchShape &shape, QWidget *parent=nullptr)
Constructor for QgsLegendPatchShapeDialog, initially showing the specified shape.
bool saveLegendPatchShape(const QString &name, const QgsLegendPatchShape &shape, bool favorite, const QStringList &tags)
Adds a legend patch shape to the database.
QStringList legendPatchShapeNames() const
Returns a list of names of legend patch shapes in the style.
StyleEntity
Enum for Entities involved in a style.