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@13339 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
jef committed Apr 20, 2010
1 parent 562e04e commit 728f30e
Showing 1 changed file with 13 additions and 12 deletions.
25 changes: 13 additions & 12 deletions src/app/qgsattributedialog.cpp
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -42,11 +42,11 @@
#include <QVBoxLayout> #include <QVBoxLayout>


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


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


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


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


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


mFrame->setLayout( mypOuterLayout ); mFrame->setLayout( mypOuterLayout );
QScrollArea * mypScrollArea = new QScrollArea(); QScrollArea *mypScrollArea = new QScrollArea();
//transfers scroll area ownership so no need to call delete //transfers scroll area ownership so no need to call delete
mypOuterLayout->addWidget( mypScrollArea ); mypOuterLayout->addWidget( mypScrollArea );
QFrame *mypInnerFrame = new QFrame(); 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 //transfers frame ownership so no need to call delete
mypScrollArea->setWidget( mypInnerFrame ); mypScrollArea->setWidget( mypInnerFrame );
mypScrollArea->setWidgetResizable( true ); mypScrollArea->setWidgetResizable( true );
QGridLayout * mypInnerLayout = new QGridLayout( mypInnerFrame ); QGridLayout *mypInnerLayout = new QGridLayout( mypInnerFrame );


int index = 0; int index = 0;
for ( QgsAttributeMap::const_iterator it = myAttributes.begin(); it != myAttributes.end(); ++it ) 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() ), mDialog, SLOT( reject() ) );
connect( buttonBox, SIGNAL( rejected() ), this, SLOT( reject() ) );
} }


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


saveGeometry();

if ( mDialog ) if ( mDialog )
{ {
delete mDialog; delete mDialog;
} }

saveGeometry();
} }


void QgsAttributeDialog::accept() void QgsAttributeDialog::accept()
Expand Down

0 comments on commit 728f30e

Please sign in to comment.