Skip to content
Permalink
Browse files

fix windows build

  • Loading branch information
jef-n committed Sep 11, 2015
1 parent 50cab53 commit bd86697b6e86c2de355f8451a2c98a1af06a366a
@@ -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 )
@@ -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.
@@ -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

@@ -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 );
@@ -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;

@@ -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");


/**
@@ -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
}

/**
@@ -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
@@ -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 );
@@ -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
@@ -40,6 +40,9 @@ QgsMapToolCapture::QgsMapToolCapture( QgsMapCanvas* canvas, QgsAdvancedDigitizin
, mTempRubberBand( 0 )
, mValidator( 0 )
, mSnappingMarker( 0 )
#ifdef Q_OS_WIN
, mSkipNextContextMenuEvent( 0 )
#endif
{
mCaptureMode = mode;

@@ -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;
@@ -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
@@ -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();

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

QgsVertexMarker* mSnappingMarker;

#ifdef Q_OS_WIN
int mSkipNextContextMenuEvent;
#endif
};

#endif
@@ -30,7 +30,6 @@
#include <QPushButton>
#include <QNetworkRequest>

class QgisApp;
class QgsDataProvider;
class QButtonGroup;
class QgsNumericSortTreeWidgetItem;

0 comments on commit bd86697

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