KDAB / KDDockWidgets

KDAB's Dock Widget Framework for Qt
https://www.kdab.com/development-resources/qt-tools/kddockwidgets
Other
754 stars 163 forks source link

Problem with running qtquick example: (Please call KDDockWidgets::initPlatform()). #462

Closed capNmo closed 6 months ago

capNmo commented 7 months ago

Im trying to include KDDockWidgets in a new sample project. im using qtquick.


This is my project structure: root ├── CMakeLists.txt(1) └── deps -----└── bin -----└── include -----└── lib └── SimpleProject ------└── CMakeLists.txt(2) ------└── main.cpp ------└── qml.qrc ------└── main.qml and other qml files in full example


deps folder contains KDDockWidgets build results (installation dir of it)


CMakeLists.txt (1): (contains project and deps)

cmake_minimum_required(VERSION 3.15)
project(SimpleProject VERSION 0.2 LANGUAGES CXX)
set(deps "${CMAKE_CURRENT_SOURCE_DIR}/deps")
list(APPEND CMAKE_PREFIX_PATH ${deps})
list(APPEND CMAKE_MODULE_PATH ${deps}/lib/cmake)
add_subdirectory(SimpleProject)

CMakeLists.txt (2): (contains project)

find_package(Qt5 COMPONENTS Core Quick Charts REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC TRUE)
set(CMAKE_AUTORCC TRUE)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(EXECUTABLE_NAME SimpleProject)

find_package(KDDockWidgets REQUIRED)

add_executable(${EXECUTABLE_NAME})
target_sources(${EXECUTABLE_NAME} PRIVATE
        main.cpp
        qml.qrc)
target_link_libraries(${EXECUTABLE_NAME} PRIVATE
        KDAB::kddockwidgets)

main.cpp and main.qml are copied from Git example


When trying to build this error appears:

__cdecl KDDockWidgets::QtCommon::Platform_qt::GlobalEventFilter::GlobalEventFilter(class KDDockWidgets::QtCommon::Platform_qt *) Expected a qGuiApp!
Please call KDDockWidgets::initPlatform() after QGuiApplication
QObject::connect(QGuiApplication, Unknown): invalid nullptr parameter
QCommandLineParser: call process() or parse() before isSet
QCommandLineParser: call process() or parse() before isSet
QCommandLineParser: call process() or parse() before isSet
QCommandLineParser: call process() or parse() before isSet
QCommandLineParser: call process() or parse() before isSet
QCommandLineParser: call process() or parse() before isSet
iamsergio commented 7 months ago

Does the git example itself work, if you build it directly from within examples/ ?

capNmo commented 7 months ago

yes build was successful while building from github sources:

image

but now i need to run it from another simple project that use find_package(KDDockWidgets REQUIRED)

iamsergio commented 6 months ago

Are you sure you kept the KDDockWidgets::initFrontend call ?

I don't know how this could happen. If you upload a sample project that reproduces the problem I'll be happy to fix it there.