From eda02d2c1f898e4c02ccd2317973c2b8463a7037 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Thu, 16 Jul 2020 18:12:47 +0200 Subject: Make it work with Qt5. --- configure.ac | 20 ++++++++++---------- src/editorwindow.cc | 5 ++++- src/mainwindow.cc | 4 ++++ src/mainwindow.h | 11 +++++------ src/mapwidget.cc | 8 +++++--- 5 files changed, 28 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index b008aff..0fe50fc 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ dnl dnl see also http://qtnode.net/wiki/Qt_with_autotools dnl -AC_INIT(editor,0.1) +AC_INIT(editor,0.2) AC_CONFIG_HEADERS(src/config.h) @@ -18,9 +18,9 @@ dnl AC_MSG_CHECKING(Qt installation prefix) QTDIR=xxx AC_ARG_WITH([qt-prefix], - AC_HELP_STRING([--with-qt-prefix=], [to specify the path to the Qt-4.8.0 installation prefix.]), + AC_HELP_STRING([--with-qt-prefix=], [to specify the path to the Qt5 installation prefix.]), [QTPATHS="$withval"], - [QTPATHS="/usr /usr/qt4 /opt/qt4"]) + [QTPATHS="/usr /usr/qt5 /opt/qt5"]) for x in $QTPATHS; do if test -d $x ; then @@ -28,7 +28,7 @@ for x in $QTPATHS; do fi done if test $QTDIR = xxx ; then - AC_MSG_ERROR(Could not locate QT 4.1) + AC_MSG_ERROR(Could not locate Qt5) fi AC_MSG_RESULT($QTDIR) @@ -38,7 +38,7 @@ dnl AC_MSG_CHECKING(Qt includes directory) AC_ARG_WITH([qt-includes], - AC_HELP_STRING([--with-qt-includes], [to specify the path to directory containing the the Qt-4.8.0 includes.]), + AC_HELP_STRING([--with-qt-includes], [to specify the path to directory containing the the Qt5 includes.]), [QTINCLUDEDIR="$withval"], [QTINCLUDEDIR="$QTDIR/include"]) AC_MSG_RESULT($QTINCLUDEDIR) @@ -48,7 +48,7 @@ dnl Qt libraries directory dnl AC_MSG_CHECKING(Qt libraries directory) AC_ARG_WITH([qt-libraries], - AC_HELP_STRING([--with-qt-libraries=], [to specify the path to directory containing the the Qt-4.8.0 libraries.]), + AC_HELP_STRING([--with-qt-libraries=], [to specify the path to directory containing the the Qt5 libraries.]), [QTLIBDIR="$withval"], [QTLIBDIR="$QTDIR/lib"]) AC_MSG_RESULT($QTLIBDIR) @@ -70,15 +70,15 @@ host=`uname -a` # AC_CANONICAL_HOST is broken at the time of this writing. case $host in MINGW32*) AC_MSG_NOTICE(win32) - QTLIBS="-L$QTLIBDIR -lgdi32 -luser32 -lmingw32 -lqtmain -lQtGui4 -lQtCore4 -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows" - QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtCore -I$QTINCLUDEDIR/QtGui -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -frtti -fexceptions" + QTLIBS="-L$QTLIBDIR -lgdi32 -luser32 -lmingw32 -lqtmain -lQt5Widgets -lQt5Gui -lQt5Core -mthreads -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc -Wl,-s -Wl,-s -Wl,-subsystem,windows" + QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtCore -I$QTINCLUDEDIR/QtGui -I$QTINCLUDEDIR/QtWidgets -DUNICODE -DQT_LARGEFILE_SUPPORT -DQT_DLL -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_THREAD_SUPPORT -DQT_NEEDS_QMAIN -frtti -fexceptions" QTBIN="$QTDIR/bin" ;; *) AC_MSG_NOTICE(generic UNIX) AC_PATH_XTRA - QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtGui -I$QTINCLUDEDIR/QtCore $X_CFLAGS -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED" - QTLIBS="-Wl,-rpath,QTLIBDIR -L$QTLIBDIR -lQtGui -lQtCore -lpthread" + QTINC="-I$QTINCLUDEDIR -I$QTINCLUDEDIR/QtCore -I$QTINCLUDEDIR/QtGui -I$QTINCLUDEDIR/QtWidgets $X_CFLAGS -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED" + QTLIBS="-Wl,-rpath,QTLIBDIR -L$QTLIBDIR -lQt5Widgets -lQt5Gui -lQt5Core -lpthread" QTBIN="$QTDIR/bin" ;; esac diff --git a/src/editorwindow.cc b/src/editorwindow.cc index 29f2c1f..00ff0fd 100644 --- a/src/editorwindow.cc +++ b/src/editorwindow.cc @@ -11,11 +11,14 @@ #include "mapwidget.h" #include "sidebar.h" -#include #include #include #include #include + +#include +#include +#include namespace editor { diff --git a/src/mainwindow.cc b/src/mainwindow.cc index 6aaf48a..31bcf60 100644 --- a/src/mainwindow.cc +++ b/src/mainwindow.cc @@ -10,6 +10,10 @@ #include "config.h" +#include +#include +#include + namespace editor { diff --git a/src/mainwindow.h b/src/mainwindow.h index 4bf2ffb..66c63c2 100644 --- a/src/mainwindow.h +++ b/src/mainwindow.h @@ -9,12 +9,11 @@ #define __INCLUDED_EDITOR_MAINWINDOW__ #include - #include - -class QAction; -class QMenu; -class QMdiArea; +#include +#include +#include +#include namespace editor { @@ -71,4 +70,4 @@ private: } -#endif // __INCLUDED_EDITOR_MAINWINDOW__ \ No newline at end of file +#endif // __INCLUDED_EDITOR_MAINWINDOW__ diff --git a/src/mapwidget.cc b/src/mapwidget.cc index b5f52d1..ba00799 100644 --- a/src/mapwidget.cc +++ b/src/mapwidget.cc @@ -47,11 +47,13 @@ float MapWidget::zoom() const void MapWidget::wheelEvent(QWheelEvent *event) { - if (event->orientation() == Qt::Vertical) { + QPoint p = event->angleDelta() / 120; - mapwidget_zoomfactor += event->delta() / 120; + if (!p.isNull()) { + + mapwidget_zoomfactor += p.y(); - if (mapwidget_zoomfactor < - 64) { + if (mapwidget_zoomfactor < -64) { mapwidget_zoomfactor = -64; } else if (mapwidget_zoomfactor > 64) { mapwidget_zoomfactor = 64; -- cgit v1.2.3