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. How to adjust size of treewidget??

How to adjust size of treewidget??

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 703 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.
  • QT-static-prgmQ Offline
    QT-static-prgmQ Offline
    QT-static-prgm
    wrote on last edited by
    #1

    Hi,

    i have a problem with my treewidget. I want it to adjust the size to fit the content. But the window is always too long (y-direction) and too thin (x-direction) if i manual resize it without calling adjustsize it works fine but using adjust size destroys it again.

    How it looks with resize:
    Resize

    How it should look like:
    correct

    It should not resize the text size and display the whole name.

    Any ideas why this happens?? furthermore i want to resize it with the mouse. But adding a QSizeGrip to the widget displays the sizegrip at the upper right corner and adding it to the tree it's displayed at the same position and both ways only the widget is resized and not the tree. I already tried to make the widget to resize the child in the resizeEvent function, but nothing works. Maybe you have a solution for that, too

    Code: https://git.rwth-aachen.de/carstenf/qtTsOverlay/blob/master/ChannelListWidget.cpp

    A 1 Reply Last reply
    0
    • QT-static-prgmQ QT-static-prgm

      Hi,

      i have a problem with my treewidget. I want it to adjust the size to fit the content. But the window is always too long (y-direction) and too thin (x-direction) if i manual resize it without calling adjustsize it works fine but using adjust size destroys it again.

      How it looks with resize:
      Resize

      How it should look like:
      correct

      It should not resize the text size and display the whole name.

      Any ideas why this happens?? furthermore i want to resize it with the mouse. But adding a QSizeGrip to the widget displays the sizegrip at the upper right corner and adding it to the tree it's displayed at the same position and both ways only the widget is resized and not the tree. I already tried to make the widget to resize the child in the resizeEvent function, but nothing works. Maybe you have a solution for that, too

      Code: https://git.rwth-aachen.de/carstenf/qtTsOverlay/blob/master/ChannelListWidget.cpp

      A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      @QT-static-prgm I think if you want to force it to be the size to show the entire child item you will need to use a QFontMetric to figure out the actual size of the item then resize your tree to fit the child item.

      You can also try setting the sizeHint and then using adjustSize.

      If there is space on the screen but it isn't filling the space properly then that is a layout issue. I can't tell from the code since I don't see where you use it and therefore can't see the layout code.

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

      1 Reply Last reply
      1

      • Login

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