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 Configuration Values
Forum Updated to NodeBB v4.3 + New Features

QML Configuration Values

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 636 Views
  • 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.
  • L Offline
    L Offline
    Lodhi.bhkr
    wrote on last edited by Lodhi.bhkr
    #1

    Hi my task is simple i need to get some values from confuguration file in qml application, I will give you a demo of my application as :

    //File.qml
    Rectangle
    {
    id:rectangle1
    width: default_width // Width of Rectangle 1
    height: default _height / Height of Rectangle 1
    }

    Rectangle
    {
    id:rectangle2
    width: default_width // Width of Rectangle 2
    height: default _height / Height of Rectangle 2
    }

    config.ini

    [Rectangle1]
    width=100
    height=100

    [Rectangle2]
    width=50
    height=50

    tell me how to configure my config file too. i know one solution to use config.ini in Qsetting but i dont want to use it using Qt c++ file , i want a direct solution which i can use to load values fron configuration file and set width and height of rectangle in qml application. and if width and height is updated then save updated values in configuration file.

    J.HilkJ 1 Reply Last reply
    0
    • L Lodhi.bhkr

      Hi my task is simple i need to get some values from confuguration file in qml application, I will give you a demo of my application as :

      //File.qml
      Rectangle
      {
      id:rectangle1
      width: default_width // Width of Rectangle 1
      height: default _height / Height of Rectangle 1
      }

      Rectangle
      {
      id:rectangle2
      width: default_width // Width of Rectangle 2
      height: default _height / Height of Rectangle 2
      }

      config.ini

      [Rectangle1]
      width=100
      height=100

      [Rectangle2]
      width=50
      height=50

      tell me how to configure my config file too. i know one solution to use config.ini in Qsetting but i dont want to use it using Qt c++ file , i want a direct solution which i can use to load values fron configuration file and set width and height of rectangle in qml application. and if width and height is updated then save updated values in configuration file.

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Lodhi-bhkr
      https://doc.qt.io/qt-5/qml-qt-labs-settings-settings.html


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      L 1 Reply Last reply
      3
      • J.HilkJ J.Hilk

        @Lodhi-bhkr
        https://doc.qt.io/qt-5/qml-qt-labs-settings-settings.html

        L Offline
        L Offline
        Lodhi.bhkr
        wrote on last edited by
        #3

        @J-Hilk :

        Thanks for your support, As i am new to qt can you please give me a few lines of code implement this i have seen this post but have some confusion to implement it.

        J.HilkJ 1 Reply Last reply
        0
        • L Lodhi.bhkr

          @J-Hilk :

          Thanks for your support, As i am new to qt can you please give me a few lines of code implement this i have seen this post but have some confusion to implement it.

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by
          #4

          @Lodhi-bhkr please read the documentation in the link I gave you, the very first section details has a working example on how to save the window state (x, y, width and height) and it loads the last state automatically during the next start of the program


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          L 1 Reply Last reply
          3
          • J.HilkJ J.Hilk

            @Lodhi-bhkr please read the documentation in the link I gave you, the very first section details has a working example on how to save the window state (x, y, width and height) and it loads the last state automatically during the next start of the program

            L Offline
            L Offline
            Lodhi.bhkr
            wrote on last edited by Lodhi.bhkr
            #5
            This post is deleted!
            1 Reply Last reply
            0

            • Login

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