Skip to content

Commit

Permalink
- Add QgisGui namespace for application-wide gui constants.
Browse files Browse the repository at this point in the history
- Add QgisGui::ModalDialogFlags for creating modal dialogs. This allows occurrances of the deprecated Qt3-style QDialog constructor to be replaced with the Qt4-style constructor and create Mac modal dialogs which corectly interact with QMessageBox modal dialogs.
- Use new ModalDialogFlags in DBSourceSelect dialog to elminiate Mac dialog layering problems. (This update will soon be made to all modal dialogs.)


git-svn-id: http://svn.osgeo.org/qgis/trunk@4681 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
telwertowski committed Jan 14, 2006
1 parent cf9b9d5 commit fdaa4f7
Show file tree
Hide file tree
Showing 3 changed files with 67 additions and 19 deletions.
50 changes: 50 additions & 0 deletions src/gui/qgisgui.h
@@ -0,0 +1,50 @@
/***************************************************************************
qgisgui.h - Constants used throughout the QGIS GUI.
--------------------------------------
Date : 11-Jan-2006
Copyright : (C) 2006 by Tom Elwertowski
Email : telwertowski at users dot sourceforge dot net
***************************************************************************
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
* *
***************************************************************************/
/* $Id$ */
#ifndef QGISGUI_H
#define QGISGUI_H

#include <Qt>

/*!
* /namespace QgisGui
* /brief The QgisGui namespace contains constants used throughout the QGIS GUI.
*/
namespace QgisGui
{

/*!
* /var ModalDialogFlags
* /brief Flags used to create a modal dialog (adapted from QMessageBox).
*
* Using these flags for all modal dialogs throughout QGIS ensures that
* for platforms such as the Mac where modal and modeless dialogs have
* different looks, QGIS modal dialogs will look the same as Qt modal
* dialogs and all modal dialogs will look distinct from modeless dialogs.
* Althought not the standard Mac modal look, it does lack the minimize
* control which makes sense only for modeless dislogs.
*
* The Qt3 method of creating a true Mac modal dialog is deprecated in Qt4
* and should not be used due to conflicts with QMessageBox style dialogs.
*
* Qt::WindowMaximizeButtonHint is included but will be ignored if
* the dialog is a fixed size and does not have a size grip.
*/
Qt::WFlags ModalDialogFlags =
Qt::WindowTitleHint | Qt::WindowSystemMenuHint | Qt::WindowMaximizeButtonHint;

}

#endif
34 changes: 16 additions & 18 deletions src/gui/qgsdbsourceselect.cpp
Expand Up @@ -16,27 +16,25 @@ email : sherman at mrcc.com
* *
***************************************************************************/
/* $Id$ */
#include <iostream>
#include <cassert>
#include <qsettings.h>
#include <qpixmap.h>
#include <Q3ListBox>
#include <Q3ListView>
#include <qstringlist.h>
#include <QComboBox>
#include <qpushbutton.h>
#include <qmessagebox.h>
#include <qinputdialog.h>
#include <q3groupbox.h>
#include <QTextOStream>
#include "qgsapplication.h"

#include "qgsdbsourceselect.h"
#include "qgsnewconnection.h"
#include "qgspgquerybuilder.h"

#include "qgisapp.h"
#include "qgisgui.h"
#include "qgsapplication.h"
#include "qgscontexthelp.h"
QgsDbSourceSelect::QgsDbSourceSelect(QgisApp *app, QWidget *parent, const char *name, bool modal)
: QDialog(parent, name, modal), qgisApp(app)
#include "qgsnewconnection.h"
#include "qgspgquerybuilder.h"

#include <QInputDialog>
#include <QMessageBox>
#include <QSettings>
#include <QTextOStream>
#include <cassert>
#include <iostream>

QgsDbSourceSelect::QgsDbSourceSelect(QgisApp *app)
: QDialog(app, QgisGui::ModalDialogFlags), qgisApp(app)
{
setupUi(this);
btnAdd->setEnabled(false);
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsdbsourceselect.h
Expand Up @@ -42,7 +42,7 @@ class QgsDbSourceSelect : public QDialog, private Ui::QgsDbSourceSelectBase
public:

//! Constructor
QgsDbSourceSelect(QgisApp *app = 0, QWidget *parent=0, const char *name = 0, bool modal = true);
QgsDbSourceSelect(QgisApp *app);
//! Destructor
~QgsDbSourceSelect();
//! Opens the create connection dialog to build a new connection
Expand Down

0 comments on commit fdaa4f7

Please sign in to comment.