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. Possible bug in QSplitter: sizes set can't be read back
Forum Update on Monday, May 27th 2025

Possible bug in QSplitter: sizes set can't be read back

Scheduled Pinned Locked Moved Unsolved General and Desktop
qsplitterbugproblem
3 Posts 3 Posters 433 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.
  • A Offline
    A Offline
    afalco
    wrote on 3 Aug 2021, 15:56 last edited by
    #1

    I created a tabbed desktop app with QDesigner. On one of the tabs I have a horizontal QSplitter. When the application starts it reads many saved parameters including the splitter sizes, when I exit the app it saves them again. But the sizes I get back from QSplitter::sizes() are not the one I set, unless I visit the tab.
    This code sets and displays the splitter sizes on read

    	ui.designSplitter->setSizes({ config.splitterLeft, config.splitterRight } );
    // DEBUG
    	qDebug("Splitter sizes: %d %d", ui.designSplitter->sizes().at(0), ui.designSplitter->sizes().at(1));
    

    The values read in are for instance 439 and 593, but the sizes I got back is always 47 for both.
    This seems to be a bug as I would expect to get back the values set in the QSplitter.
    I understand that Qt does not really resize the splitter and the widgets on it unless it is visible, but it could still be the case if I get the values I set back.

    Am I missing something, or is this a bug?

    J 1 Reply Last reply 3 Aug 2021, 17:44
    0
    • C Offline
      C Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on 3 Aug 2021, 16:32 last edited by
      #2

      Please provide a minimal, compilable example when you think it's a bug.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      0
      • A afalco
        3 Aug 2021, 15:56

        I created a tabbed desktop app with QDesigner. On one of the tabs I have a horizontal QSplitter. When the application starts it reads many saved parameters including the splitter sizes, when I exit the app it saves them again. But the sizes I get back from QSplitter::sizes() are not the one I set, unless I visit the tab.
        This code sets and displays the splitter sizes on read

        	ui.designSplitter->setSizes({ config.splitterLeft, config.splitterRight } );
        // DEBUG
        	qDebug("Splitter sizes: %d %d", ui.designSplitter->sizes().at(0), ui.designSplitter->sizes().at(1));
        

        The values read in are for instance 439 and 593, but the sizes I got back is always 47 for both.
        This seems to be a bug as I would expect to get back the values set in the QSplitter.
        I understand that Qt does not really resize the splitter and the widgets on it unless it is visible, but it could still be the case if I get the values I set back.

        Am I missing something, or is this a bug?

        J Offline
        J Offline
        JonB
        wrote on 3 Aug 2021, 17:44 last edited by
        #3

        @afalco said in Possible bug in QSplitter: sizes set can't be read back:

        But the sizes I get back from QSplitter::sizes() are not the one I set, unless I visit the tab.

        Qt sizes are only reported correctly once a widget is shown.

        1 Reply Last reply
        1

        1/3

        3 Aug 2021, 15:56

        • Login

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