Skip to content

Commit bd86697

Browse files
committedSep 11, 2015
fix windows build
1 parent 50cab53 commit bd86697

9 files changed

+38
-50
lines changed
 

‎src/app/qgisapp.cpp

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -487,9 +487,6 @@ QgisApp *QgisApp::smInstance = 0;
487487
// constructor starts here
488488
QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, Qt::WindowFlags fl )
489489
: QMainWindow( parent, fl )
490-
#ifdef Q_OS_WIN
491-
, mSkipNextContextMenuEvent( 0 )
492-
#endif
493490
, mNonEditMapTool( 0 )
494491
, mScaleLabel( 0 )
495492
, mScaleEdit( 0 )
@@ -10126,35 +10123,6 @@ void QgisApp::mapCanvas_keyPressed( QKeyEvent *e )
1012610123
}
1012710124
}
1012810125

10129-
#ifdef Q_OS_WIN
10130-
// hope your wearing your peril sensitive sunglasses.
10131-
void QgisApp::contextMenuEvent( QContextMenuEvent *e )
10132-
{
10133-
if ( mSkipNextContextMenuEvent )
10134-
{
10135-
mSkipNextContextMenuEvent--;
10136-
e->ignore();
10137-
return;
10138-
}
10139-
10140-
QMainWindow::contextMenuEvent( e );
10141-
}
10142-
10143-
void QgisApp::skipNextContextMenuEvent()
10144-
{
10145-
mSkipNextContextMenuEvent++;
10146-
}
10147-
#endif
10148-
10149-
// Debug hook - used to output diagnostic messages when evoked (usually from the menu)
10150-
/* Temporarily disabled...
10151-
void QgisApp::debugHook()
10152-
{
10153-
QgsDebugMsg("Hello from debug hook");
10154-
// show the map canvas extent
10155-
QgsDebugMsg(mMapCanvas->extent());
10156-
}
10157-
*/
1015810126
void QgisApp::customProjection()
1015910127
{
1016010128
// Create an instance of the Custom Projection Designer modeless dialog.

‎src/app/qgisapp.h

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -474,9 +474,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
474474
static QString normalizedMenuName( const QString & name ) { return name.normalized( QString::NormalizationForm_KD ).remove( QRegExp( "[^a-zA-Z]" ) ); }
475475

476476
#ifdef Q_OS_WIN
477-
//! ugly hack
478-
void skipNextContextMenuEvent();
479-
480477
static LONG WINAPI qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo );
481478
#endif
482479

@@ -670,11 +667,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
670667
virtual void keyReleaseEvent( QKeyEvent *event );
671668
#endif
672669

673-
#ifdef Q_OS_WIN
674-
//! reimplements context menu event
675-
virtual void contextMenuEvent( QContextMenuEvent *event );
676-
#endif
677-
678670
private slots:
679671
//! validate a SRS
680672
void validateSrs( QgsCoordinateReferenceSystem &crs );
@@ -1656,10 +1648,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
16561648

16571649
int mLastComposerId;
16581650

1659-
#ifdef Q_OS_WIN
1660-
int mSkipNextContextMenuEvent; // ugly hack
1661-
#endif
1662-
16631651
//! Persistent GPS toolbox
16641652
QgsGPSInformationWidget *mpGpsWidget;
16651653

‎src/astyle/ASResource.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,7 @@ const string ASResource::AS_CONST_CAST = string("const_cast");
139139
const string ASResource::AS_DYNAMIC_CAST = string("dynamic_cast");
140140
const string ASResource::AS_REINTERPRET_CAST = string("reinterpret_cast");
141141
const string ASResource::AS_STATIC_CAST = string("static_cast");
142+
const string ASResource::AS_QOBJECT_CAST = string("qobject_cast");
142143

143144

