Skip to content

Commit

Permalink
set attribute dialog parent and save geometry
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.osgeo.org/qgis/trunk/qgis@13339 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 20, 2010
1 parent eba4ac7 commit a5ff7f5
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/app/qgsattributedialog.cpp
Expand Up @@ -42,11 +42,11 @@
#include <QVBoxLayout>

QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeature )
: mDialog( 0 ),
mSettingsPath( "/Windows/AttributeDialog/" ),
mLayer( vl ),
mpFeature( thepFeature ),
mRubberBand( 0 )
: mDialog( 0 )
, mSettingsPath( "/Windows/AttributeDialog/" )
, mLayer( vl )
, mpFeature( thepFeature )
, mRubberBand( 0 )
{
if ( mpFeature == NULL || vl->dataProvider() == NULL )
return;
Expand All @@ -69,7 +69,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat

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

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

if ( !mDialog )
{
mDialog = new QDialog();
mDialog = new QDialog( QgisApp::instance() );

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

mFrame->setLayout( mypOuterLayout );
QScrollArea * mypScrollArea = new QScrollArea();
QScrollArea *mypScrollArea = new QScrollArea();
//transfers scroll area ownership so no need to call delete
mypOuterLayout->addWidget( mypScrollArea );
QFrame *mypInnerFrame = new QFrame();
Expand All @@ -117,7 +117,7 @@ QgsAttributeDialog::QgsAttributeDialog( QgsVectorLayer *vl, QgsFeature *thepFeat
//transfers frame ownership so no need to call delete
mypScrollArea->setWidget( mypInnerFrame );
mypScrollArea->setWidgetResizable( true );
QGridLayout * mypInnerLayout = new QGridLayout( mypInnerFrame );
QGridLayout *mypInnerLayout = new QGridLayout( mypInnerFrame );

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

connect( buttonBox, SIGNAL( rejected() ), mDialog, SLOT( reject() ) );
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
}

QMetaObject::connectSlotsByName( mDialog );
Expand Down Expand Up @@ -245,12 +246,12 @@ QgsAttributeDialog::~QgsAttributeDialog()
delete mRubberBand;
}

saveGeometry();

if ( mDialog )
{
delete mDialog;
}

saveGeometry();
}

void QgsAttributeDialog::accept()
Expand Down

0 comments on commit a5ff7f5

Please sign in to comment.