[vlc-commits] [Git][videolan/vlc][master] 2 commits: qt: restore type registration of MLItemId and DialogId with qRegisterMetaType
Hugo Beauzée-Luyssen (@chouquette)
gitlab at videolan.org
Thu Jan 27 14:55:46 UTC 2022
Hugo Beauzée-Luyssen pushed to branch master at VideoLAN / VLC
Commits:
c2f0719e by Pierre Lamot at 2022-01-27T13:45:15+00:00
qt: restore type registration of MLItemId and DialogId with qRegisterMetaType
Types are used in connections, they must be registered with both Q_DECLARE_METATYPE
and qRegisterMetaType as stated in the documentation.
> To use the type T in QVariant, using Q_DECLARE_METATYPE() is sufficient.
> To use the type T in queued signal and slot connections,
> qRegisterMetaType<T>() must be called before the first connection
> is established.
- - - - -
39e74833 by Pierre Lamot at 2022-01-27T13:45:15+00:00
qml: prefer "var" type for DialogId
Using the explicit type make the variable be assigned by pointer, but
it is assigned by value which gives the error
> Error: Cannot assign DialogId to DialogId*
- - - - -
2 changed files:
- modules/gui/qt/dialogs/dialogs/qml/Dialogs.qml
- modules/gui/qt/maininterface/mainui.cpp
Changes:
=====================================
modules/gui/qt/dialogs/dialogs/qml/Dialogs.qml
=====================================
@@ -189,7 +189,9 @@ Item {
ModalDialog {
id: loginDialog
- property DialogId dialogId: null
+
+ //use var here as DialogId is a QGadget and passed by value
+ property var dialogId: null
property string defaultUsername: ""
onAboutToHide: restoreFocus()
@@ -318,7 +320,8 @@ Item {
ModalDialog {
id: questionDialog
- property DialogId dialogId: null
+ //use var here as DialogId is a QGadget and passed by value
+ property var dialogId: null
property alias text: content.text
property alias cancelTxt: cancel.text
property alias action1Txt: action1.text
=====================================
modules/gui/qt/maininterface/mainui.cpp
=====================================
@@ -245,6 +245,7 @@ void MainUI::registerQMLTypes()
qmlRegisterType<AboutModel>( uri, versionMajor, versionMinor, "AboutModel" );
qmlRegisterUncreatableType<DialogErrorModel>( uri, versionMajor, versionMinor, "DialogErrorModel", "");
+ qRegisterMetaType<DialogId>();
qmlRegisterUncreatableType<DialogId>( uri, versionMajor, versionMinor, "DialogId", "");
qmlRegisterType<ItemKeyEventFilter>( uri, versionMajor, versionMinor, "KeyEventFilter" );
@@ -290,6 +291,7 @@ void MainUI::registerQMLTypes()
qmlRegisterSingletonType<MediaLib>(uri, versionMajor, versionMinor, "MediaLib", SingletonRegisterHelper<MediaLib>::callback);
+ qRegisterMetaType<MLItemId>();
qmlRegisterUncreatableType<MLItemId>( uri, versionMajor, versionMinor, "MLItemId", "");
qmlRegisterUncreatableType<MLBaseModel>( uri, versionMajor, versionMinor, "MLModel", "ML Base Model is uncreatable." );
qmlRegisterType<MLAlbumModel>( uri, versionMajor, versionMinor, "MLAlbumModel" );
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4dba94ce8f306d8ded9d4a70838d6487c31af7b4...39e74833b4b06a831f22cfbffc273ebefcdba8c2
--
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/4dba94ce8f306d8ded9d4a70838d6487c31af7b4...39e74833b4b06a831f22cfbffc273ebefcdba8c2
You're receiving this email because of your account on code.videolan.org.
More information about the vlc-commits
mailing list