Results 1 to 6 of 6

Thread: [QT3] QListView

  1. #1
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Thumbs up [QT3] QListView (C++ with XP)

    Hello,

    In QListViews one can define columns, say from left to right A, B and C; and of course lines say from top to bottom 1, 2, 3...

    I try to modify (for instance) the content of cell B2.

    For the time being, I could not invent better than to click with the mouse (left) on line 2. This puts A2 as selected. I then loop through the list to find which line has been selected.

    Then I programmed function key F1 to edit A2, F2 to edit B2, F3 to edit C2 etc...

    But I really would like to click on any cell and program a slot to handle it.

    Is there a better way that I could investigate ?
    Last edited by incapacitant; 29th January 2006 at 16:10. Reason: add language and os

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [QT3] QListView

    You mean something like QListView::clicked( QListViewItem *, const QPoint&, int) signal?

  3. #3
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [QT3] QListView

    Yes this should work. I am going to try. Thank you.

  4. #4
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [QT3] QListView

    I have some trouble writing the SIGNAL for above.

    connect( articles, SIGNAL( clicked( QListViewItem* ), const QPoint & pnt, int col ),
    this, SLOT( itemSelected( QListViewItem* ) ) );
    This says SIGNAL takes only one parameter, while here being passed 3.

    connect( articles, SIGNAL( clicked( QListViewItem* ) ),
    this, SLOT( itemSelected( QListViewItem* ), const QPoint & pnt, int col ) );
    This says SLOT takes only one parameter, while here being passed 3.

    How should the connect be coded ?

  5. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    5,372
    Thanks
    28
    Thanked 976 Times in 912 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [QT3] QListView

    No parameter names are allowed in SIGNAL and SLOT macros, so it should be:
    Qt Code:
    1. connect( articles, SIGNAL( clicked( QListViewItem *, const QPoint&, int ) ), this, SLOT( itemSelected( QListViewItem * ) ) );
    To copy to clipboard, switch view to plain text mode 
    If you don't need the third parameter (i.e. column), you can use different signal:
    Qt Code:
    1. connect( articles, SIGNAL( clicked( QListViewItem * ) ), this, SLOT( itemSelected( QListViewItem * ) ) );
    To copy to clipboard, switch view to plain text mode 

  6. The following user says thank you to jacek for this useful post:

    incapacitant (2nd March 2006)

  7. #6
    Join Date
    Jan 2006
    Location
    Grenoble, France
    Posts
    165
    Thanks
    106
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: [QT3] QListView


    In the end I used rightButtonClicked with the same syntax as you said, and it WORKS !

    Thank you very much for your help.

Similar Threads

  1. [QT3] Implement "Freeze Panes" features in QListView
    By Syphius in forum Qt Programming
    Replies: 7
    Last Post: 5th January 2009, 21:25
  2. how to move item up and down in QListView
    By zhanglr in forum Qt Programming
    Replies: 3
    Last Post: 1st August 2008, 14:39
  3. QListView word wrap
    By serega in forum Qt Programming
    Replies: 17
    Last Post: 30th August 2007, 03:13
  4. Subclass QListView to show two colums in one
    By Mookie in forum Qt Programming
    Replies: 2
    Last Post: 23rd June 2007, 02:12
  5. [QT3] QListView and Key_Delete - doesn't work?
    By InZone in forum Qt Programming
    Replies: 2
    Last Post: 26th January 2006, 14:49

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.