[Qt-interest] Tree Item High Lighter

Eckhard Jokisch e.jokisch at orange-moon.de
Mon Dec 27 04:52:56 CET 2010


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

> 
> If there is already any example implementing this feature, please forward me
> to this.
> 
> 
> Any suggestion on implementing this feature would be very helpful.
> 
> 
> Happy New Year
> 
> Sajjad
> 
> 
> 
> 
> _______________________________________________
> Qt-interest mailing list
> Qt-interest at qt.nokia.com
> http://lists.qt.nokia.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list