From 4bda397dc1322cbd23ae30b76ac1f4016ac3f3fa Mon Sep 17 00:00:00 2001 From: telwertowski Date: Tue, 16 Jan 2007 20:51:24 +0000 Subject: [PATCH] Make Add Attribute dialog modal and set parent for all dialogs in chain. 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 --- src/app/qgisapp.cpp | 2 +- src/app/qgsaddattrdialog.cpp | 8 ++++---- src/app/qgsaddattrdialog.h | 8 +++++--- src/app/qgsattributetabledisplay.cpp | 2 +- src/app/qgsgeomtypedialog.cpp | 5 +++-- src/app/qgsgeomtypedialog.h | 4 ++-- src/ui/qgsaddattrdialogbase.ui | 6 +++--- 7 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/app/qgisapp.cpp b/src/app/qgisapp.cpp index 133f5c1fbce6..8df59f4365ff 100644 --- a/src/app/qgisapp.cpp +++ b/src/app/qgisapp.cpp @@ -2525,7 +2525,7 @@ void QgisApp::newVectorLayer() QGis::WKBTYPE geometrytype; QString fileformat; - QgsGeomTypeDialog geomDialog; + QgsGeomTypeDialog geomDialog(this); if(geomDialog.exec()==QDialog::Rejected) { return; diff --git a/src/app/qgsaddattrdialog.cpp b/src/app/qgsaddattrdialog.cpp index 110de8d90a14..1cf1b7a0ba25 100644 --- a/src/app/qgsaddattrdialog.cpp +++ b/src/app/qgsaddattrdialog.cpp @@ -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())); @@ -42,8 +42,8 @@ QgsAddAttrDialog::QgsAddAttrDialog(QgsVectorDataProvider* provider) */ } -QgsAddAttrDialog::QgsAddAttrDialog(const std::list& typelist) -: QDialog(), mDataProvider(0) +QgsAddAttrDialog::QgsAddAttrDialog(const std::list& typelist, QWidget *parent, Qt::WFlags fl) +: QDialog(parent, fl), mDataProvider(0) { setupUi(this); connect(mOkButton, SIGNAL(clicked()), this, SLOT(accept())); diff --git a/src/app/qgsaddattrdialog.h b/src/app/qgsaddattrdialog.h index 34be900a542c..48e1fcfc81d0 100644 --- a/src/app/qgsaddattrdialog.h +++ b/src/app/qgsaddattrdialog.h @@ -19,7 +19,7 @@ #define QGSADDATTRDIALOG_H #include "ui_qgsaddattrdialogbase.h" -#include +#include "qgisgui.h" class QgsVectorDataProvider; @@ -27,8 +27,10 @@ class QgsAddAttrDialog: public QDialog, private Ui::QgsAddAttrDialogBase { Q_OBJECT public: - QgsAddAttrDialog(QgsVectorDataProvider* provider); - QgsAddAttrDialog(const std::list& typelist); + QgsAddAttrDialog(QgsVectorDataProvider* provider, + QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags); + QgsAddAttrDialog(const std::list& typelist, + QWidget *parent = 0, Qt::WFlags fl = QgisGui::ModalDialogFlags); QString name() const; QString type() const; protected: diff --git a/src/app/qgsattributetabledisplay.cpp b/src/app/qgsattributetabledisplay.cpp index 6340079fb86a..259b7291b148 100644 --- a/src/app/qgsattributetabledisplay.cpp +++ b/src/app/qgsattributetabledisplay.cpp @@ -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())) diff --git a/src/app/qgsgeomtypedialog.cpp b/src/app/qgsgeomtypedialog.cpp index b5163d22d05a..18f0da282f1c 100644 --- a/src/app/qgsgeomtypedialog.cpp +++ b/src/app/qgsgeomtypedialog.cpp @@ -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())); @@ -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()); diff --git a/src/app/qgsgeomtypedialog.h b/src/app/qgsgeomtypedialog.h index 446d2ce89ed7..a369a6868270 100644 --- a/src/app/qgsgeomtypedialog.h +++ b/src/app/qgsgeomtypedialog.h @@ -19,8 +19,8 @@ #define QGSGEOMTYPEDIALOG_H #include "ui_qgsgeomtypedialogbase.h" +#include "qgisgui.h" #include "qgscontexthelp.h" -#include #include "qgis.h" @@ -28,7 +28,7 @@ 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; diff --git a/src/ui/qgsaddattrdialogbase.ui b/src/ui/qgsaddattrdialogbase.ui index 8e2c9c65bfd1..dac53a109151 100644 --- a/src/ui/qgsaddattrdialogbase.ui +++ b/src/ui/qgsaddattrdialogbase.ui @@ -1,7 +1,4 @@ - - - QgsAddAttrDialogBase @@ -15,6 +12,9 @@ Add Attribute + + true + 9