Skip to content
Permalink
Browse files

let dialogs ignore escape key when embedded in other dialog. this pre…

…vents that they get closed leaving blank space in the parent dialog.

git-svn-id: http://svn.osgeo.org/qgis/branches/symbology-ng-branch@11910 c8812cc2-4d05-0410-92ff-de0c093fc19c
  • Loading branch information
wonder
wonder committed Nov 3, 2009
1 parent 4654732 commit 5e9a058142d6ed757a136ea7c28c5147bc72bc3b
@@ -21,6 +21,7 @@

#include <QStandardItemModel>
#include <QStandardItem>
#include <QKeyEvent>

QgsRendererV2PropertiesDialog::QgsRendererV2PropertiesDialog(QgsVectorLayer* layer, QgsStyleV2* style, QWidget* parent, bool embedded)
: QDialog(parent), mStyle(style)
@@ -556,3 +557,16 @@ void QgsRendererV2PropertiesDialog::symbolLevels()
mRenderer->setUsingSymbolLevels( dlg.usingLevels() );
}
}

void QgsRendererV2PropertiesDialog::keyPressEvent( QKeyEvent * e )
{
// Ignore the ESC key to avoid close the dialog without the properties window
if ( !isWindow() && e->key() == Qt::Key_Escape )
{
e->ignore();
}
else
{
QDialog::keyPressEvent(e);
}
}
@@ -42,7 +42,10 @@ public slots:
void apply();

protected:


//! Reimplements dialog keyPress event so we can ignore it
void keyPressEvent( QKeyEvent * event );

//! update UI to reflect changes in renderer
void updateUiFromRenderer();

@@ -3,6 +3,7 @@

#include <QFile>
#include <QStandardItem>
#include <QKeyEvent>

#include "qgssymbollayerv2.h"
#include "qgssymbolv2.h"
@@ -367,3 +368,18 @@ void QgsSymbolV2PropertiesDialog::lockLayer()

layer->setLocked( btnLock->isChecked() );
}

#include "qgslogger.h"

void QgsSymbolV2PropertiesDialog::keyPressEvent( QKeyEvent * e )
{
// Ignore the ESC key to avoid close the dialog without the properties window
if ( !isWindow() && e->key() == Qt::Key_Escape )
{
e->ignore();
}
else
{
QDialog::keyPressEvent(e);
}
}
@@ -39,6 +39,9 @@ public slots:

protected:

//! Reimplements dialog keyPress event so we can ignore it
void keyPressEvent( QKeyEvent * event );

void loadSymbol();

void populateLayerTypes();
@@ -13,6 +13,7 @@
#include <QPainter>
#include <QStandardItemModel>
#include <QInputDialog>
#include <QKeyEvent>

QgsSymbolV2SelectorDialog::QgsSymbolV2SelectorDialog(QgsSymbolV2* symbol, QgsStyleV2* style, QWidget* parent, bool embedded)
: QDialog(parent)
@@ -202,3 +203,16 @@ void QgsSymbolV2SelectorDialog::addSymbolToStyle()

populateSymbolView();
}

void QgsSymbolV2SelectorDialog::keyPressEvent( QKeyEvent * e )
{
// Ignore the ESC key to avoid close the dialog without the properties window
if ( !isWindow() && e->key() == Qt::Key_Escape )
{
e->ignore();
}
else
{
QDialog::keyPressEvent(e);
}
}
@@ -22,6 +22,8 @@ class QgsSymbolV2SelectorDialog : public QDialog, private Ui::QgsSymbolV2Selecto
void updateSymbolColor();
void updateSymbolInfo();

//! Reimplements dialog keyPress event so we can ignore it
void keyPressEvent( QKeyEvent * event );

public slots:
void changeSymbolProperties();

0 comments on commit 5e9a058

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