Hello,

I think, this should help:

1. Create two models, first is targeted to read-only table, second to
instructions table.
2. Set one model (read-only table) with view->setModel
3. Inherit from WItemDelegate, overload method
WItemDelegate::setModelData with custom function, saving data to
another model (instructions table).
4. Set this item delegate using view->setItemDelegateForColumn for all
editable columns

Probably, you have to create two classes (one class per table) and to
map them both (Dbo::Session::mapClass).
To avoid code duplication, you can create one base class with all
needed fields, and inherit from them two empty classes.

On Tue, May 29, 2012 at 2:28 AM, Joel <[email protected]> wrote:
> Hello,
>
> I am working on an application which queries a sqlite3 database and adds
> columns to a WTableView so that they can be displayed on a web browser. The
> data that is displayed on the web browser is editable but I do not want to
> write the edited result to the same table which it was queried from.
>
> class mainWindow : public WContainerWidget
> {
> public:
>   mainWindow (dbo::Session & session, WContainerWidget *parent=0)
>     : WContainerWidget (parent)
>   {
>
>    dbo::QueryModel< dbo::ptr<Panel1> > *model = new dbo::QueryModel<
> dbo::ptr<Panel1> >();
>     model->setQuery(session.find<Panel1>());
>     model->addColumn("Config_Cal_Position_THClosedB",ItemIsEditable);
>     model->addColumn("Config_IDs_Rams_Ram1AID",ItemIsEditable);
>
>
>     WTableView *view = new WTableView (this);
>     view->resize(800, 300);
>     view->setSelectionMode(SingleSelection);
>     view->setModel(model);
>
>
>   }
>
>
> The <Panel1> table is a view only table, in order to edit the data I have to
> do so through an instruction table via the following sqlite3 command
>
> insert into instructions(instruction_type, port, param1, param2, param3)
> values (0, <1-4>, 86, <register name>, <register value>);
>
> So basically, I am attempting to read from table <Panel1>, have the ability
> to edit the data on a browser, and write the edited result to the <register
> value> parameter of the instruction table.
>
> Your help would be greatly appreciated!
>
> Thanks,
> Joel
>
> ------------------------------------------------------------------------------
> Live Security Virtual Conference
> Exclusive live event will cover all the ways today's security and
> threat landscape has changed and how IT managers can respond. Discussions
> will include endpoint security, mobile security and the latest in malware
> threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to