Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QML module not found (VLCQt) in Qt_5_12_2_MSVC2015_64bit Windows 10 and VlcQmlVideoPlayer is deprecated #25

Open
inejose opened this issue Feb 16, 2022 · 1 comment

Comments

@inejose
Copy link

inejose commented Feb 16, 2022

Hi,

I am trying to integrate this VLCQt QML project but I am not able to recognize the library.

In the main.cpp I get the following warning on the "VlcQmlVideoPlayer::registerPlugin();":
VlcQmlVideoPlayer is deprecated

In the qml:
import VLCQt 1.1 //QML module not found (VLCQt)

Compiler and Qt:
Qt_5_12_2_MSVC2015_64bit

I downloaded VLC-Qt_1.1.0_win64_msvc2015 binaries and copied the content to my src/lib/vlcqt folder.

image

I also added to my \build-hmi-Desktop_Qt_5_12_2_MSVC2015_64bit-Debug\debug folder to be able to debug.

Please, has anyone managed to integrate the libraries without compiling the sources? I would be very grateful for an answer or a clear example, we have planned a project thinking about this utility and we have been several days without being able to advance, we do not have much experience integrating external libraries.

Thank you very much.

These are my source files:

hmi.pro

LIBS += -lVLCQtCore -lVLCQtQML
win32:CONFIG(release, debug|release): LIBS += -L$$PWD/lib/vlcqt/lib/ -lVLCQtCore -lVLCQtQML
else:win32:CONFIG(debug, debug|release): LIBS += -L$$PWD/lib/vlcqt/lib/ -lVLCQtCored -lVLCQtQML
INCLUDEPATH += $$PWD/lib/vlcqt/include
DEPENDPATH += $$PWD/lib/vlcqt/include

main.cpp

#include <VLCQtCore/Common.h>
#include <VLCQtQml/QmlVideoPlayer.h>

int main(int argc, char *argv[])
{
    QQmlDebuggingEnabler enabler;
    QGuiApplication app(argc, argv);

    VlcCommon::setPluginPath(app.applicationDirPath() + "/plugins");
    VlcQmlVideoPlayer::registerPlugin();

    return app.exec();
}

widget.qml

import QtQuick 2.0
import VLCQt 1.1  //Creator shows an error here: QML module not found (VLCQt)

Item {
    VlcVideoPlayer {
        id: vidwidget
        anchors.fill: parent
        url: "https://movietrailers.apple.com/movies/paramount/the-contractor/the-contractor-trailer-1_h720p.mov"
    }
}

image

@gaatorre
Copy link

Getting the same issues on Ubuntu 18.04. Build VLC-QT from source and installed to /usr/local/qml.

main.cpp

#include <QGuiApplication>
#include <QQmlApplicationEngine>

#include <VLCQtCore/Common.h>
#include <VLCQtQml/QmlPlayer.h>

int main(int argc, char *argv[])
{
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
#endif

    QGuiApplication app(argc, argv);

    QQmlApplicationEngine engine;
    const QUrl url(QStringLiteral("qrc:/main.qml"));
    QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                     &app, [url](QObject *obj, const QUrl &objUrl) {
        if (!obj && url == objUrl)
            QCoreApplication::exit(-1);
    }, Qt::QueuedConnection);
    engine.load(url);

    return app.exec();
}

main.qml

import QtQuick 2.15
import QtQuick.Window 2.15
import VLCQt 1.1

Window {
    width: 1000
    height: 480
    visible: true
    title: qsTr("Hello World")
}

CmakeLists.txt

cmake_minimum_required(VERSION 3.14)

project(flexGui VERSION 0.1 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

list(APPEND QML_DIRS "/usr/local/qml")
set(QML_IMPORT_PATH "${QML_DIRS}" CACHE STRING "Qt Creator 4.1 extra qml import paths" FORCE)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core Quick)
find_package(VLCQt REQUIRED COMPONENTS Qml)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Quick)

set(PROJECT_SOURCES
        main.cpp
        qml.qrc
)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
    qt_add_executable(flexGui
        MANUAL_FINALIZATION
        ${PROJECT_SOURCES}
    )
# Define target properties for Android with Qt 6 as:
#    set_property(TARGET flexGui APPEND PROPERTY QT_ANDROID_PACKAGE_SOURCE_DIR
#                 ${CMAKE_CURRENT_SOURCE_DIR}/android)
# For more information, see https://doc.qt.io/qt-6/qt-add-executable.html#target-creation
else()
    if(ANDROID)
        add_library(flexGui SHARED
            ${PROJECT_SOURCES}
        )
# Define properties for Android with Qt 5 after find_package() calls as:
#    set(ANDROID_PACKAGE_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/android")
    else()
        add_executable(flexGui
          ${PROJECT_SOURCES}
        )
    endif()
endif()

target_link_libraries(flexGui
  PRIVATE Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Quick VLCQt::Qml)

set_target_properties(flexGui PROPERTIES
    MACOSX_BUNDLE_GUI_IDENTIFIER my.example.com
    MACOSX_BUNDLE_BUNDLE_VERSION ${PROJECT_VERSION}
    MACOSX_BUNDLE_SHORT_VERSION_STRING ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}
    MACOSX_BUNDLE TRUE
    WIN32_EXECUTABLE TRUE
)

install(TARGETS flexGui
    BUNDLE DESTINATION .
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})

if(QT_VERSION_MAJOR EQUAL 6)
    qt_import_qml_plugins(flexGui)
    qt_finalize_executable(flexGui)
endif()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants