created qzxing_qml and qzxing_multimedia qmake CONFIG tags for QZXing.pri to allow the control of dependencies based on the needs. qzxing_qml enables QML specific parts of the library. qzxing_multimedia enables QZXingFilter which requires Qt's multimedia.

This commit is contained in:
favoritas37 2017-01-15 20:36:41 +02:00
parent b1eaeb1960
commit a3e71ec1e7
5 changed files with 42 additions and 18 deletions

View File

@ -1,8 +1,8 @@
TEMPLATE = app
QT += qml quick widgets multimedia
QT += qml quick
CONFIG += c++11
CONFIG += c++11 qzxing_multimedia
SOURCES += main.cpp

View File

@ -73,12 +73,14 @@ public:
QZXing(DecoderFormat decodeHints, QObject *parent = NULL);
#ifdef QZXING_QML
#if QT_VERSION >= 0x040700
static void registerQMLTypes()
{
qmlRegisterType<QZXing>("QZXing", 2, 3, "QZXing");
}
#endif
#endif //QT_VERSION >= Qt 4.7
#if QT_VERSION >= 0x050000
static void registerQMLImageProvider(const QQuickView& view)
@ -86,7 +88,9 @@ public:
QQmlEngine *engine = view.engine();
engine->addImageProvider(QLatin1String("QZXing"), QZXingImageProvider::getInstance());
}
#endif
#endif //QT_VERSION >= Qt 5.0
#endif //QZXING_QML
void setTryHarder(bool tryHarder);
bool getTryHarder();

View File

@ -1,7 +1,6 @@
QT += core gui widgets
QT += core gui
greaterThan(QT_VERSION, 4.7): lessThan(QT_VERSION, 5.0): QT += declarative
greaterThan(QT_MAJOR_VERSION, 4): QT += quick
CONFIG += qzxing_qml
DEFINES += QZXING_LIBRARY \
ZXING_ICONV_CONST \
@ -14,7 +13,6 @@ HEADERS += $$PWD/QZXing_global.h \
$$PWD/CameraImageWrapper.h \
$$PWD/imagehandler.h \
$$PWD/QZXing.h \
$$PWD/QZXingFilter.h \
$$PWD/zxing/zxing/ZXing.h \
$$PWD/zxing/zxing/IllegalStateException.h \
$$PWD/zxing/zxing/InvertedLuminanceSource.h \
@ -134,13 +132,10 @@ HEADERS += $$PWD/QZXing_global.h \
$$PWD/zxing/zxing/EncodeHint.h \
$$PWD/zxing/zxing/UnsupportedEncodingException.h \
$$PWD/zxing/zxing/common/reedsolomon/ReedSolomonEncoder.h \
$$PWD/zxing/zxing/common/Types.h \
$$PWD/QZXingImageProvider.h
$$PWD/zxing/zxing/common/Types.h
SOURCES += $$PWD/CameraImageWrapper.cpp \
$$PWD/QZXingImageProvider.cpp\
$$PWD/qzxing.cpp \
$$PWD/QZXingFilter.cpp \
$$PWD/imagehandler.cpp \
$$PWD/zxing/zxing/ResultIO.cpp \
$$PWD/zxing/zxing/InvertedLuminanceSource.cpp \
@ -250,6 +245,30 @@ SOURCES += $$PWD/CameraImageWrapper.cpp \
$$PWD/zxing/zxing/EncodeHint.cpp \
$$PWD/zxing/zxing/common/reedsolomon/ReedSolomonEncoder.cpp
qzxing_qml {
greaterThan(QT_VERSION, 4.7): lessThan(QT_VERSION, 5.0): QT += declarative
greaterThan(QT_MAJOR_VERSION, 4): QT += quick
DEFINES += QZXING_QML
HEADERS += \
$$PWD/QZXingImageProvider.h
SOURCES += \
$$PWD/QZXingImageProvider.cpp
}
qzxing_multimedia {
QT += multimedia
HEADERS += \
$$PWD/QZXingFilter.h
SOURCES += \
$$PWD/QZXingFilter.cpp
}
symbian {
TARGET.UID3 = 0xE618743C
TARGET.EPOCALLOWDLLDATA = 1

View File

@ -1,8 +1,6 @@
#include "imagehandler.h"
#include <QGraphicsObject>
#include <QImage>
#include <QPainter>
#include <QStyleOptionGraphicsItem>
#include <QDebug>
#include <QQuickItem>
#include <QQuickItemGrabResult>
@ -10,6 +8,11 @@
#include <QThread>
#include <QTime>
#if QT_VERSION < 0x050000
#include <QGraphicsObject>
#include <QStyleOptionGraphicsItem>
#endif // QT_VERSION < Qt 5.0
ImageHandler::ImageHandler(QObject *parent) :
QObject(parent)
{

View File

@ -1,7 +1,5 @@
QT += core
QT -= gui
CONFIG += gnu++11
CONFIG -= qzxing_qml
QMAKE_CXXFLAGS += -std=gnu++11
TARGET = QZXingTests