To create descendant class of WAbstractItemModel from dbo collection,
do the following:

Inherit from dbo::QueryModel<dbo::Query<dbo::ptr<YourModel> > >
Remember dbo::QueryModel is descendant of WAbstractItemModel.
In constructor (or other place) of your new class call .setQuery(query
corresponding to collection of interest).
Then call .addColumn("field-name", tr("field-name")) for each field
you want to see in model.

If you need some calculations between models data and display data,
reimplemenet method .data(). If role=DisplayRole, generate and return
proper data. Do not forget to return dbo::QueryModel::data(...)
otherwise, for other columns.

As you can see, all needed fields should be added manually by calling addColumn.

Regards,
Boris Nagaev


On Fri, Feb 28, 2014 at 11:27 PM, Muhammad Nasser Al-Noimi
<[email protected]> wrote:
> I actually want to get model descendants of WAbstractItemModel from dbo
> collection so I have to iterate the columns for each row manually?
>
>
> On Fri, Feb 28, 2014 at 8:23 PM, Nagaev Boris <[email protected]> wrote:
>>
>> Hello,
>>
>> I wrote about how to iterate objects (rows), not fields (columns).
>> To iterate fields, use .persist() method of your model with custom
>> function as Action.
>>
>> Probably we confused models as classes for dbo objects and models as
>> descendants of WAbstractItemModel.
>>
>> Regards,
>> Boris Nagaev
>>
>> On Fri, Feb 28, 2014 at 11:14 PM, Muhammad Nasser Al-Noimi
>> <[email protected]> wrote:
>> > Thanks for reply,
>> >
>> > This means that I have to add each column manually not using a loop? in
>> > order to initialize the model which also I should inherit new model
>> > class
>> > from WAbstractTableModel? Is there any way to iterate the column of dbo
>> > object insted of accessing class member?
>> >
>> > Thanks a lot
>> >
>> >
>> > On Fri, Feb 28, 2014 at 7:33 PM, Nagaev Boris <[email protected]> wrote:
>> >>
>> >> Hello,
>> >>
>> >> you can iterate objects of collection using .begin() and .end().
>> >> To make code shorter, use boost foreach:
>> >>
>> >> #include <boost/foreach.hpp>
>> >> BOOST_FOREACH (dbo::ptr<Model> object, collection) { ... }
>> >>
>> >> or C++11 for:
>> >>
>> >> for (dbo::ptr<Model> object : collection) { ... }
>> >>
>> >> Regards,
>> >> Boris Nagaev
>> >>
>> >> On Fri, Feb 28, 2014 at 9:59 PM, Muhammad Nasser Al-Noimi
>> >> <[email protected]> wrote:
>> >> > Hi,
>> >> >
>> >> > I have small question about how to get model from dbo collection, Is
>> >> > there
>> >> > any easy to use way to get that? such as the getting dbo object from
>> >> > model
>> >> > using resultRow function.
>> >> >
>> >> > Thanx,
>> >> > Nasser Al-Noimi
>> >> >
>> >> >
>> >> >
>> >> > ------------------------------------------------------------------------------
>> >> > Flow-based real-time traffic analytics software. Cisco certified
>> >> > tool.
>> >> > Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
>> >> > Customize your own dashboards, set traffic alerts and generate
>> >> > reports.
>> >> > Network behavioral analysis & security monitoring. All-in-one tool.
>> >> >
>> >> >
>> >> > http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>> >> > _______________________________________________
>> >> > witty-interest mailing list
>> >> > [email protected]
>> >> > https://lists.sourceforge.net/lists/listinfo/witty-interest
>> >> >
>> >>
>> >>
>> >>
>> >> ------------------------------------------------------------------------------
>> >> Flow-based real-time traffic analytics software. Cisco certified tool.
>> >> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
>> >> Customize your own dashboards, set traffic alerts and generate reports.
>> >> Network behavioral analysis & security monitoring. All-in-one tool.
>> >>
>> >>
>> >> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>> >> _______________________________________________
>> >> witty-interest mailing list
>> >> [email protected]
>> >> https://lists.sourceforge.net/lists/listinfo/witty-interest
>> >
>> >
>> >
>> >
>> > ------------------------------------------------------------------------------
>> > Flow-based real-time traffic analytics software. Cisco certified tool.
>> > Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
>> > Customize your own dashboards, set traffic alerts and generate reports.
>> > Network behavioral analysis & security monitoring. All-in-one tool.
>> >
>> > http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>> > _______________________________________________
>> > witty-interest mailing list
>> > [email protected]
>> > https://lists.sourceforge.net/lists/listinfo/witty-interest
>> >
>>
>>
>> ------------------------------------------------------------------------------
>> Flow-based real-time traffic analytics software. Cisco certified tool.
>> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
>> Customize your own dashboards, set traffic alerts and generate reports.
>> Network behavioral analysis & security monitoring. All-in-one tool.
>>
>> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
>> _______________________________________________
>> witty-interest mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
>
>
> ------------------------------------------------------------------------------
> Flow-based real-time traffic analytics software. Cisco certified tool.
> Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
> Customize your own dashboards, set traffic alerts and generate reports.
> Network behavioral analysis & security monitoring. All-in-one tool.
> http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>

------------------------------------------------------------------------------
Flow-based real-time traffic analytics software. Cisco certified tool.
Monitor traffic, SLAs, QoS, Medianet, WAAS etc. with NetFlow Analyzer
Customize your own dashboards, set traffic alerts and generate reports.
Network behavioral analysis & security monitoring. All-in-one tool.
http://pubads.g.doubleclick.net/gampad/clk?id=126839071&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to