Skip to content

Commit

Permalink
open attribute dialogs non-modal when not in editing mode
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk@12796 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Jan 19, 2010
1 parent 9cc24e2 commit 40793c7
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
10 changes: 10 additions & 0 deletions src/app/qgsattributedialog.cpp
Expand Up @@ -273,6 +273,16 @@ int QgsAttributeDialog::exec()
}
}

void QgsAttributeDialog::show()
{
if ( mDialog )
{
mDialog->setAttribute( Qt::WA_DeleteOnClose );
mDialog->show();
mDialog = 0;
}
}

void QgsAttributeDialog::saveGeometry()
{
if ( mDialog )
Expand Down
1 change: 1 addition & 0 deletions src/app/qgsattributedialog.h
Expand Up @@ -54,6 +54,7 @@ class QgsAttributeDialog : public QObject
void accept();

int exec();
void show();

void dialogDestroyed();

Expand Down
34 changes: 22 additions & 12 deletions src/app/qgsidentifyresults.cpp
Expand Up @@ -293,7 +293,7 @@ void QgsIdentifyResults::show()
// (saves the current window size/position)
void QgsIdentifyResults::close()
{
clear();
clear();

delete mActionPopup;
mActionPopup = 0;
Expand Down Expand Up @@ -761,7 +761,9 @@ void QgsIdentifyResults::featureForm()

QgsAttributeMap src = f.attributeMap();

vlayer->beginEditCommand( tr( "Attribute changed" ) );
if ( vlayer->isEditable() )
vlayer->beginEditCommand( tr( "Attribute changed" ) );

QgsAttributeDialog *ad = new QgsAttributeDialog( vlayer, &f );

if ( !vlayer->isEditable() && vlayer->actions()->size() > 0 )
Expand Down Expand Up @@ -789,25 +791,33 @@ void QgsIdentifyResults::featureForm()
}
}

if ( ad->exec() )
if ( vlayer->isEditable() )
{
const QgsAttributeMap &dst = f.attributeMap();
for ( QgsAttributeMap::const_iterator it = dst.begin(); it != dst.end(); it++ )
if ( ad->exec() )
{
if ( !src.contains( it.key() ) || it.value() != src[it.key()] )
const QgsAttributeMap &dst = f.attributeMap();
for ( QgsAttributeMap::const_iterator it = dst.begin(); it != dst.end(); it++ )
{
vlayer->changeAttributeValue( f.id(), it.key(), it.value() );
if ( !src.contains( it.key() ) || it.value() != src[it.key()] )
{
vlayer->changeAttributeValue( f.id(), it.key(), it.value() );
}
}
vlayer->endEditCommand();
}
else
{
vlayer->destroyEditCommand();
}
vlayer->endEditCommand();

delete ad;

mCanvas->refresh();
}
else
{
vlayer->destroyEditCommand();
ad->show();
}

delete ad;
mCanvas->refresh();
}

void QgsIdentifyResults::highlightAll()
Expand Down

0 comments on commit 40793c7

Please sign in to comment.