Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fix look&feel of WFS SQL query composer on Mac
  • Loading branch information
rouault committed May 16, 2016
1 parent c198b1a commit 2bbd5ca
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 7 deletions.
6 changes: 5 additions & 1 deletion src/gui/qgscodeeditorsql.cpp
Expand Up @@ -19,6 +19,7 @@
#include <QWidget>
#include <QString>
#include <QFont>
#include <QLabel>
#include <Qsci/qscilexersql.h>


Expand Down Expand Up @@ -58,7 +59,10 @@ class QgsCaseInsensitiveLexerSQL: public QsciLexerSQL
void QgsCodeEditorSQL::setSciLexerSQL()
{
QFont font = getMonospaceFont();

#ifdef Q_OS_MAC
// The font size gotten from getMonospaceFont() is too small on Mac
font.setPointSize( QLabel().font().pointSize() );
#endif
QsciLexerSQL* sqlLexer = new QgsCaseInsensitiveLexerSQL( this );
sqlLexer->setDefaultFont( font );
sqlLexer->setFont( font, -1 );
Expand Down
24 changes: 18 additions & 6 deletions src/providers/wfs/qgswfssourceselect.cpp
Expand Up @@ -628,14 +628,26 @@ void QgsWFSSourceSelect::buildQuery( const QModelIndex& index )

d->setSql( sql );

d->setAttribute( Qt::WA_DeleteOnClose );
d->setModal( true );
// For testability, do not use exec()
if ( !property( "hideDialogs" ).toBool() )
d->open();
connect( d, SIGNAL( accepted() ), this, SLOT( updateSql() ) );
mSQLIndex = index;
mSQLComposerDialog = d;
// For testability, do not use exec()
if ( property( "hideDialogs" ).toBool() )
{
d->setAttribute( Qt::WA_DeleteOnClose );
d->setModal( true );
d->open();
connect( d, SIGNAL( accepted() ), this, SLOT( updateSql() ) );
}
else
{
// But we need to use exec() for real GUI, otherwise it does not look
// right on Mac
if ( d->exec() )
{
updateSql();
}
delete d;
}
}

void QgsWFSSourceSelect::updateSql()
Expand Down

0 comments on commit 2bbd5ca

Please sign in to comment.