[Qt-interest] Tree Item High Lighter
Scott Aron Bloom
Scott.Bloom at onshorecs.com
Mon Dec 27 09:11:12 CET 2010
-----Original Message-----
From: qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com
[mailto:qt-interest-bounces+scott.bloom=onshorecs.com at qt.nokia.com] On
Behalf Of Eckhard Jokisch
Sent: Sunday, December 26, 2010 7:53 PM
To: qt-interest at qt.nokia.com
Subject: Re: [Qt-interest] Tree Item High Lighter
Am 27.12.2010 00:54, schrieb Sajjad:
> Hello forum,
>
> I have subclassed the QAbstractItemModel to generate a customized tree
model
> and since the tree model represent a large database, it is hard for
the user
> to browse down all the items in the tree and find a particular
item. For
> a better usability, i would like to have a textfield where the user
type a
> item name and the item with the name matched will be highlighted in
the
> tree.
>
> Any hint on implementing this feature. I think i need to work with
regular
> expression here and i am not sure how to search down the tree and
highlight
> it.
What about this:
while setting up the model data also fill a QHash<QString,QModelIndex>.
Like this you can simply search for the string in the QHash and get the
associated modelindex.
Have fun
Eckhard
---
Or, simply overload the data method, and if the display data matches,
modify the BackroundRole
Scott
More information about the Qt-interest-old
mailing list