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 add a QWidget to a QDockWidget so that my widget has a decent width
Forum Updated to NodeBB v4.3 + New Features

How to add a QWidget to a QDockWidget so that my widget has a decent width

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 420 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.
  • K Offline
    K Offline
    kitfox
    wrote on last edited by
    #1

    I've created a component in the UI designer and I'm adding it in a QDockWidget on the right side of my main window. Unfortunately, the docked widget is initially being displayed so that it is only about 70 pixels wide. This is fairly narrow, and while I would like users to be able to squeeze it like this if they wish (there is no min width), for an initial display this is fairly narrow. Is there any way to give my UI component a preferred width that the QDockWidget will use?

    1 Reply Last reply
    0
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      It seems dock will use SizeHint from a Widget however, i had to subclass to override it.
      I was wondering if you could use
      http://doc.qt.io/qt-5/qmainwindow.html#resizeDocks
      to set a good size as this allows user to make it smaller if wanted.
      (unlike minimum size)

      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