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 fix the treeview on left hand side of main window.
Forum Updated to NodeBB v4.3 + New Features

How to fix the treeview on left hand side of main window.

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 5.6k 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.
  • I Offline
    I Offline
    Indrajeet
    wrote on last edited by
    #1

    Hi All

    I have created a mainwindow.
    In this main window i want to fit treeview so i created my own custom treeview.
    Now by using QDockWidget i fitted that treeview on left side of mainwindow.

    @
    QDockWidget *dock = new QDockWidget(tr(""), this);
    view = new QTreeView(dock);
    dock->setWidget(view);
    addDockWidget(Qt::LeftDockWidgetArea, dock);@

    Above code is working fine but when i maximise my mainwindow treeview is covering the complete central space of mainwindow.

    I want treeview to remain same on left hand side.
    How to fix this?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      Blizzard
      wrote on last edited by
      #2

      bq. Each widget returns a QSizePolicy that describes the horizontal and vertical resizing policy it prefers when being laid out. You can change this for a specific widget by changing its "QWidget::sizePolicy":http://qt-project.org/doc/qt-4.8/qwidget.html#sizePolicy-prop property. QSizePolicy contains two independent "QSizePolicy::Policy":http://qt-project.org/doc/qt-4.8/qsizepolicy.html#Policy-enum values and two stretch factors; one describes the widgets's horizontal size policy, and the other describes its vertical size policy. It also contains a flag to indicate whether the height and width of its preferred size are related.

      "source":http://qt-project.org/doc/qt-4.8/QSizePolicy.html

      Software Engineer | Aerospace & Defence

      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