Results 1 to 7 of 7

Thread: QListWidget

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2009
    Posts
    52
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default QListWidget

    I have a QListWiget that uses a custom item delegate. The list is in wrap mode. The problem is with multiple selection with the mouse. If the drag is enabled, after pressing the mouse and start dragging instead of selecting multiple items the only item selected is being dragged. That's normal because when you click the cursor is on an item. However, the problem is that there is no space between the column so you can start the selection without pressing an item, like for example Windows Explorer.

    Is there any way of setting a space between the columns so that when you click you are not clicking on an item?

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

    Default Re: QListWidget

    You can set the spacing or the grid size of the view.
    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.


  3. #3
    Join Date
    May 2009
    Posts
    52
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QListWidget

    I've tried that, what spacing does is actually "padding", so there is more space, but it's not "space between columns", there is still no space where you can press without selecting something, like in Explorer...

    I haven't look at the code but I'm afraid that the wrapping thing doesn't leave space between columns, which really sucks, because you can't use only the mouse to do multiple selection when drag&drop is enabled

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

    Default Re: QListWidget

    No, you are wrong. Spacing is between items. Maybe it is your custom delegate that messes something up. I can easily select and drag many items in the cofiguration you described.

    Here is a sample ui file, open it in Designer, preview it and see for yourself.
    Attached Files Attached Files
    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.


  5. #5
    Join Date
    May 2009
    Posts
    52
    Thanks
    4
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: QListWidget

    Well, I've solved the mystery. You have in there this

    Qt Code:
    1. listWidget->setFlow(QListView::LeftToRight);
    To copy to clipboard, switch view to plain text mode 

    while I need TopToBottom.

    If you change to that, you'll see that there is no space between columns... There is instead between rows (when the flow is LeftToRight, the space is both between rows and columns).

    And another problem with spacing is that it's in all direction, while I'd like to have only the columns a little apart. This can be fixed using something like

    Qt Code:
    1. listWidget->setGridSize(QSize(100, 20));
    To copy to clipboard, switch view to plain text mode 

    but then again, there is no space between columns.

    And another thing, even in the LeftToRight flow, the selection is not correct, it will also selects items OUTSIDE the selection rectangle.

    This is pretty messed up...

    For now I can use gridSize and I can find some space between rows. Thank you

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

    Default Re: QListWidget

    Quote Originally Posted by Carlsberg View Post
    Well, I've solved the mystery. You have in there this

    Qt Code:
    1. listWidget->setFlow(QListView::LeftToRight);
    To copy to clipboard, switch view to plain text mode 

    while I need TopToBottom.

    If you change to that, you'll see that there is no space between columns... There is instead between rows (when the flow is LeftToRight, the space is both between rows and columns).
    So? What's wrong with that?

    but then again, there is no space between columns.
    Subclass and reimplement visualRect().
    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.


  7. #7
    Join Date
    Oct 2012
    Posts
    1
    Qt products
    Qt3
    Platforms
    MacOS X

    Default Re: QListWidget

    nice post/*-*-*-
    I am satisfied completely from the impressive working of the website of Pass4sure for the CAHSEE test. For more details about this product visit Avaya and also visit amazon ,best of luck.

Similar Threads

  1. Replies: 2
    Last Post: 1st April 2011, 09:32
  2. QListWidget
    By babygal in forum Newbie
    Replies: 6
    Last Post: 1st September 2010, 12:01
  3. QListWidget
    By bismitapadhy in forum Qt Programming
    Replies: 17
    Last Post: 22nd March 2010, 11:44
  4. QListWidget with STL
    By rajeshs in forum Qt Programming
    Replies: 1
    Last Post: 21st July 2007, 16:16
  5. QListWidget help please
    By munna in forum Qt Programming
    Replies: 5
    Last Post: 28th November 2006, 12:16

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
  •  
Qt is a trademark of The Qt Company.