Skip to content

Commit 2bbd5ca

Browse files
committedMay 16, 2016
Fix look&feel of WFS SQL query composer on Mac
1 parent c198b1a commit 2bbd5ca

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed
 

‎src/gui/qgscodeeditorsql.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
#include <QWidget>
2020
#include <QString>
2121
#include <QFont>
22+
#include <QLabel>
2223
#include <Qsci/qscilexersql.h>
2324

2425

@@ -58,7 +59,10 @@ class QgsCaseInsensitiveLexerSQL: public QsciLexerSQL
5859
void QgsCodeEditorSQL::setSciLexerSQL()
5960
{
6061
QFont font = getMonospaceFont();
61-
62+
#ifdef Q_OS_MAC
63+
// The font size gotten from getMonospaceFont() is too small on Mac
64+
font.setPointSize( QLabel().font().pointSize() );
65+
#endif
6266
QsciLexerSQL* sqlLexer = new QgsCaseInsensitiveLexerSQL( this );
6367
sqlLexer->setDefaultFont( font );
6468
sqlLexer->setFont( font, -1 );

‎src/providers/wfs/qgswfssourceselect.cpp

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -628,14 +628,26 @@ void QgsWFSSourceSelect::buildQuery( const QModelIndex& index )
628628

629629
d->setSql( sql );
630630

631-
d->setAttribute( Qt::WA_DeleteOnClose );
632-
d->setModal( true );
633-
// For testability, do not use exec()
634-
if ( !property( "hideDialogs" ).toBool() )
635-
d->open();
636-
connect( d, SIGNAL( accepted() ), this, SLOT( updateSql() ) );
637631
mSQLIndex = index;
638632
mSQLComposerDialog = d;
633+
// For testability, do not use exec()
634+
if ( property( "hideDialogs" ).toBool() )
635+
{
636+
d->setAttribute( Qt::WA_DeleteOnClose );
637+
d->setModal( true );
638+
d->open();
639+
connect( d, SIGNAL( accepted() ), this, SLOT( updateSql() ) );
640+
}
641+
else
642+
{
643+
// But we need to use exec() for real GUI, otherwise it does not look
644+
// right on Mac
645+
if ( d->exec() )
646+
{
647+
updateSql();
648+
}
649+
delete d;
650+
}
639651
}
640652

641653
void QgsWFSSourceSelect::updateSql()

0 commit comments

Comments
 (0)
Please sign in to comment.