Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[libqtsparql] Remove obsolete Qt4 support. Contributes to JB#38781
  • Loading branch information
mlehtima committed Jun 30, 2020
1 parent 3938933 commit 31cfc6e
Show file tree
Hide file tree
Showing 39 changed files with 18 additions and 1,047 deletions.
3 changes: 1 addition & 2 deletions examples/sparql/dbpedia/dbpedia.pro
Expand Up @@ -4,8 +4,7 @@ HEADERS += sparqlquerytext.h
SOURCES += main.cpp sparqlquerytext.cpp

#QT += sparql #enable this later
QT += network xml gui
equals(QT_MAJOR_VERSION, 5): QT += widgets
QT += network xml gui widgets

# install # FIXME: install + package examples later
#target.path = $$EXAMPLES_DIR/sparql/dbpedia
Expand Down
4 changes: 0 additions & 4 deletions examples/sparql/dbpedia/sparqlquerytext.cpp
Expand Up @@ -53,11 +53,7 @@ SparqlQueryText::SparqlQueryText(QSparqlConnection& conn, QWidget *parent)
tableView = new QTableView();
tableView->setModel(model);
tableView->resize(1000, 600);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
tableView->horizontalHeader()->setSectionResizeMode(QHeaderView::ResizeToContents);
#else
tableView->horizontalHeader()->setResizeMode(QHeaderView::ResizeToContents);
#endif
}

void SparqlQueryText::runQuery()
Expand Down
14 changes: 0 additions & 14 deletions examples/sparql/qmlbindings/main.cpp
Expand Up @@ -40,26 +40,16 @@
****************************************************************************/

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QGuiApplication>
#include <QQuickItem>
#include <QQuickView>
#include <QQmlEngine>
#else
#include <QApplication>
#include <QtDeclarative>
#endif
#include <QtSparql>
#include <QtDBus>
#include <QString>

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
typedef QGuiApplication ApplicationType;
typedef QQuickView ViewType;
#else
typedef QApplication ApplicationType;
typedef QDeclarativeView ViewType;
#endif

class ModelLiveChange : public QObject
{
Expand Down Expand Up @@ -127,11 +117,7 @@ int main(int argc, char *argv[])
// they haven't been install
viewQml.engine()->addImportPath("../../../imports");

#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
viewQml.setSource(QUrl::fromLocalFile("main-qt5.qml"));
#else
viewQml.setSource(QUrl::fromLocalFile("main.qml"));
#endif

// The bindings can be cast back to the appropriate QtSparql classes by setting
// an "objectName" property on them, and casting them, eg :
Expand Down
224 changes: 0 additions & 224 deletions examples/sparql/qmlbindings/main.qml

This file was deleted.

8 changes: 3 additions & 5 deletions examples/sparql/qmlbindings/qmlbindings.pro
Expand Up @@ -3,12 +3,10 @@ include(../sparql-examples.pri)
SOURCES += main.cpp

#QT += sparql #enable this later
QT += gui dbus
equals(QT_MAJOR_VERSION, 4): QT += declarative
equals(QT_MAJOR_VERSION, 5): QT += quick
QT += gui dbus quick

copy2build.target = $$QTSPARQL_BUILD_TREE/examples/sparql/qmlbindings/main.qml
copy2build.commands = $$QMAKE_COPY $$PWD/main.qml $$QTSPARQL_BUILD_TREE/examples/sparql/qmlbindings
copy2build.target = $$QTSPARQL_BUILD_TREE/examples/sparql/qmlbindings/main-qt5.qml
copy2build.commands = $$QMAKE_COPY $$PWD/main-qt5.qml $$QTSPARQL_BUILD_TREE/examples/sparql/qmlbindings
QMAKE_EXTRA_TARGETS += copy2build

copy2buildhook.depends = copy2build
Expand Down
18 changes: 0 additions & 18 deletions examples/sparql/qmlquerymodel/main.cpp
Expand Up @@ -40,15 +40,10 @@
****************************************************************************/

#include <QtGlobal>
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
#include <QGuiApplication>
#include <QQmlContext>
#include <QQuickItem>
#include <QQuickView>
#else
#include <QApplication>
#include <QtDeclarative>
#endif
#include <QtSparql>
#include <QtDBus>
#include <QString>
Expand Down Expand Up @@ -143,30 +138,17 @@ void ModelLiveChange::gotClick(QString firstName, QString familyName)

int main(int argc, char *argv[])
{
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QGuiApplication app(argc, argv);
#else
QApplication app(argc, argv);
#endif

// Initialise QML
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
QQuickView viewQml;
QQmlContext *ctxt = viewQml.rootContext();
#else
QDeclarativeView viewQml;
QDeclarativeContext *ctxt = viewQml.rootContext();
#endif

// Create the model
QSparqlQueryModel *model = new QSparqlQueryModel();
// Now set the context property for the ListView model to the liveQuery model
ctxt->setContextProperty("contactModel", model);
#if QT_VERSION >= QT_VERSION_CHECK(5, 0, 0)
viewQml.setSource(QUrl::fromLocalFile("main-qt5.qml"));
#else
viewQml.setSource(QUrl::fromLocalFile("main.qml"));
#endif

ModelLiveChange changeNotifier(model);

Expand Down

0 comments on commit 31cfc6e

Please sign in to comment.