21#include <QDialogButtonBox> 
   60void QgsLegendPatchShapeWidget::setShapeFromStyle( 
const QString &name, 
QgsStyle::StyleEntity, 
const QString &stylePath )
 
   77void QgsLegendPatchShapeWidget::saveShape()
 
   80  saveDlg.setDefaultTags( mStyleItemsListWidget->currentTagFilter() );
 
   81  if ( !saveDlg.exec() )
 
   84  if ( saveDlg.name().isEmpty() )
 
   87  QgsStyle *style = saveDlg.destinationStyle();
 
   94    const int res = QMessageBox::warning( 
this, tr( 
"Save Legend Patch Shape" ),
 
   95                                          tr( 
"A legend patch shape with the name '%1' already exists. Overwrite?" )
 
   96                                          .arg( saveDlg.name() ),
 
   97                                          QMessageBox::Yes | QMessageBox::No );
 
   98    if ( res != QMessageBox::Yes )
 
  105  const QStringList symbolTags = saveDlg.tags().split( 
',' );
 
  119  QVBoxLayout *vLayout = 
new QVBoxLayout();
 
  121  vLayout->addWidget( mWidget );
 
  124  mButtonBox = 
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Ok, Qt::Horizontal );
 
  125  connect( mButtonBox, &QDialogButtonBox::accepted, 
this, &QDialog::accept );
 
  126  connect( mButtonBox, &QDialogButtonBox::rejected, 
this, &QDialog::reject );
 
  127  vLayout->addWidget( mButtonBox );
 
  128  setLayout( vLayout );
 
  129  setWindowTitle( tr( 
"Legend Patch Shape" ) );
 
 
static Q_INVOKABLE QgsGeometry fromWkt(const QString &wkt)
Creates a new geometry from a WKT string.
 
Q_INVOKABLE QString asWkt(int precision=17) const
Exports the geometry to WKT.
 
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
 
QgsLegendPatchShape shape() const
Returns the legend patch shape defined by the dialog.
 
QgsLegendPatchShapeDialog(const QgsLegendPatchShape &shape, QWidget *parent=nullptr)
Constructor for QgsLegendPatchShapeDialog, initially showing the specified shape.
 
Represents a patch shape for use in map legends.
 
bool preserveAspectRatio() const
Returns true if the patch shape should preserve its aspect ratio when it is resized to fit a desired ...
 
QgsGeometry geometry() const
Returns the geometry for the patch shape.
 
Qgis::SymbolType symbolType() const
Returns the symbol type associated with this patch.
 
QgsStyle * styleAtPath(const QString &path)
Returns a reference to the style database associated with the project with matching file path.
 
static QgsProject * instance()
Returns the QgsProject singleton instance.
 
const QgsProjectStyleSettings * styleSettings() const
Returns the project's style settings, which contains settings and properties relating to how a QgsPro...
 
a dialog for setting properties of a newly saved style.
 
StyleEntity
Enum for Entities involved in a style.
 
@ LegendPatchShapeEntity
Legend patch shape.
 
QStringList legendPatchShapeNames() const
Returns a list of names of legend patch shapes in the style.
 
bool removeEntityByName(StyleEntity type, const QString &name)
Removes the entry of the specified type with matching name from the database.
 
bool addLegendPatchShape(const QString &name, const QgsLegendPatchShape &shape, bool update=false)
Adds a legend patch shape with the specified name to the style.
 
static QgsStyle * defaultStyle(bool initialize=true)
Returns the default application-wide style.
 
bool saveLegendPatchShape(const QString &name, const QgsLegendPatchShape &shape, bool favorite, const QStringList &tags)
Adds a legend patch shape to the database.
 
QgsLegendPatchShape legendPatchShape(const QString &name) const
Returns the legend patch shape with the specified name.
 
QgsSignalBlocker< Object > whileBlocking(Object *object)
Temporarily blocks signals from a QObject while calling a single method from the object.