Skip to content

Commit 728f30e

Browse files
author
jef
committed
set attribute dialog parent and save geometry
git-svn-id: http://svn.osgeo.org/qgis/trunk@13339 c8812cc2-4d05-0410-92ff-de0c093fc19c
1 parent 562e04e commit 728f30e

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

src/app/qgsattributedialog.cpp

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@
4242
#include <QVBoxLayout>
4343

4444
QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature )
45-
: mDialog( 0 ),
46-
mSettingsPath( "/Windows/AttributeDialog/" ),
47-
mLayer( vl ),
48-
mpFeature( thepFeature ),
49-
mRubberBand( 0 )
45+
: mDialog( 0 )
46+
, mSettingsPath( "/Windows/AttributeDialog/" )
47+
, mLayer( vl )
48+
, mpFeature( thepFeature )
49+
, mRubberBand( 0 )
5050
{
5151
if ( mpFeature == NULL || vl->dataProvider() == NULL )
5252
return;
@@ -69,7 +69,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
6969

7070
QFileInfo fi( vl->editForm() );
7171
loader.setWorkingDirectory( fi.dir() );
72-
QWidget *myWidget = loader.load( &file, NULL );
72+
QWidget *myWidget = loader.load( &file, QgisApp::instance() );
7373
file.close();
7474

7575
mDialog = qobject_cast<QDialog*>( myWidget );
@@ -79,7 +79,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
7979

8080
if ( !mDialog )
8181
{
82-
mDialog = new QDialog();
82+
mDialog = new QDialog( QgisApp::instance() );
8383

8484
QGridLayout *gridLayout;
8585
QFrame *mFrame;
@@ -103,12 +103,12 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
103103
//
104104
//Set up dynamic inside a scroll box
105105
//
106-
QVBoxLayout * mypOuterLayout = new QVBoxLayout();
106+
QVBoxLayout *mypOuterLayout = new QVBoxLayout();
107107
mypOuterLayout->setContentsMargins( 0, 0, 0, 0 );
108108
//transfers layout ownership so no need to call delete
109109

110110
mFrame->setLayout( mypOuterLayout );
111-
QScrollArea * mypScrollArea = new QScrollArea();
111+
QScrollArea *mypScrollArea = new QScrollArea();
112112
//transfers scroll area ownership so no need to call delete
113113
mypOuterLayout->addWidget( mypScrollArea );
114114
QFrame *mypInnerFrame = new QFrame();
@@ -117,7 +117,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
117117
//transfers frame ownership so no need to call delete
118118
mypScrollArea->setWidget( mypInnerFrame );
119119
mypScrollArea->setWidgetResizable( true );
120-
QGridLayout * mypInnerLayout = new QGridLayout( mypInnerFrame );
120+
QGridLayout *mypInnerLayout = new QGridLayout( mypInnerFrame );
121121

122122
int index = 0;
123123
for ( QgsAttributeMap::const_iterator it = myAttributes.begin(); it != myAttributes.end(); ++it )
@@ -205,6 +205,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
205205
}
206206

207207
connect( buttonBox, SIGNAL( rejected() ), mDialog, SLOT( reject() ) );
208+
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
208209
}
209210

210211
QMetaObject::connectSlotsByName( mDialog );
@@ -245,12 +246,12 @@ QgsAttributeDialog::~QgsAttributeDialog()
245246
delete mRubberBand;
246247
}
247248

249+
saveGeometry();
250+
248251
if ( mDialog )
249252
{
250253
delete mDialog;
251254
}
252-
253-
saveGeometry();
254255
}
255256

256257
void QgsAttributeDialog::accept()

0 commit comments

Comments
 (0)