Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct

    Solved get and set splitter position

    General and Desktop
    3
    8
    1664
    Loading More Posts
    • 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.
    • S
      saber last edited by

      i have two widget with horizontal splitter.
      how can i get the splitter position and set that position .

      1 Reply Last reply Reply Quote 0
      • Chris Kawa
        Chris Kawa Moderators last edited by

        Use sizes() to get it and setSizes() to set it.

        S 2 Replies Last reply Reply Quote 2
        • S
          saber @Chris Kawa last edited by saber

          @Chris-Kawa
          it only giveing the size of the splitter .

          i want to set the position .
          0_1533976991331_aq.png

          mrjj 1 Reply Last reply Reply Quote 0
          • mrjj
            mrjj Lifetime Qt Champion @saber last edited by

            @saber
            Hi
            You set position by changing size(s).
            as @Chris-Kawa says

            1 Reply Last reply Reply Quote 1
            • S
              saber @Chris Kawa last edited by saber

              @Chris-Kawa
              sorry for my ignorance .
              i understand now.but what is the vreable to save that by qsettings?
              uasilly i save and get my settings by this way.

              QSize SettingsManage::setSplitterPos(QSize mode) {
                  return setSpecificValue("CoreFM", "Splitter-Pos", mode);
              }
              
              QSize SettingsManage::getSplitterPos() {
                  return getSpecificValue("CoreFM", "Splitter-Pos").toSize();
              }
              

              is that be qlist?

              mrjj 1 Reply Last reply Reply Quote 0
              • mrjj
                mrjj Lifetime Qt Champion @saber last edited by mrjj

                @saber
                Hi
                It has a saveState/restoreState that will handle it for you. (save/load to qsettings)

                S 1 Reply Last reply Reply Quote 2
                • S
                  saber @mrjj last edited by

                  @mrjj
                  sorry no idea.

                  mrjj 1 Reply Last reply Reply Quote 0
                  • mrjj
                    mrjj Lifetime Qt Champion @saber last edited by

                    @saber
                    About ?
                    http://doc.qt.io/qt-5/qsplitter.html#restoreState

                    it just allow you to store or load the layout of the splitter

                    1 Reply Last reply Reply Quote 2
                    • First post
                      Last post