Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. QML Settings errors
Forum Updated to NodeBB v4.3 + New Features

QML Settings errors

Scheduled Pinned Locked Moved Solved QML and Qt Quick
5 Posts 4 Posters 8.0k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • tomyT Offline
    tomyT Offline
    tomy
    wrote on last edited by tomy
    #1

    Hi all,
    I'm trying to do this example.

    The problems are:
    1- I get these two errors when running the app:

    file:///D:/Qt/5.12.3/mingw73_64/qml/QtQuick/Dialogs/DefaultFileDialog.qml:102:33: QML Settings: Failed to initialize QSettings instance. Status code is: 1

    file:///D:/Qt/5.12.3/mingw73_64/qml/QtQuick/Dialogs/DefaultFileDialog.qml:102:33: QML Settings: The following application identifiers have not been set: QVector("organizationName", "organizationDomain")

    2- Also, when I set QQuickStyle::setStyle("Fusion"); in main.cpp, an error says: 'QQuickStyle' has not been declared, and when I include that header file, another error says: 'QQuickStyle: No such file or directory #include <QQuickStyle>'.

    Why are there theses errors, please!?

    1 Reply Last reply
    0
    • IntruderExcluderI Offline
      IntruderExcluderI Offline
      IntruderExcluder
      wrote on last edited by IntruderExcluder
      #2

      To use QQuickStyles you should add QT += quickcontrols2 to your .pro file.
      For 1st error try to set proper app variables at main.cpp after app has been constructed:

      QGuiApplication app(argc, argv);
          
      app.setOrganizationName("somename");
      app.setOrganizationDomain("somename");
      ...
      
      tomyT 1 Reply Last reply
      4
      • IntruderExcluderI IntruderExcluder

        To use QQuickStyles you should add QT += quickcontrols2 to your .pro file.
        For 1st error try to set proper app variables at main.cpp after app has been constructed:

        QGuiApplication app(argc, argv);
            
        app.setOrganizationName("somename");
        app.setOrganizationDomain("somename");
        ...
        
        tomyT Offline
        tomyT Offline
        tomy
        wrote on last edited by tomy
        #3

        @IntruderExcluder

        Thank you.

        That was new for me. I had not used app.setOrganizationName/Domain ect. Why are they needed please?

        And now the problems are solved, no error and it works well. I only get this message in the Application Output, which is not an error, but rather curious why: Model size of -30 is less than 0

        Another question is: thus far I've used QtQuickControls in QML apps but never had to set the line QT += quickcontrols2 in the .pro file. why have I to in this project?

        F jsulmJ 2 Replies Last reply
        0
        • tomyT tomy

          @IntruderExcluder

          Thank you.

          That was new for me. I had not used app.setOrganizationName/Domain ect. Why are they needed please?

          And now the problems are solved, no error and it works well. I only get this message in the Application Output, which is not an error, but rather curious why: Model size of -30 is less than 0

          Another question is: thus far I've used QtQuickControls in QML apps but never had to set the line QT += quickcontrols2 in the .pro file. why have I to in this project?

          F Offline
          F Offline
          FKosmale
          wrote on last edited by
          #4

          @tomy said in QML Settings errors:

          That was new for me. I had not used app.setOrganizationName/Domain ect. Why are they needed please?

          It is used to configure where QSettings where it should persist its data: (see the "Basic usage" section in https://doc.qt.io/qt-5/qsettings.html#details).

          Another question is: thus far I've used QtQuickControls in QML apps but never had to set the line QT += quickcontrols2 in the .pro file

          You probbaly never accessed any QQC2 functionality from the C++ side before, did you? If you only use it at run time (by using it in your QML files) it should work as long as the necessary files are actually installed.

          1 Reply Last reply
          2
          • tomyT tomy

            @IntruderExcluder

            Thank you.

            That was new for me. I had not used app.setOrganizationName/Domain ect. Why are they needed please?

            And now the problems are solved, no error and it works well. I only get this message in the Application Output, which is not an error, but rather curious why: Model size of -30 is less than 0

            Another question is: thus far I've used QtQuickControls in QML apps but never had to set the line QT += quickcontrols2 in the .pro file. why have I to in this project?

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #5

            @tomy said in QML Settings errors:

            Another question is: thus far I've used QtQuickControls in QML apps but never had to set the line QT += quickcontrols2 in the .pro file. why have I to in this project?

            You can easily find the answer in the documentation (https://doc.qt.io/qt-5/qquickstyle.html):

            Header:	#include <QQuickStyle>
            qmake:	QT += quickcontrols2
            

            QQuickStyle is C++ and for that you need QT += ...

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            2

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved