Results 1 to 4 of 4

Thread: QTreeView/QHeaderView : resize handle on the left

  1. #1
    Join Date
    May 2009
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default QTreeView/QHeaderView : resize handle on the left

    Hi !

    Here is what I am trying to do: I have a QTreeView with two columns. The first one is the important one, the second one the not-so-important one. I'd like to have my first column automatically resized when the treeView is resized and the second one to be resizable by hand.
    Qt Code:
    1. items = new QTreeView();
    2. items->setModel(itemsModel);
    3. QHeaderView * header = items->header();
    4. header->setStretchLastSection(false);
    5. header->setResizeMode(0, QHeaderView::Stretch);
    6. header->setResizeMode(1, QHeaderView::Interactive);
    To copy to clipboard, switch view to plain text mode 

    The issue is that the zone I have to click on to resize a column is on the right. The QTreeView being on the right edge of the window, clicking on the column separator at the end of the last column becomes quite a challenge, and the movement is not intuitive (you have to move the cursor out of the window to the right to have the left side of the column move to the left). I'd like to be able to resize the last column by clicking on the separator present between the two columns.

    Is it possible to move the resize handle on the left side of the column ? Is there a better way to do that ?

    Thanks in advance

  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: QTreeView/QHeaderView : resize handle on the left

    I dont know if it might work, but you can try this -
    Get the status bar and change its layout direction

  3. #3
    Join Date
    May 2009
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11

    Default Re: QTreeView/QHeaderView : resize handle on the left

    Unfortunately, it just doesn't quite do the trick
    Even though the "resize zone" is moved on the left, the whole widget has its layout switched to Qt::RightToLeft. It induces very weird behaviors of the widgets.

    If anyone else has a better option, I'm more than willing to consider it, but it looks like I'll have to just forget about it :/

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: QTreeView/QHeaderView : resize handle on the left

    You can attach to the sectionResized() signal of QHeaderView and do the proper resizing yourself. You'll have to detach the header from resizing the view of course.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. resize and rotate handle
    By Noxxik in forum Qt Programming
    Replies: 5
    Last Post: 22nd February 2009, 14:03
  2. Replies: 1
    Last Post: 10th August 2008, 18:55
  3. Move and resize with layout
    By waediowa in forum Qt Programming
    Replies: 0
    Last Post: 14th May 2008, 08:16
  4. Replies: 2
    Last Post: 14th August 2007, 15:16
  5. postponing resize event
    By Honestmath in forum Qt Programming
    Replies: 11
    Last Post: 26th February 2006, 00:32

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.