Results 1 to 5 of 5

Thread: Qtreeview selection highlighted problem?

  1. #1
    Join Date
    Oct 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Lightbulb Qtreeview selection highlighted problem?

    hello, Now i write a program with qtreeview and subclassing qabstractItemModel ,it works
    and display properly .but when I selected a item in treeview , selection item doesn't highlighted? anyone know how to control to highlighted selection?
    I write flag function
    such as

    Qt::ItemFlags GDOSGrassModel::flags(const QModelIndex &index) const
    {
    if (!index.isValid())
    return Qt::ItemIsEnabled;

    return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
    }

  2. #2
    Join Date
    Oct 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Cool Re: Qtreeview selection highlighted problem?

    I foud that similar question :
    http://lists.trolltech.com/qt-intere...ad00451-0.html

    but I still do not know how to slove these problem?

  3. #3
    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: Qtreeview selection highlighted problem?

    Does it work if you change your flags() method to:
    Qt Code:
    1. Qt::ItemFlags GDOSGrassModel::flags(const QModelIndex &index) const
    2. {
    3. return QAbstractItemModel::flags( index );
    4. }
    To copy to clipboard, switch view to plain text mode 
    ?

  4. #4
    Join Date
    Oct 2006
    Posts
    3
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Qtreeview selection highlighted problem?

    thanks, I try it ,but it doesn't work still. Are there other setting can be done?

    Quote Originally Posted by jacek View Post
    Does it work if you change your flags() method to:
    Qt Code:
    1. Qt::ItemFlags GDOSGrassModel::flags(const QModelIndex &index) const
    2. {
    3. return QAbstractItemModel::flags( index );
    4. }
    To copy to clipboard, switch view to plain text mode 
    ?

  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: Qtreeview selection highlighted problem?

    Quote Originally Posted by thefisher View Post
    thanks, I try it ,but it doesn't work still. Are there other setting can be done?
    If it doesn't work, then the problem might be in some other place. Do you use a custom delegate? What is the value of view's selectionMode property?

Similar Threads

  1. QTreeView problem scrolling to end.
    By seneca in forum Qt Programming
    Replies: 7
    Last Post: 22nd December 2015, 12:08
  2. [SOLVED] QTreeView drawing selection with icons
    By Timewarp in forum Qt Programming
    Replies: 7
    Last Post: 7th February 2013, 07:52
  3. Problem with index in a QTreeView
    By hubert_p in forum Qt Programming
    Replies: 4
    Last Post: 22nd October 2006, 15:54
  4. Selection problem in QTreeView
    By Valheru in forum Qt Programming
    Replies: 3
    Last Post: 7th October 2006, 16:02
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

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.