Skip to content

Commit 40793c7

Browse files
author
jef
committed
open attribute dialogs non-modal when not in editing mode
git-svn-id: http://svn.osgeo.org/qgis/trunk@12796 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 9cc24e2 commit 40793c7

File tree

3 files changed

+33
-12
lines changed

3 files changed

+33
-12
lines changed

src/app/qgsattributedialog.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -273,6 +273,16 @@ int QgsAttributeDialog::exec()
273273
}
274274
}
275275

276+
void QgsAttributeDialog::show()
277+
{
278+
if ( mDialog )
279+
{
280+
mDialog->setAttribute( Qt::WA_DeleteOnClose );
281+
mDialog->show();
282+
mDialog = 0;
283+
}
284+
}
285+
276286
void QgsAttributeDialog::saveGeometry()
277287
{
278288
if ( mDialog )

src/app/qgsattributedialog.h

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ class QgsAttributeDialog : public QObject
5454
void accept();
5555

5656
int exec();
57+
void show();
5758

5859
void dialogDestroyed();
5960

src/app/qgsidentifyresults.cpp

+22-12
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,7 @@ void QgsIdentifyResults::show()
293293
// (saves the current window size/position)
294294
void QgsIdentifyResults::close()
295295
{
296-
clear();
296+
clear();
297297

298298
delete mActionPopup;
299299
mActionPopup = 0;
@@ -761,7 +761,9 @@ void QgsIdentifyResults::featureForm()
761761

762762
QgsAttributeMap src = f.attributeMap();
763763

764-
vlayer->beginEditCommand( tr( "Attribute changed" ) );
764+
if ( vlayer->isEditable() )
765+
vlayer->beginEditCommand( tr( "Attribute changed" ) );
766+
765767
QgsAttributeDialog *ad = new QgsAttributeDialog( vlayer, &f );
766768

767769
if ( !vlayer->isEditable() && vlayer->actions()->size() > 0 )
@@ -789,25 +791,33 @@ void QgsIdentifyResults::featureForm()
789791
}
790792
}
791793

792-
if ( ad->exec() )
794+
if ( vlayer->isEditable() )
793795
{
794-
const QgsAttributeMap &dst = f.attributeMap();
795-
for ( QgsAttributeMap::const_iterator it = dst.begin(); it != dst.end(); it++ )
796+
if ( ad->exec() )
796797
{
797-
if ( !src.contains( it.key() ) || it.value() != src[it.key()] )
798+
const QgsAttributeMap &dst = f.attributeMap();
799+
for ( QgsAttributeMap::const_iterator it = dst.begin(); it != dst.end(); it++ )
798800
{
799-
vlayer->changeAttributeValue( f.id(), it.key(), it.value() );
801+
if ( !src.contains( it.key() ) || it.value() != src[it.key()] )
802+
{
803+
vlayer->changeAttributeValue( f.id(), it.key(), it.value() );
804+
}
800805
}
806+
vlayer->endEditCommand();
807+
}
808+
else
809+
{
810+
vlayer->destroyEditCommand();
801811
}
802-
vlayer->endEditCommand();
812+
813+
delete ad;
814+
815+
mCanvas->refresh();
803816
}
804817
else
805818
{
806-
vlayer->destroyEditCommand();
819+
ad->show();
807820
}
808-
809-
delete ad;
810-
mCanvas->refresh();
811821
}
812822

813823
void QgsIdentifyResults::highlightAll()

0 commit comments

Comments
 (0)