Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Make Add Attribute dialog modal and set parent for all dialogs in cha…
…in. This fixes incorrect layering of stacked dialogs on Mac (bug #509).

git-svn-id: http://svn.osgeo.org/qgis/trunk@6439 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed Jan 16, 2007
1 parent 771b972 commit 4bda397
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 16 deletions.
2 changes: 1 addition & 1 deletion src/app/qgisapp.cpp
Expand Up @@ -2525,7 +2525,7 @@ void QgisApp::newVectorLayer()
QGis::WKBTYPE geometrytype;
QString fileformat;

QgsGeomTypeDialog geomDialog;
QgsGeomTypeDialog geomDialog(this);
if(geomDialog.exec()==QDialog::Rejected)
{
return;
Expand Down
8 changes: 4 additions & 4 deletions src/app/qgsaddattrdialog.cpp
Expand Up @@ -18,8 +18,8 @@
#include "qgsaddattrdialog.h"
#include "qgsvectordataprovider.h"

QgsAddAttrDialog::QgsAddAttrDialog(QgsVectorDataProvider* provider)
: QDialog(), mDataProvider(provider)
QgsAddAttrDialog::QgsAddAttrDialog(QgsVectorDataProvider* provider, QWidget *parent, Qt::WFlags fl)
: QDialog(parent, fl), mDataProvider(provider)
{
setupUi(this);
connect(mOkButton, SIGNAL(clicked()), this, SLOT(accept()));
Expand All @@ -42,8 +42,8 @@ QgsAddAttrDialog::QgsAddAttrDialog(QgsVectorDataProvider* provider)
*/
}

QgsAddAttrDialog::QgsAddAttrDialog(const std::list<QString>& typelist)
: QDialog(), mDataProvider(0)
QgsAddAttrDialog::QgsAddAttrDialog(const std::list<QString>& typelist, QWidget *parent, Qt::WFlags fl)
: QDialog(parent, fl), mDataProvider(0)
{
setupUi(this);
connect(mOkButton, SIGNAL(clicked()), this, SLOT(accept()));
Expand Down
8 changes: 5 additions & 3 deletions src/app/qgsaddattrdialog.h
Expand Up @@ -19,16 +19,18 @@
#define QGSADDATTRDIALOG_H

#include "ui_qgsaddattrdialogbase.h"
#include <QDialog>
#include "qgisgui.h"

class QgsVectorDataProvider;

class QgsAddAttrDialog: public QDialog, private Ui::QgsAddAttrDialogBase
{
Q_OBJECT
public:
QgsAddAttrDialog(QgsVectorDataProvider* provider);
QgsAddAttrDialog(const std::list<QString>& typelist);
QgsAddAttrDialog(QgsVectorDataProvider* provider,
QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags);
QgsAddAttrDialog(const std::list<QString>& typelist,
QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags);
QString name() const;
QString type() const;
protected:
Expand Down
2 changes: 1 addition & 1 deletion src/app/qgsattributetabledisplay.cpp
Expand Up @@ -128,7 +128,7 @@ void QgsAttributeTableDisplay::deleteAttributes()

void QgsAttributeTableDisplay::addAttribute()
{
QgsAddAttrDialog dialog(mLayer->getDataProvider());
QgsAddAttrDialog dialog(mLayer->getDataProvider(), this);
if(dialog.exec()==QDialog::Accepted)
{
if(!table()->addAttribute(dialog.name(),dialog.type()))
Expand Down
5 changes: 3 additions & 2 deletions src/app/qgsgeomtypedialog.cpp
Expand Up @@ -19,7 +19,8 @@
#include "qgsgeomtypedialog.h"
#include "qgsaddattrdialog.h"

QgsGeomTypeDialog::QgsGeomTypeDialog(): QDialog()
QgsGeomTypeDialog::QgsGeomTypeDialog(QWidget *parent, Qt::WFlags fl)
: QDialog(parent, fl)
{
setupUi(this);
connect(mOkButton, SIGNAL(clicked()), this, SLOT(accept()));
Expand Down Expand Up @@ -64,7 +65,7 @@ void QgsGeomTypeDialog::on_mAddAttributeButton_clicked()
types.push_back("Real");
types.push_back("Integer");
types.push_back("String");
QgsAddAttrDialog d(types);
QgsAddAttrDialog d(types, this);
if(d.exec()==QDialog::Accepted)
{
Q3ListViewItem* attritem=new Q3ListViewItem(mAttributeView, d.name(), d.type());
Expand Down
4 changes: 2 additions & 2 deletions src/app/qgsgeomtypedialog.h
Expand Up @@ -19,16 +19,16 @@
#define QGSGEOMTYPEDIALOG_H

#include "ui_qgsgeomtypedialogbase.h"
#include "qgisgui.h"
#include "qgscontexthelp.h"
#include <QDialog>

#include "qgis.h"

class QgsGeomTypeDialog: public QDialog, private Ui::QgsGeomTypeDialogBase
{
Q_OBJECT
public:
QgsGeomTypeDialog();
QgsGeomTypeDialog(QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags);
~QgsGeomTypeDialog();
/**Returns the selected geometry type*/
QGis::WKBTYPE selectedType() const;
Expand Down
6 changes: 3 additions & 3 deletions src/ui/qgsaddattrdialogbase.ui
@@ -1,7 +1,4 @@
<ui version="4.0" >
<author></author>
<comment></comment>
<exportmacro></exportmacro>
<class>QgsAddAttrDialogBase</class>
<widget class="QDialog" name="QgsAddAttrDialogBase" >
<property name="geometry" >
Expand All @@ -15,6 +12,9 @@
<property name="windowTitle" >
<string>Add Attribute</string>
</property>
<property name="modal" >
<bool>true</bool>
</property>
<layout class="QGridLayout" >
<property name="margin" >
<number>9</number>
Expand Down

0 comments on commit 4bda397

Please sign in to comment.