Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. get and set splitter position
Forum Updated to NodeBB v4.3 + New Features

get and set splitter position

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 3 Posters 2.6k Views 2 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.
  • S Offline
    S Offline
    saber
    wrote on last edited by
    #1

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

    1 Reply Last reply
    0
    • Chris KawaC Online
      Chris KawaC Online
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

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

      S 2 Replies Last reply
      2
      • Chris KawaC Chris Kawa

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

        S Offline
        S Offline
        saber
        wrote on last edited by saber
        #3

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

        i want to set the position .
        0_1533976991331_aq.png

        mrjjM 1 Reply Last reply
        0
        • S saber

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

          i want to set the position .
          0_1533976991331_aq.png

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

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

          1 Reply Last reply
          1
          • Chris KawaC Chris Kawa

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

            S Offline
            S Offline
            saber
            wrote on last edited by saber
            #5

            @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?

            mrjjM 1 Reply Last reply
            0
            • S 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?

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by mrjj
              #6

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

              S 1 Reply Last reply
              2
              • mrjjM mrjj

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

                S Offline
                S Offline
                saber
                wrote on last edited by
                #7

                @mrjj
                sorry no idea.

                mrjjM 1 Reply Last reply
                0
                • S saber

                  @mrjj
                  sorry no idea.

                  mrjjM Offline
                  mrjjM Offline
                  mrjj
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @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
                  2

                  • Login

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