c++ - Compilation error when moving to Qt5 : 'Type' has not been declared -
use qt 5.2.1 compile old qt project (maybe created qt 4.8): lan messenger open source:
#ifndef qtsingleapplication_h #define qtsingleapplication_h #include <qapplication> class qtlocalpeer; #if defined(q_ws_win) || defined(q_os_win32) # if !defined(qt_qtsingleapplication_export) && !defined(qt_qtsingleapplication_import) # define qt_qtsingleapplication_export # elif defined(qt_qtsingleapplication_import) # if defined(qt_qtsingleapplication_export) # undef qt_qtsingleapplication_export # endif # define qt_qtsingleapplication_export __declspec(dllimport) # elif defined(qt_qtsingleapplication_export) # undef qt_qtsingleapplication_export # define qt_qtsingleapplication_export __declspec(dllexport) # endif #else # define qt_qtsingleapplication_export #endif class qt_qtsingleapplication_export qtsingleapplication : public qapplication { q_object public: qtsingleapplication(int &argc, char **argv, bool guienabled = true); qtsingleapplication(const qstring &id, int &argc, char **argv); qtsingleapplication(int &argc, char **argv, type type); #if defined(q_ws_x11) qtsingleapplication(display* dpy, qt::handle visual = 0, qt::handle colormap = 0); qtsingleapplication(display *dpy, int &argc, char **argv, qt::handle visual = 0, qt::handle cmap= 0); qtsingleapplication(display* dpy, const qstring &appid, int argc, char **argv, qt::handle visual = 0, qt::handle colormap = 0); #endif bool isrunning(); qstring id() const; void setactivationwindow(qwidget* aw, bool activateonmessage = true); qwidget* activationwindow() const; // obsolete: void initialize(bool dummy = true) { isrunning(); q_unused(dummy) } public q_slots: bool sendmessage(const qstring &message, int timeout = 5000); void activatewindow(); q_signals: void messagereceived(const qstring &message); private: void sysinit(const qstring &appid = qstring()); qtlocalpeer *peer; qwidget *actwin; }; #endif // qtsingleapplication_h
error: 'type' has not been declared
i dont know how fix these error. help? thank you.
quote commit in qt repository :
qcoreapplication::type , qapplication::type() have been removed. these qt3 legacy application types did not match application types available in qt5. use example qobject_cast instead dynamically find out exact application type.
https://qt.gitorious.org/qt/qtbase/commit/553e216d891177ee0c2cea70bbd7f21103fc7795.
as workaround if don't specify type in qtsingleapplication constructor can comment out , still keep using qtsingleapplication without it.
qtsingleapplication.h: line 70:
//qtsingleapplication(int &argc, char **argv, type type);
qtsingleapplication.cpp: line 176:
/*qtsingleapplication::qtsingleapplication(int &argc, char **argv, type type) : qapplication(argc, argv, type) { sysinit(); }*/
Comments
Post a Comment