When you set data it has different 'roles':
http://www.webtoolkit.eu/wt/doc/reference/html/group__modelview.html#gga0ae864e12320f9f89172735e075ed068a5ed17aded8a0e3b712698cf85a218f1f
.. so on the standard item 'setData':
http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WStandardItem.html#afbe54e68e576c4902c9085f8966c93ef
It defaults to UserRole..
so on the model .. the sortRole .. defaults to 'displayRole'.
I'd call setSortRole on the model:
http://www.webtoolkit.eu/wt/doc/reference/html/classWt_1_1WStandardItemModel.html#a3aa1f52a3ae23611267e049130cb472c
and pass UserRole in there.
That should set you right.
Kind Regards,
Matthew Sherborne
On Wed, Dec 28, 2011 at 7:03 AM, Stefan Ruppert <s...@myarm.com> wrote:
> Hi all,
>
> I have implemented a model which has some colmuns as double values which
> are converted to a string and passed to a WStandardItem object. But when
> sorting this column it uses a string sorting order. E.g. it sorts as
> follows:
>
> 17.12
> 182.24
> 19.09
> 23.17
> 240.60
> 25.78
> 26.91
> 267.13
>
> How can I tell the WStandardItemModel to sort the strings as double values?
>
> I have tried to overload the data() method used the UserRole for
> returnung a double value for sorting. But this does not work.
>
> Regards,
> Stefan
>
>
> ------------------------------------------------------------------------------
> Write once. Port to many.
> Get the SDK and tools to simplify cross-platform app development. Create
> new or port existing apps to sell to consumers worldwide. Explore the
> Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
> http://p.sf.net/sfu/intel-appdev
> _______________________________________________
> witty-interest mailing list
> witty-interest@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create
new or port existing apps to sell to consumers worldwide. Explore the
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest