Details
-
Bug
-
Resolution: Out of scope
-
P3: Somewhat important
-
None
-
5.9.2, 5.9.3, 5.12.12
-
None
-
Kubuntu 17.04 and Kubuntu 17.10 with Qt 5.9.2 and 5.9.3
64 Bit Arch with Qt 5.12.12
Description
Creation of Audio QML-Component from C++ fails
Due to the non-visual nature of audio, I was uncertain if this is a bug. But why should it be impossible to create and insert an Audio-Component from C++ to QML? So in my opinion, this feels more like a bug.
Example Code:
#include <QCoreApplication> #include <QQmlEngine> #include <QQuickItem> #include <QDebug> int main(int argc, char *argv[]) { QCoreApplication app(argc, argv); QQmlEngine engine; QQmlComponent video_component(&engine); QString str1("import QtQuick 2.7\n \ import QtMultimedia 5.7\n \ Video { \ id: test_video; \ anchors.fill: parent; \ autoPlay: true; \ }\n" ); video_component.setData(str1.toUtf8(), QUrl()); QScopedPointer<QQuickItem> video_item; video_item.reset(qobject_cast<QQuickItem *>(video_component.create())); if (!video_item.isNull()) qInfo() << "Video item created"; QString str2("import QtQuick 2.7\n \ import QtMultimedia 5.7\n \ Audio { \ id: test_video; \ anchors.fill: parent; \ autoPlay: true; \ }\n" ); QQmlComponent audio_component(&engine); audio_component.setData(str2.toUtf8(), QUrl()); QScopedPointer<QQuickItem> audio_item; audio_item.reset(qobject_cast<QQuickItem *>(audio_component.create())); if (audio_item.isNull()) qCritical() << "suprise surprise! Audio item is not created"; return 0; }