Skip to content

Commit

Permalink
fix windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
jef-n committed Sep 11, 2015
1 parent 50cab53 commit bd86697
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 50 deletions.
32 changes: 0 additions & 32 deletions src/app/qgisapp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,6 @@ QgisApp *QgisApp::smInstance = 0;
// constructor starts here
QgisApp::QgisApp( QSplashScreen *splash, bool restorePlugins, QWidget * parent, Qt::WindowFlags fl )
: QMainWindow( parent, fl )
#ifdef Q_OS_WIN
, mSkipNextContextMenuEvent( 0 )
#endif
, mNonEditMapTool( 0 )
, mScaleLabel( 0 )
, mScaleEdit( 0 )
Expand Down Expand Up @@ -10126,35 +10123,6 @@ void QgisApp::mapCanvas_keyPressed( QKeyEvent *e )
}
}

#ifdef Q_OS_WIN
// hope your wearing your peril sensitive sunglasses.
void QgisApp::contextMenuEvent( QContextMenuEvent *e )
{
if ( mSkipNextContextMenuEvent )
{
mSkipNextContextMenuEvent--;
e->ignore();
return;
}

QMainWindow::contextMenuEvent( e );
}

void QgisApp::skipNextContextMenuEvent()
{
mSkipNextContextMenuEvent++;
}
#endif

