You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
141 lines
4.4 KiB
141 lines
4.4 KiB
diff --git a/configure.ac b/configure.ac
|
|
index dbd7153fb13b..7bcb18219853 100644
|
|
--- a/configure.ac
|
|
+++ b/configure.ac
|
|
@@ -476,18 +476,33 @@ AM_CONDITIONAL([HAVE_PYTHON], [test "x$with_python" = "xyes"])
|
|
dnl Qt
|
|
AC_ARG_WITH([qt],
|
|
[AS_HELP_STRING([--without-qt],
|
|
- [disable support for Qt4 widget])],
|
|
+ [disable support for Qt widget])],
|
|
[],
|
|
[with_qt="yes"])
|
|
|
|
+dnl Qt5
|
|
+AC_ARG_WITH([qt5],
|
|
+ [AS_HELP_STRING([--without-qt5],
|
|
+ [disable support for Qt5 widget. if --with-qt, it will seek only for Qt4])],
|
|
+ [],
|
|
+ [with_qt5="yes"])
|
|
+
|
|
AC_ARG_VAR([MOC], [full path to Qt moc program])
|
|
|
|
AS_IF([test "x$with_qt" != "xno"],
|
|
- [PKG_CHECK_MODULES([QT], [QtCore >= 4 QtGui >= 4])
|
|
- MOC=`$PKG_CONFIG QtGui --variable=moc_location`
|
|
- AC_MSG_NOTICE([using moc from $MOC])
|
|
- QT_VERSION=`$PKG_CONFIG QtGui --modversion`
|
|
- AC_MSG_NOTICE([using Qt version $QT_VERSION])])
|
|
+ AS_IF([test "x$with_qt5" != "xno"],
|
|
+ [PKG_CHECK_MODULES([QT], [Qt5Core >= 5 Qt5Gui >= 5 Qt5Widgets >= 5.0 Qt5X11Extras >= 5.0])
|
|
+ AC_CHECK_PROGS(MOC, [moc-qt5 moc])
|
|
+ AC_MSG_NOTICE([using moc from $MOC])
|
|
+ QT_VERSION=`$PKG_CONFIG Qt5Gui --modversion`
|
|
+ CPPFLAGS="$CPPFLAGS $QT_CPPFLAGS -fPIC"
|
|
+ AC_MSG_NOTICE([using Qt version $QT_VERSION])],
|
|
+
|
|
+ [PKG_CHECK_MODULES([QT], [QtCore >= 4 QtGui >= 4])
|
|
+ MOC=`$PKG_CONFIG QtGui --variable=moc_location`
|
|
+ AC_MSG_NOTICE([using moc from $MOC])
|
|
+ QT_VERSION=`$PKG_CONFIG QtGui --modversion`
|
|
+ AC_MSG_NOTICE([using Qt version $QT_VERSION])]))
|
|
|
|
AM_CONDITIONAL([HAVE_QT], [test "x$with_qt" = "xyes"])
|
|
|
|
@@ -596,9 +611,9 @@ AS_IF([test "x$with_gtk" != "xyes"],
|
|
[echo " => the GTK+ widget will *NOT* be built"],
|
|
[AS_IF([test "x$with_python" != "xyes"],
|
|
[echo " => the PyGTK widget wrapper will *NOT* be built"])])
|
|
-echo "Qt4 --with-qt=$with_qt"
|
|
+echo "Qt${QT_VERSION} --with-qt=$with_qt"
|
|
AS_IF([test "x$with_qt" != "xyes"],
|
|
- [echo " => the Qt4 widget will *NOT* be built"])
|
|
+ [echo " => the Qt widget will *NOT* be built"])
|
|
echo "Java --with-java=$with_java"
|
|
AS_IF([test "x$with_java" != "xyes"],
|
|
[echo " => the Java interface will *NOT* be built"])
|
|
diff --git a/include/zbar/QZBar.h b/include/zbar/QZBar.h
|
|
index 104449928e2d..1a4716565047 100644
|
|
--- a/include/zbar/QZBar.h
|
|
+++ b/include/zbar/QZBar.h
|
|
@@ -26,7 +26,12 @@
|
|
/// @file
|
|
/// Barcode Reader Qt4 Widget
|
|
|
|
-#include <qwidget.h>
|
|
+#include <QtGui>
|
|
+#if QT_VERSION >= 0x050000
|
|
+# include <QtWidgets>
|
|
+#else
|
|
+# include <qwidget.h>
|
|
+#endif
|
|
|
|
namespace zbar {
|
|
|
|
diff --git a/include/zbar/QZBarImage.h b/include/zbar/QZBarImage.h
|
|
index 1505177e07a9..b862c8085576 100644
|
|
--- a/include/zbar/QZBarImage.h
|
|
+++ b/include/zbar/QZBarImage.h
|
|
@@ -54,7 +54,11 @@ public:
|
|
unsigned height = qimg.height();
|
|
set_size(width, height);
|
|
set_format(zbar_fourcc('B','G','R','4'));
|
|
+#if QT_VERSION >= 0x050000
|
|
+ unsigned long datalen = qimg.byteCount();
|
|
+#else
|
|
unsigned long datalen = qimg.numBytes();
|
|
+#endif
|
|
set_data(qimg.bits(), datalen);
|
|
|
|
if((width * 4 != bpl) ||
|
|
diff --git a/qt/QZBar.cpp b/qt/QZBar.cpp
|
|
index e1001b09cff5..a5b956b342ad 100644
|
|
--- a/qt/QZBar.cpp
|
|
+++ b/qt/QZBar.cpp
|
|
@@ -23,7 +23,7 @@
|
|
|
|
#include <qevent.h>
|
|
#include <qurl.h>
|
|
-#include <qx11info_x11.h>
|
|
+#include <QX11Info>
|
|
#include <zbar/QZBar.h>
|
|
#include "QZBarThread.h"
|
|
|
|
@@ -49,7 +49,11 @@ QZBar::QZBar (QWidget *parent)
|
|
|
|
thread = new QZBarThread;
|
|
if(testAttribute(Qt::WA_WState_Created)) {
|
|
+#if QT_VERSION >= 0x050000
|
|
+ thread->window.attach(QX11Info::display(), winId());
|
|
+#else
|
|
thread->window.attach(x11Info().display(), winId());
|
|
+#endif
|
|
_attached = 1;
|
|
}
|
|
connect(thread, SIGNAL(videoOpened(bool)),
|
|
@@ -204,7 +208,12 @@ void QZBar::changeEvent(QEvent *event)
|
|
try {
|
|
QMutexLocker locker(&thread->mutex);
|
|
if(event->type() == QEvent::ParentChange)
|
|
+#if QT_VERSION >= 0x050000
|
|
+ thread->window.attach(QX11Info::display(), winId());
|
|
+#else
|
|
thread->window.attach(x11Info().display(), winId());
|
|
+#endif
|
|
+
|
|
}
|
|
catch(Exception) { /* ignore (FIXME do something w/error) */ }
|
|
}
|
|
@@ -215,7 +224,11 @@ void QZBar::attach ()
|
|
return;
|
|
|
|
try {
|
|
+#if QT_VERSION >= 0x050000
|
|
+ thread->window.attach(QX11Info::display(), winId());
|
|
+#else
|
|
thread->window.attach(x11Info().display(), winId());
|
|
+#endif
|
|
_attached = 1;
|
|
|
|
_videoEnabled = !_videoDevice.isEmpty();
|