Results 1 to 5 of 5

Thread: Navigate through qlistview items with shortcuts

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts

    Default Re: Navigate through qlistview items with shortcuts

    J-P Nurmi

  2. The following user says thank you to jpn for this useful post:

    jiveaxe (10th January 2008)

  3. #2
    Join Date
    Aug 2007
    Posts
    244
    Qt products
    Qt4
    Platforms
    Unix/X11
    Thanks
    42
    Thanked 8 Times in 8 Posts

    Default Re: Navigate through qlistview items with shortcuts

    Thanks jpn, sibling was what I need (I'm italian so sometimes i don't understand the use of a function from its name: I had no idea of what was simling; after you pointed me to it I have recovered a thesaurus to get the meaning of that word and discovered that it was the function I was searching for).

    Now the final code:

    Qt Code:
    1. void MainDialog::showPreviuosTitle()
    2. {
    3. QModelIndex mi = listView->currentIndex();
    4. if(mi.row() > 0) {
    5. listView->setCurrentIndex(mi.sibling(mi.row()-1,mi.column()));
    6. viewTitle(listView->currentIndex());
    7. }
    8. }
    9.  
    10. void MainDialog::showNextTitle()
    11. {
    12. QModelIndex mi = listView->currentIndex();
    13. if(mi.row() < listView->model()->rowCount() - 1) {
    14. listView->setCurrentIndex(mi.sibling(mi.row()+1,mi.column()));
    15. viewTitle(listView->currentIndex());
    16. }
    17. }
    To copy to clipboard, switch view to plain text mode 

    Thanks
    Giuseppe CalÃ

Similar Threads

  1. Items in QListView should sort on Header Click
    By vinnu in forum Qt Programming
    Replies: 14
    Last Post: 10th November 2006, 12:49
  2. moving Qlistview items
    By :db:sStrong in forum Qt Programming
    Replies: 0
    Last Post: 21st February 2006, 12:25

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.