Skip to content
Permalink
Browse files

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/branches/Release-0_8_0@6438 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski
telwertowski committed Jan 16, 2007
1 parent fb8eb67 commit 554a74a0c72c81ec3b62d4c5e7e17c5fb3ea25b0
@@ -2490,7 +2490,7 @@ void QgisApp::newVectorLayer()
QGis::WKBTYPE geometrytype;
QString fileformat;

QgsGeomTypeDialog geomDialog;
QgsGeomTypeDialog geomDialog(this);
if(geomDialog.exec()==QDialog::Rejected)
{
return;
@@ -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()));
@@ -39,8 +39,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()));
@@ -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:
@@ -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()))
@@ -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());
@@ -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;
@@ -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" >
@@ -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>

0 comments on commit 554a74a

Please sign in to comment.
You can’t perform that action at this time.