144145
/**
@@ -185,6 +186,7 @@ void ASResource::buildCastOperators(vector<const string*> &castOperators)
185186
castOperators.push_back(&AS_DYNAMIC_CAST);
186187
castOperators.push_back(&AS_REINTERPRET_CAST);
187188
castOperators.push_back(&AS_STATIC_CAST);
189+
castOperators.push_back(&AS_QOBJECT_CAST); // Qt cast
188190
}
189191

190192
/**

‎src/astyle/astyle.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ class ASResource
138138
static const string AS_ASM;
139139
static const string AS_FOREACH, AS_LOCK, AS_UNSAFE, AS_FIXED, AS_Q_FOREACH;
140140
static const string AS_GET, AS_SET, AS_ADD, AS_REMOVE;
141-
static const string AS_CONST_CAST, AS_DYNAMIC_CAST, AS_REINTERPRET_CAST, AS_STATIC_CAST;
141+
static const string AS_CONST_CAST, AS_DYNAMIC_CAST, AS_REINTERPRET_CAST, AS_STATIC_CAST, AS_QOBJECT_CAST;
142142
};
143143

144144
class ASBeautifier : protected ASResource

‎src/gui/qgsadvanceddigitizingcanvasitem.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class QgsAdvancedDigitizingDockWidget;
2525
/**
2626
* @brief The QgsAdvancedDigitizingCanvasItem class draws the graphical elements of the CAD tools (@see QgsAdvancedDigitizingDock) on the map canvas.
2727
*/
28-
class APP_EXPORT QgsAdvancedDigitizingCanvasItem : public QgsMapCanvasItem
28+
class GUI_EXPORT QgsAdvancedDigitizingCanvasItem : public QgsMapCanvasItem
2929
{
3030
public:
3131
explicit QgsAdvancedDigitizingCanvasItem( QgsMapCanvas* canvas, QgsAdvancedDigitizingDockWidget* cadDockWidget );

‎src/gui/qgsadvanceddigitizingdockwidget.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U
7373
* It contains all values (locked, value, relative) and pointers to corresponding widgets.
7474
* @note Relative is not mandatory since it is not used for distance.
7575
*/
76-
class CadConstraint
76+
class GUI_EXPORT CadConstraint
7777
{
7878
public:
7979
enum LockMode

‎src/gui/qgsmaptoolcapture.cpp

Lines changed: 25 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, QgsAdvancedDigitizin
4040
, mTempRubberBand( 0 )
4141
, mValidator( 0 )
4242
, mSnappingMarker( 0 )
43+
#ifdef Q_OS_WIN
44+
, mSkipNextContextMenuEvent( 0 )
45+
#endif
4346
{
4447
mCaptureMode = mode;
4548

@@ -366,8 +369,15 @@ void QgsMapToolCapture::stopCapturing()
366369
mGeomErrors.clear();
367370

368371
#ifdef Q_OS_WIN
369-
// hope your wearing your peril sensitive sunglasses.
370-
QgisApp::instance()->skipNextContextMenuEvent();
372+
Q_FOREACH ( QWidget *w, qApp->topLevelWidgets() )
373+
{
374+
if ( w->objectName() == "QgisApp" )
375+
{
376+
if ( mSkipNextContextMenuEvent++ == 0 )
377+
w->installEventFilter( this );
378+
break;
379+
}
380+
}
371381
#endif
372382

373383
mCapturing = false;
@@ -490,3 +500,16 @@ void QgsMapToolCapture::setPoints( const QList<QgsPoint>& pointList )
490500
mCaptureCurve.clear();
491501
mCaptureCurve.addCurve( line );
492502
}
503+
504+
#ifdef Q_OS_WIN
505+
bool QgsMapToolCapture::eventFilter( QObject *obj, QEvent *event )
506+
{
507+
if ( event->type() != QEvent::ContextMenu )
508+
return false;
509+
510+
if ( --mSkipNextContextMenuEvent == 0 )
511+
obj->removeEventFilter( this );
512+
513+
return mSkipNextContextMenuEvent >= 0;
514+
}
515+
#endif

‎src/gui/qgsmaptoolcapture.h

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,10 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
5454
void cadCanvasMoveEvent( QgsMapMouseEvent * e );
5555
void keyPressEvent( QKeyEvent* e );
5656

57+
#ifdef Q_OS_WIN
58+
virtual bool eventFilter( QObject *obj, QEvent *e ) override;
59+
#endif
60+
5761
private slots:
5862
void validationFinished();
5963

@@ -103,6 +107,10 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
103107
bool mCaptureModeFromLayer;
104108

105109
QgsVertexMarker* mSnappingMarker;
110+
111+
#ifdef Q_OS_WIN
112+
int mSkipNextContextMenuEvent;
113+
#endif
106114
};
107115

108116
#endif

‎src/gui/qgsowssourceselect.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
#include <QPushButton>
3131
#include <QNetworkRequest>
3232

33-
class QgisApp;
3433
class QgsDataProvider;
3534
class QButtonGroup;
3635
class QgsNumericSortTreeWidgetItem;

0 commit comments

Comments
 (0)
Please sign in to comment.