From c6e2322e5357736871bd6d5c1f87222fe9dac738 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Fri, 15 Feb 2013 10:48:51 +0100 Subject: Make Qt5 compatible. --- client/client.pro | 6 ++++++ client/client.qrc | 2 +- client/collapser.cc | 4 ++-- client/messagebox.cc | 3 ++- client/netcom.cc | 29 +++++++++++++++++++---------- client/praxisd.cc | 14 ++++++++++++-- 6 files changed, 42 insertions(+), 16 deletions(-) diff --git a/client/client.pro b/client/client.pro index b41c835..43f568f 100644 --- a/client/client.pro +++ b/client/client.pro @@ -18,6 +18,12 @@ debug { DEFINES+=VERSION=\\\"2.2.4\\\" +# For Qt5 +contains(QT_VERSION, ^5.*) { + QT += widgets + DEFINES += QT5 +} + win32 { QMAKE_LIBDIR += lua/lib INCLUDEPATH += lua/include diff --git a/client/client.qrc b/client/client.qrc index a6b43bb..eb4e932 100644 --- a/client/client.qrc +++ b/client/client.qrc @@ -1,6 +1,6 @@ - + icons/icon.png icons/add.png icons/open.png diff --git a/client/collapser.cc b/client/collapser.cc index abbe295..802c4a7 100644 --- a/client/collapser.cc +++ b/client/collapser.cc @@ -173,14 +173,14 @@ void Collapser::Placeholder::grabFrom(QWidget *w) { weight = 0; // Reset - pixmap_from = grab(w, from_height, width()); + pixmap_from = ::grab(w, from_height, width()); } void Collapser::Placeholder::grabTo(QWidget *w) { weight = 0; // Reset - pixmap_to = grab(w, to_height, width()); + pixmap_to = ::grab(w, to_height, width()); } void Collapser::Placeholder::setWeight(double w) diff --git a/client/messagebox.cc b/client/messagebox.cc index 902d2fd..a6058a6 100644 --- a/client/messagebox.cc +++ b/client/messagebox.cc @@ -41,7 +41,8 @@ static MessageBox::StandardButton showNewMessageBox(QWidget *parent, MessageBox::StandardButton defaultButton) { QMessageBox msgBox(icon, title, text, MessageBox::NoButton, parent); - QDialogButtonBox *buttonBox = qFindChild(&msgBox); + QDialogButtonBox *buttonBox = msgBox.findChild(); + Q_ASSERT(buttonBox != 0); uint mask = MessageBox::FirstButton; diff --git a/client/netcom.cc b/client/netcom.cc index 9c755b5..e0c7541 100644 --- a/client/netcom.cc +++ b/client/netcom.cc @@ -26,18 +26,19 @@ */ #include "netcom.h" +#include "debug.h" + #include #include #include -#include +//#include #include #include "widgets/widget.h" -#include "debug.h" #ifdef USE_SSL #include @@ -119,18 +120,21 @@ void NetCom::makeTransfer(QByteArray body, session_state_t state, QString uri) url.setPort(request.url().port()); url.setScheme(request.url().scheme()); +#ifdef QT5 + QUrlQuery query; +#else + QUrl &query = url; +#endif + switch(state) { case ::commit: - // request.setRawHeader("SessionCommit", "yes"); - url.addQueryItem("statechange", "commit"); + query.addQueryItem("statechange", "commit"); break; case ::discard: - // request.setRawHeader("SessionDiscard", "yes"); - url.addQueryItem("statechange", "discard"); + query.addQueryItem("statechange", "discard"); break; case ::nocommit: - // request.setRawHeader("SessionNoCommit", "yes"); - url.addQueryItem("statechange", "nocommit"); + query.addQueryItem("statechange", "nocommit"); break; default: case ::none: @@ -138,8 +142,13 @@ void NetCom::makeTransfer(QByteArray body, session_state_t state, QString uri) } url.setPath(uri); - if(sessionid != "") url.addQueryItem("sessionid", sessionid); - if(patientid != "") url.addQueryItem("patientid", patientid); + if(sessionid != "") query.addQueryItem("sessionid", sessionid); + if(patientid != "") query.addQueryItem("patientid", patientid); + +#ifdef QT5 + url.setQuery(query); +#endif + request.setUrl(url); manager->post(request, body); diff --git a/client/praxisd.cc b/client/praxisd.cc index 42fdd0c..d0bb280 100644 --- a/client/praxisd.cc +++ b/client/praxisd.cc @@ -31,7 +31,7 @@ #include -#include +#include #define DOCAVE(x) if(element.tagName() == #x) cave.x = element.text() static CaveVector getCaveList(QByteArray data) @@ -315,12 +315,22 @@ void Praxisd::makeTransfer(reply_t t, QString uri, url.setPath(uri); +#ifdef QT5 + QUrlQuery query; +#else + QUrl &query = url; +#endif + QMap::iterator i = params.begin(); while(i != params.end()) { - url.addQueryItem(i.key(), i.value()); + query.addQueryItem(i.key(), i.value()); i++; } +#ifdef QT5 + url.setQuery(query); +#endif + request.setUrl(url); QNetworkReply* r = manager->get(request); -- cgit v1.2.3