When saving a symbol to the style database, prepopulate the tags

widget with existing tags
This commit is contained in:
Nyall Dawson 2019-07-19 11:34:20 +10:00
parent 2aba793946
commit 53ca26e638
2 changed files with 29 additions and 20 deletions

View File

@ -33,6 +33,10 @@ QgsStyleSaveDialog::QgsStyleSaveDialog( QWidget *parent, QgsStyle::StyleEntity t
QgsGui::enableAutoGeometryRestore( this );
QStringList defaultTags = QgsStyle::defaultStyle()->tags();
defaultTags.sort( Qt::CaseInsensitive );
mTags->addItems( defaultTags );
QList< QgsStyle::StyleEntity > possibleEntities;
switch ( type )
{
@ -104,12 +108,12 @@ QString QgsStyleSaveDialog::name() const
void QgsStyleSaveDialog::setDefaultTags( const QString &tags )
{
mTags->setText( tags );
mTags->setCurrentText( tags );
}
QString QgsStyleSaveDialog::tags() const
{
return mTags->text();
return mTags->currentText();
}
bool QgsStyleSaveDialog::isFavorite() const

View File

@ -16,8 +16,22 @@
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<layout class="QGridLayout" name="gridLayout">
<item row="1" column="1">
<widget class="QLineEdit" name="mName"/>
<item row="2" column="1">
<widget class="QComboBox" name="mTags">
<property name="editable">
<bool>true</bool>
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mComboSaveAs"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mLabelSaveAs">
<property name="text">
<string>Save as</string>
</property>
</widget>
</item>
<item row="3" column="1">
<widget class="QLabel" name="label_10">
@ -26,6 +40,9 @@
</property>
</widget>
</item>
<item row="1" column="1">
<widget class="QLineEdit" name="mName"/>
</item>
<item row="4" column="0" colspan="2">
<widget class="QCheckBox" name="mFavorite">
<property name="sizePolicy">
@ -39,16 +56,6 @@
</property>
</widget>
</item>
<item row="1" column="0">
<widget class="QLabel" name="label_1">
<property name="text">
<string>Name</string>
</property>
</widget>
</item>
<item row="2" column="1">
<widget class="QLineEdit" name="mTags"/>
</item>
<item row="2" column="0">
<widget class="QLabel" name="label_101">
<property name="text">
@ -56,13 +63,10 @@
</property>
</widget>
</item>
<item row="0" column="1">
<widget class="QComboBox" name="mComboSaveAs"/>
</item>
<item row="0" column="0">
<widget class="QLabel" name="mLabelSaveAs">
<item row="1" column="0">
<widget class="QLabel" name="label_1">
<property name="text">
<string>Save as</string>
<string>Name</string>
</property>
</widget>
</item>
@ -94,6 +98,7 @@
</layout>
</widget>
<tabstops>
<tabstop>mComboSaveAs</tabstop>
<tabstop>mName</tabstop>
<tabstop>mTags</tabstop>
<tabstop>mFavorite</tabstop>