stored expression icons to 'bookmark' expressions

This commit is contained in:
David Signer 2019-08-19 17:42:57 +02:00
parent 4dbff2bf8e
commit 8633cb67d2
5 changed files with 91 additions and 8 deletions

View File

@ -775,6 +775,8 @@
<file>themes/default/mIconClearItem.svg</file>
<file>themes/default/mIndicatorLayerError.svg</file>
<file>themes/default/mActionShowUnplacedLabel.svg</file>
<file>themes/default/mActionHandleStoreFilterExpressionChecked.svg</file>
<file>themes/default/mActionHandleStoreFilterExpressionUnchecked.svg</file>
</qresource>
<qresource prefix="/images/tips">
<file alias="symbol_levels.png">qgis_tips/symbol_levels.png</file>

View File

@ -0,0 +1,62 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
width="24"
height="24"
viewBox="0 0 24 24"
version="1.1"
id="svg8"
sodipodi:docname="mActionHandleStoreFilterExpressionChecked.svg"
inkscape:version="0.92.4 (unknown)">
<metadata
id="metadata14">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs12" />
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="721"
inkscape:window-height="480"
id="namedview10"
showgrid="false"
inkscape:zoom="9.8333333"
inkscape:cx="12"
inkscape:cy="12"
inkscape:window-x="2481"
inkscape:window-y="461"
inkscape:window-maximized="0"
inkscape:current-layer="svg8" />
<path
d="M0 0h24v24H0z"
fill="none"
id="path2" />
<path
d="M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z"
id="path4"
style="fill:#ffae07;fill-opacity:1" />
<path
d="M0 0h24v24H0z"
fill="none"
id="path6" />
</svg>

After

Width:  |  Height:  |  Size: 1.7 KiB

View File

@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24"><path d="M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z"/><path d="M0 0h24v24H0z" fill="none"/></svg>

After

Width:  |  Height:  |  Size: 330 B

View File

@ -197,7 +197,6 @@ QgsAttributeTableDialog::QgsAttributeTableDialog( QgsVectorLayer *layer, QgsAttr
// Set button to store or delete stored filter expressions
mStoreFilterExpressionButton->setDefaultAction( mActionHandleStoreFilterExpression );
//connect all options though delete is not available yet
connect( mActionSaveAsStoredFilterExpression, &QAction::triggered, this, &QgsAttributeTableDialog::saveAsStoredFilterExpression );
mApplyFilterButton->setDefaultAction( mActionApplyFilter );
@ -505,13 +504,15 @@ void QgsAttributeTableDialog::storeExpressionButtonInit()
if ( mActionHandleStoreFilterExpression->isChecked() )
{
mActionHandleStoreFilterExpression->setToolTip( tr( "Delete stored filter expression" ) );
mActionHandleStoreFilterExpression->setText( tr( "D" ) );
mActionHandleStoreFilterExpression->setText( tr( "Delete Stored Expression" ) );
mActionHandleStoreFilterExpression->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionHandleStoreFilterExpressionChecked.svg" ) ) );
mStoreFilterExpressionButton->removeAction( mActionSaveAsStoredFilterExpression );
}
else
{
mActionHandleStoreFilterExpression->setToolTip( tr( "Store filter expression" ) );
mActionHandleStoreFilterExpression->setText( tr( "S" ) );
mActionHandleStoreFilterExpression->setToolTip( tr( "Save filter expression" ) );
mActionHandleStoreFilterExpression->setText( tr( "Save Expression" ) );
mActionHandleStoreFilterExpression->setIcon( QgsApplication::getThemeIcon( QStringLiteral( "mActionHandleStoreFilterExpressionUnchecked.svg" ) ) );
mStoreFilterExpressionButton->addAction( mActionSaveAsStoredFilterExpression );
}
}
@ -1109,21 +1110,27 @@ void QgsAttributeTableDialog::openConditionalStyles()
void QgsAttributeTableDialog::saveAsStoredFilterExpression()
{
mLayer->storedExpressions()->addStoredExpression( "test", mFilterQuery->text() );
mActionHandleStoreFilterExpression->setChecked( false );
storeExpressionButtonInit();
storedFilterExpressionBoxInit();
}
void QgsAttributeTableDialog::handleStoreFilterExpression()
{
if ( mActionHandleStoreFilterExpression->isChecked() )
if ( !mActionHandleStoreFilterExpression->isChecked() )
{
qDebug() << "its checked, here we would delete it...";
//care for deleting by name
mLayer->storedExpressions()->removeStoredExpression( mFilterQuery->text() );
qDebug() << "changed to unchecked, here we would delete it...";
}
else
{
//care for updating it by name
mLayer->storedExpressions()->addStoredExpression( mFilterQuery->text(), mFilterQuery->text() );
qDebug() << "its not checked, here we would add it...";
qDebug() << "changed to checked, here we would add it...";
}
storeExpressionButtonInit();
storedFilterExpressionBoxInit();
}
void QgsAttributeTableDialog::setFilterExpression( const QString &filterString, QgsAttributeForm::FilterType type,

View File

@ -678,17 +678,28 @@
<property name="checkable">
<bool>true</bool>
</property>
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionHandleStoreFilterExpressionUnchecked.svg</normaloff>:/images/themes/default/mActionHandleStoreFilterExpressionUnchecked.svg</iconset>
</property>
<property name="text">
<string>...</string>
<string/>
</property>
<property name="toolTip">
<string>Handle Filter Expression (save or delete)</string>
</property>
</action>
<action name="mActionSaveAsStoredFilterExpression">
<property name="icon">
<iconset resource="../../images/images.qrc">
<normaloff>:/images/themes/default/mActionHandleStoreFilterExpressionUnchecked.svg</normaloff>:/images/themes/default/mActionHandleStoreFilterExpressionUnchecked.svg</iconset>
</property>
<property name="text">
<string>Save Expression as...</string>
</property>
<property name="toolTip">
<string>Save expression under defined name</string>
</property>
</action>
</widget>
<customwidgets>