// Debug hook - used to output diagnostic messages when evoked (usually from the menu)
/* Temporarily disabled...
void QgisApp::debugHook()
{
QgsDebugMsg("Hello from debug hook");
// show the map canvas extent
QgsDebugMsg(mMapCanvas->extent());
}
*/
void QgisApp::customProjection()
{
// Create an instance of the Custom Projection Designer modeless dialog.
Expand Down
12 changes: 0 additions & 12 deletions src/app/qgisapp.h
Original file line number Diff line number Diff line change
Expand Up @@ -474,9 +474,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow
static QString normalizedMenuName( const QString & name ) { return name.normalized( QString::NormalizationForm_KD ).remove( QRegExp( "[^a-zA-Z]" ) ); }

#ifdef Q_OS_WIN
//! ugly hack
void skipNextContextMenuEvent();

static LONG WINAPI qgisCrashDump( struct _EXCEPTION_POINTERS *ExceptionInfo );
#endif

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

#ifdef Q_OS_WIN
//! reimplements context menu event
virtual void contextMenuEvent( QContextMenuEvent *event );
#endif

private slots:
//! validate a SRS
void validateSrs( QgsCoordinateReferenceSystem &crs );
Expand Down Expand Up @@ -1656,10 +1648,6 @@ class APP_EXPORT QgisApp : public QMainWindow, private Ui::MainWindow

int mLastComposerId;

#ifdef Q_OS_WIN
int mSkipNextContextMenuEvent; // ugly hack
#endif

//! Persistent GPS toolbox
QgsGPSInformationWidget *mpGpsWidget;

Expand Down
2 changes: 2 additions & 0 deletions src/astyle/ASResource.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,6 +139,7 @@ const string ASResource::AS_CONST_CAST = string("const_cast");
const string ASResource::AS_DYNAMIC_CAST = string("dynamic_cast");
const string ASResource::AS_REINTERPRET_CAST = string("reinterpret_cast");
const string ASResource::AS_STATIC_CAST = string("static_cast");
const string ASResource::AS_QOBJECT_CAST = string("qobject_cast");


/**
Expand Down Expand Up @@ -185,6 +186,7 @@ void ASResource::buildCastOperators(vector<const string*> &castOperators)
castOperators.push_back(&AS_DYNAMIC_CAST);
castOperators.push_back(&AS_REINTERPRET_CAST);
castOperators.push_back(&AS_STATIC_CAST);
castOperators.push_back(&AS_QOBJECT_CAST); // Qt cast
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/astyle/astyle.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ class ASResource
static const string AS_ASM;
static const string AS_FOREACH, AS_LOCK, AS_UNSAFE, AS_FIXED, AS_Q_FOREACH;
static const string AS_GET, AS_SET, AS_ADD, AS_REMOVE;
static const string AS_CONST_CAST, AS_DYNAMIC_CAST, AS_REINTERPRET_CAST, AS_STATIC_CAST;
static const string AS_CONST_CAST, AS_DYNAMIC_CAST, AS_REINTERPRET_CAST, AS_STATIC_CAST, AS_QOBJECT_CAST;
};

class ASBeautifier : protected ASResource
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsadvanceddigitizingcanvasitem.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class QgsAdvancedDigitizingDockWidget;
/**
* @brief The QgsAdvancedDigitizingCanvasItem class draws the graphical elements of the CAD tools (@see QgsAdvancedDigitizingDock) on the map canvas.
*/
class APP_EXPORT QgsAdvancedDigitizingCanvasItem : public QgsMapCanvasItem
class GUI_EXPORT QgsAdvancedDigitizingCanvasItem : public QgsMapCanvasItem
{
public:
explicit QgsAdvancedDigitizingCanvasItem( QgsMapCanvas* canvas, QgsAdvancedDigitizingDockWidget* cadDockWidget );
Expand Down
2 changes: 1 addition & 1 deletion src/gui/qgsadvanceddigitizingdockwidget.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class GUI_EXPORT QgsAdvancedDigitizingDockWidget : public QDockWidget, private U
* It contains all values (locked, value, relative) and pointers to corresponding widgets.
* @note Relative is not mandatory since it is not used for distance.
*/
class CadConstraint
class GUI_EXPORT CadConstraint
{
public:
enum LockMode
Expand Down
27 changes: 25 additions & 2 deletions src/gui/qgsmaptoolcapture.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, QgsAdvancedDigitizin
, mTempRubberBand( 0 )
, mValidator( 0 )
, mSnappingMarker( 0 )
#ifdef Q_OS_WIN
, mSkipNextContextMenuEvent( 0 )
#endif
{
mCaptureMode = mode;

Expand Down Expand Up @@ -366,8 +369,15 @@ void QgsMapToolCapture::stopCapturing()
mGeomErrors.clear();

#ifdef Q_OS_WIN
// hope your wearing your peril sensitive sunglasses.
QgisApp::instance()->skipNextContextMenuEvent();
Q_FOREACH ( QWidget *w, qApp->topLevelWidgets() )
{
if ( w->objectName() == "QgisApp" )
{
if ( mSkipNextContextMenuEvent++ == 0 )
w->installEventFilter( this );
break;
}
}
#endif

mCapturing = false;
Expand Down Expand Up @@ -490,3 +500,16 @@ void QgsMapToolCapture::setPoints( const QList<QgsPoint>& pointList )
mCaptureCurve.clear();
mCaptureCurve.addCurve( line );
}

#ifdef Q_OS_WIN
bool QgsMapToolCapture::eventFilter( QObject *obj, QEvent *event )
{
if ( event->type() != QEvent::ContextMenu )
return false;

if ( --mSkipNextContextMenuEvent == 0 )
obj->removeEventFilter( this );

return mSkipNextContextMenuEvent >= 0;
}
#endif
8 changes: 8 additions & 0 deletions src/gui/qgsmaptoolcapture.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,10 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
void cadCanvasMoveEvent( QgsMapMouseEvent * e );
void keyPressEvent( QKeyEvent* e );

#ifdef Q_OS_WIN
virtual bool eventFilter( QObject *obj, QEvent *e ) override;
#endif

private slots:
void validationFinished();

Expand Down Expand Up @@ -103,6 +107,10 @@ class GUI_EXPORT QgsMapToolCapture : public QgsMapToolAdvancedDigitizing
bool mCaptureModeFromLayer;

QgsVertexMarker* mSnappingMarker;

#ifdef Q_OS_WIN
int mSkipNextContextMenuEvent;
#endif
};

#endif
1 change: 0 additions & 1 deletion src/gui/qgsowssourceselect.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include <QPushButton>
#include <QNetworkRequest>

class QgisApp;
class QgsDataProvider;
class QButtonGroup;
class QgsNumericSortTreeWidgetItem;
Expand Down

0 comments on commit bd86697

Please sign in to comment.