Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

No QWebEngineCallback Qt5.6.3 Ubuntu16.04



  • Hi all,
    in a code, the below two lines give cmake errors:

    #include <QtWebEngineWidgets\QWebEngineView>
    #include <QtWebEngineCore\QWebEngineCallback>

    How can I solve it as the Core and Widgets don't include the View and Callback?
    Thanks in advance,
    Patrick


  • Lifetime Qt Champion

    Hi,

    Maybe a silly question but did you add QT += webenginewidgets to your .pro file ?



  • @SGaist actually the code can be run with visual. Now in linux, I had passed enginewideget's address to the flag Qt5WebEngineWidgets_DIR. I guess the problem has something to namespace.


  • Lifetime Qt Champion

    How are you handling Qt's packages with cmake ?



  • @SGaist run it with ccmake and then the code asks for Qt libraries and I pass the addresses. To solve the problem, I guess somewhere I should add namespace or something like that.


  • Lifetime Qt Champion

    Did you took a look at Qt's CMake manual ?



  • Hi...
    Cmake make a super job...
    this tool find all crumbs....
    last night i try to build QTAV video sdk module to qt5 https://github.com/wang-bin/QtAV
    on qmake only error... to find libs..
    on cmake after 10 min all was build & example to...

    # WebEngine support
    	IF(USE_QTWEBENGINE)
    		FIND_PACKAGE(Qt5 ${QT_MIN_VERSION} QUIET COMPONENTS WebEngine WebEngineWidgets WebChannel)
    
    		SET(BALL_HAS_QTWEBENGINE TRUE)
    		IF(NOT Qt5WebEngine_FOUND)
    			MESSAGE(STATUS "QtWebEngine has not been found. Disabling WebEngine support.")
    			SET(BALL_HAS_QTWEBENGINE FALSE)
    		ENDIF()
    
    		IF(NOT Qt5WebEngineWidgets_FOUND)
    			MESSAGE(STATUS "QtWebEngineWidgets has not been found. Disabling WebEngine support.")
    			SET(BALL_HAS_QTWEBENGINE FALSE)
    		ENDIF()
    
    		IF(NOT Qt5WebChannel_FOUND)
    			MESSAGE(STATUS "QtWebChannel has not been found. Disabling WebEngine support.")
    			SET(BALL_HAS_QTWEBENGINE FALSE)
    		ENDIF()
    
    		IF(BALL_HAS_QTWEBENGINE)
    			LIST(APPEND VIEW_DEP_LIBRARIES Qt5::WebEngineWidgets Qt5::WebChannel)
    		ENDIF()
    	ENDIF()
    

    https://blog.kitware.com/cmake-finding-qt5-the-right-way/



  • @SGaist with the same version of the software, cmake and Qt every thing is run well. Only when a new feature that requires

    #include <QtWebEngineWidgets\QWebEngineView>
    #include <QtWebEngineCore\QWebEngineCallback>

    in its header is added to the code, cmake gives an error as:

    ....cxx:14:45: fatal error: QtWebEngineWidgets\QWebEngineView: No such file or directory
    #include <QtWebEngineWidgets\QWebEngineView>



  • @patrik08 thank you for the sample code and the link. But I don't know which part of the code should change to the new style, find_package(Qt5 COMPONENTS ... ... REQUIRED). Currently it finds the required libraries automatically and asks for them which I address one by one. For example, the cmake flags after configuration, look like

    Qt5Charts_DIR .../Qt56/5.9.1/gcc_64/lib/cmake/Qt5Charts
    Qt5Core_DIR .../Qt56/5.6.3/gcc_64/lib/cmake/Qt5Core


  • Lifetime Qt Champion

    @PatrickK Did you try

    #include <QWebEngineView>
    

    ?



  • @jsulm after separation of the two sentences in the header, i.e.,

    #include <QtWebEngineWidgets\QWebEngineView>
    #include <QtWebEngineCore\QWebEngineCallback>

    into four sentences such as

    #include <QWebEngineCallback>

    then it does not complain any more that some files do not exist but it gives many errors like

    /home/v/software/itk482v2/source/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_numeric_traits.h:387:60: error: ‘constexpr’ needed for in-class initialization of static data member ‘const float vnl_numeric_traits<float>::zero’ of non-integral type [-fpermissive]
    static const float zero VCL_STATIC_CONST_INIT_FLOAT_DECL(0.0F);



  • I also tried Qt5.7 instead of 5.9. This time the headers, i.e,

    #include <QtWebEngineWidgets\QWebEngineView>
    #include <QtWebEngineCore\QWebEngineCallback>

    had no problem (and perhaps I should change the title to solved); however, it gives many errors like the below one:

    /home/v/software/itk482v2/source/Modules/ThirdParty/VNL/src/vxl/core/vnl/vnl_numeric_traits.h:387:60: error: ‘constexpr’ needed for in-class initialization of static data member ‘const float vnl_numeric_traits<float>::zero’ of non-integral type [-fpermissive]
    static const float zero VCL_STATIC_CONST_INIT_FLOAT_DECL(0.0F);

    The original code is run well but when a new cxx containing these two headers are added, it gives this problem and only in my system, Ubuntu 16.04 not in the Visual Studio.


  • Lifetime Qt Champion

    @PatrickK Try to add

    CONFIG += c++11
    

    to your pro file, run qmake and then rebuild.



  • @jsulm thank you. How can I write it in a cmakelists.txt or ctestconfig.cmake file? The code doesn't have a .pro file.


  • Lifetime Qt Champion



  • @jsulm thank you for the link. I added that term and didn't solve the problem. I also tried with two further below terms:

    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    set(CMAKE_CXX_EXTENSIONS OFF)

    but still cmake gives that error. The software is itk-snap and it works fine with Qt5.7 and msvc 2015 but in linux still I cannot compile it with Qt 5.7 and higher versions.


  • Lifetime Qt Champion

    @PatrickK I actually mean this

    set (CMAKE_CXX_STANDARD 11)
    


  • @jsulm right. First I added only this term (set (CMAKE_CXX_STANDARD 11)) that didn't solve the problem. Then I added each of
    set(CMAKE_CXX_STANDARD_REQUIRED ON)
    set(CMAKE_CXX_EXTENSIONS OFF)
    one by one to the code and once together, but still it cannot be compiled and gives the same error message.


Log in to reply