problem about qt5-Collection of common programming errors


  • Addy
    c++ qt qt4 cmake qt5
    I have a project that I originally started developing using Qt4 and am now working on migrating to Qt5. After a couple hours reworking some code and removing newly deprecated calls, I was able to get the project to compile but now I’m having problems getting it to link.I am using CMake to generate the project files. I started migrating by first modifying the “solutions’s” CMake file and replacing:############################################# # find QT FIND_PACKAGE(Qt4 REQUIRED)# configure QT modules SET(QT_USER_QTCORE TRUE) SET(QT_USE_QTMAIN TRUE) SET(QT_USE_QTWEBKIT TRUE) SET(QT_USE_QTNETWORK TRUE) SET(QT_USE_QTSQL TRUE)SET(QT_USE_QTXML TRUE) SET(QT_USE_QTUITOOLS TRUE)# include QT requirements INCLUDE(${QT_USE_FILE}) ADD_DEFINITIONS(${QT_DEFINITIONS}) #############################################with (this needs to be cleaned up)############################################# # find QT set(CMAKE_INCLUDE_CURRENT_DIR ON) set(CMAKE_AUTOMOC ON)FIND_PACKAGE(Qt5Concurrent REQUIRED) FIND_PACKAGE(Qt5Core REQUIRED) FIND_PACKAGE(Qt5Network REQUIRED) FIND_PACKAGE(Qt5Sql REQUIRED) FIND_PACKAGE(Qt5WebKit REQUIRED) FIND_PACKAGE(Qt5WebKitWidgets REQUIRED) FIND_PACKAGE(Qt5Widgets REQUIRED) FIND_PACKAGE(Qt5Xml REQUIRED)INCLUDE_DIRECTORIES(${Qt5Concurrent_INCLUDE_DIRS}${QT5_FOLDER}”C:/Qt/Qt5.0.2/5.0.2/msvc2012_64/include” )ADD_DEFINITIONS(${QT_DEFINITIONS}) #############################################After this, I commented out all my calls to ADD_SUBDIRECTORY() and started adding them back in one at a time. My project uses Log4Qt and since that has no other dependencies on other subdirectories, it was the first subproject I started working on.In Log4Qt’s CMakeLists.txt file, I simply changed QT4_WRAP_CPP(MOC_SOURCE_FILES ${MOC_HEADERS}) to QT5_WRAP_CPP(MOC_SOURCE_FILES ${MOC_HEADERS}), with MOC_HEADERS being defined as all the necessarily MOC’d headers in Log4Qt.When I load this up in VS2013 and build, it compiles fine but linking throws the same warnings for every moc_*:>moc_stringmatchfilter.obj : warning LNK4006: “public: static struct QMetaObject co

  • alexandernst
    c++ sockets qt5
    I have a problem reading more than 2048 bytes from a QLocalSocket. This is my server-side code:clientConnection->flush(); //

Originally posted 2013-11-10 00:29:27.