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

Labs and Controls conflict



  • I was trying to use Qt.labs.calendar and QtQuick.Controls together and ran into some conflicts since Calendar is declared in both imports. I then used a qualifier to remove ambiguity "import Qt.labs.calendar 1.0 as LC" but the control Calendar was still not initializing correctly and returning errors ("Type Calendar is unavailable" - "Cannot assign object to property").
    Should we avoid to mix the two controls libs?



  • Could you show the code?



  • Oh, I can see what you mean now. There was indeed an internal conflict in Qt 5.6 (https://bugreports.qt.io/browse/QTBUG-53552). It was reproducible with something as simple as:

    import QtQuick 2.6
    import QtQuick.Controls 1.2
    import Qt.labs.calendar 1.0 as LC
    
    ApplicationWindow {
        visible: true
        Calendar { }
    }
    

    ==>

    qrc:/main.qml:7 Type Calendar unavailable
    file:///Users/jpnurmi/Qt/5.6/clang_64/qml/QtQuick/Controls/Calendar.qml:216 Cannot assign object to property
    

    The conflict has been fixed in Qt 5.7.



  • @jpnurmi thanks for your followup.
    Another issue with the Controls calendar is that binding (from external variable to control) is lost whenever the user selects a date. I have found this confirmed in the bug reports. Wonder if it will also be fixed in v5.7.

    In the meantime i have implemented my own calendar, less generic than the lib one though.


Log in to reply