Results 1 to 4 of 4

Thread: Make QTreeView cover the whole screen

  1. #1
    Join Date
    Dec 2009
    Posts
    62
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Make QTreeView cover the whole screen

    Hi

    I have a very simple layout. It is a QStackedWidget and inside this widget I display a QTreeView and below that a button, like this (the editor messes with the | on the right side so I removed them).

    -------------------------
    |
    |
    | QTreeView
    |
    |
    |-----------------------|
    | button
    -------------------------

    The problem is that there is a "margin" around the QTreeView i.e it does not go all the way out to the left, right and top, so it looks more like this:

    -------------------------
    ||-----------------------
    ||
    || QTreeView
    ||-----------------------
    |
    |-----------------------|
    | button
    -------------------------

    I just want the QTreeView to cover as much has possible of the screen. I have tried the CSS properties margin, border-width and padding but it did not make any difference, so I wonder:

    How can I make the QTreeView go all the way out to the borders to maximize the screen utilization?

    Thanks

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Make QTreeView cover the whole screen

    Are tree view and button in same widget of the current widget in QStackWidget ?
    Try to set margins of the layout that treeview and button are in.

  3. #3
    Join Date
    Dec 2009
    Posts
    62
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Make QTreeView cover the whole screen

    No, the StackedWidget is ontop of the buttons and they are put there with a QVboxLayout like this:

    QVBoxLayout* vLayout = new QVBoxLayout(centralWidget);

    vLayout->addWidget(stackedWidget); //This widget contains the QTreeView
    vLayout->addLayout(button);

    I have tried with the stylesheets and now also with setContentsMargin(0,0,0,0) both on the QTreeView and the StackedWidget which contains it but it has not changed anything.

  4. #4
    Join Date
    Dec 2009
    Posts
    62
    Thanks
    6
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Make QTreeView cover the whole screen

    Aha, it was the margins of the layout that was the problem. setMargin(0) on the layout solved the problem.

Similar Threads

  1. How to make my application screen-border stick
    By Fenix Voltres in forum Qt Programming
    Replies: 5
    Last Post: 28th February 2010, 13:35
  2. Replies: 2
    Last Post: 10th December 2009, 07:01
  3. Replies: 1
    Last Post: 27th March 2008, 15:10
  4. QTreeView: Holding a line on screen
    By gri in forum Qt Programming
    Replies: 1
    Last Post: 7th August 2007, 11:42
  5. how to make the form full screen
    By shrikarcse in forum Qt Tools
    Replies: 1
    Last Post: 24th April 2006, 15:30

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.