Hello! WModelIndexSet is a set of WModelIndex: WModelIndex:23:typedef std::set<WModelIndex> WModelIndexSet;
So you can use methods of std::set to getWModelIndexes Regards. On Sat, Aug 20, 2011 at 05:27, <[email protected]> wrote: > Zhimin, > > it works fine. Thanks a lot. > > I was taking a look at WAbstractItemView::selectedIndexes(), but I did not > understand how to get individual WModelIndex from WModelIndexSet, that I > thought it was a std::set of WModelIndex, but it seems to be a set of a kind > of Tree Nodes. Probably I am understanding something wrong. > > Regards. >>-- Original Message -- >>Date: Tue, 16 Aug 2011 09:14:35 +0800 >>From: Zhimin Song <[email protected]> >>To: [email protected] >>Subject: Re: [Wt-interest] WTableView question >>Reply-To: [email protected] >> >> >>hey, mario: >> >>the index I got is from: >> >>Signal <classWt_1_1Signal.html>< WModelIndex <classWt_1_1WModelIndex.html>, >>WMouseEvent <classWt_1_1WMouseEvent.html> > & >>clicked<classWt_1_1WAbstractItemView.html#a3b72d5f8e5b0afdea83e224354d3e91b> >> () Signal emitted when an item is clicked. >> <#a3b72d5f8e5b0afdea83e224354d3e91b> >>Signal <classWt_1_1Signal.html>< WModelIndex <classWt_1_1WModelIndex.html>, >>WMouseEvent <classWt_1_1WMouseEvent.html> > & >>doubleClicked<classWt_1_1WAbstractItemView.html#a14ac099f58621d66834aa5674ea8ecb5> >> () Signal emitted when an item is double clicked. >> >>the WAbstractItemView::selectedIndexes() wim suggested is another good >>reslotion, >>when you need multi-selection. >> >>Best regards >>Zhimin >> >>2011/8/16 <[email protected]> >> >>> Zhimin, thanks a lot for your advice. Just one more question: as far as >>I >>> understand the function that you use to retrieve data from the selected >>row >>> needs the index (WModelIndex) of the selected row. How do you get that >>> index? >>> >>> thanks again. >>> >-- Original Message -- >>> >Date: Mon, 15 Aug 2011 10:53:06 +0800 >>> >From: Zhimin Song <[email protected]> >>> >To: [email protected] >>> >Subject: Re: [Wt-interest] WTableView question >>> >Reply-To: [email protected] >>> > >>> > >>> >hi, Mario: >>> > >>> >In my way, I always setData like below: >>> > >>> > model_->setData(row, col_, value); >>> > // set the row as DbRowRole when set value. >>> > model_->setData(row, col_, row, DbRowRole); >>> > >>> >and then get the row of DbRowRole: >>> > >>> >void PList::selected(const WModelIndex& index) { >>> >int row = boost::any_cast<int>(index.data(DbRowRole)); >>> >pb_ = pv_[row]; >>> >} >>> > >>> >the pb_ is a Project and pv_ is a std::vector<Project>. >>> > >>> >BR >>> > >>> >Zhimin >>> > >>> >2011/8/15 <[email protected]> >>> > >>> >> Hi, my name is Mario Diethelm. I am a C/C++ programmer making my first >>> >> steps >>> >> in the field of Web applications. >>> >> >>> >> I have started to work with Wt a couple of months ago. I am building >>an >>> >> application >>> >> that needs to load rows of data from a data base and present it on > the >>> >> browser. >>> >> I am using a WStandardItemModel to load the actual data and a WTableView >>> >> to display it. The user then must select one of the records available >>> to >>> >> make some process based on the data selected. >>> >> >>> >> The question is: how do I identify the selected record? I do not have >>> >> problems >>> >> loading the data into the WStandardItemModel, or presenting it on the >>> >> screen, >>> >> using the WTableView widget. Even more, in a row basis, I can select >>the >>> >> required record but I can not realize how to identify it and access >>the >>> >> actual >>> >> data in my program. I have been looking the Class Reference and source >>> >code >>> >> examples but I can not find a way to recognize the "current selected >>> >> record" >>> >> neither how to manage it inside the application. >>> >> >>> >> I would appreciate if somebody could give me some advice. I am using >>Wt >>> >> 3.1.7. >>> >> >>> >> Thanks and regards. >>> >> >>> >> Mario Diethelm. >>> >> >>> >> >>> >> >>> >> >>> >> >>> ------------------------------------------------------------------------------ >>> >> uberSVN's rich system and user administration capabilities and model >>> >> configuration take the hassle out of deploying and managing Subversion >>> >and >>> >> the tools developers use with it. Learn more about uberSVN and get > a >>> free >>> >> download at: http://p.sf.net/sfu/wandisco-dev2dev >>> >> _______________________________________________ >>> >> witty-interest mailing list >>> >> [email protected] >>> >> https://lists.sourceforge.net/lists/listinfo/witty-interest >>> >> >>> > >>> > >>> > >>> >-- >>> >?????hi.baidu.com/zhmsong? >>> >?????sf.net/projects/cxserver <http://sourceforge.net/projects/cxserver/> >>> >>> >------------------------------------------------------------------------------ >>> >uberSVN's rich system and user administration capabilities and model >>> >configuration take the hassle out of deploying and managing Subversion >>and >>> > >>> >the tools developers use with it. Learn more about uberSVN and get a > free >>> > >>> >download at: http://p.sf.net/sfu/wandisco-dev2dev >>> >_______________________________________________ >>> >witty-interest mailing list >>> >[email protected] >>> >https://lists.sourceforge.net/lists/listinfo/witty-interest >>> >>> >>> >>> >>> ------------------------------------------------------------------------------ >>> uberSVN's rich system and user administration capabilities and model >>> configuration take the hassle out of deploying and managing Subversion >>and >>> the tools developers use with it. Learn more about uberSVN and get a free >>> download at: http://p.sf.net/sfu/wandisco-dev2dev >>> _______________________________________________ >>> witty-interest mailing list >>> [email protected] >>> https://lists.sourceforge.net/lists/listinfo/witty-interest >>> >> >> >> >>-- >>?????hi.baidu.com/zhmsong? >>?????sf.net/projects/cxserver <http://sourceforge.net/projects/cxserver/> >>------------------------------------------------------------------------------ >>uberSVN's rich system and user administration capabilities and model >>configuration take the hassle out of deploying and managing Subversion and >> >>the tools developers use with it. Learn more about uberSVN and get a free >> >>download at: http://p.sf.net/sfu/wandisco-dev2dev >>_______________________________________________ >>witty-interest mailing list >>[email protected] >>https://lists.sourceforge.net/lists/listinfo/witty-interest > > > > ------------------------------------------------------------------------------ > Get a FREE DOWNLOAD! and learn more about uberSVN rich system, > user administration capabilities and model configuration. Take > the hassle out of deploying and managing Subversion and the > tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 > _______________________________________________ > witty-interest mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/witty-interest > ------------------------------------------------------------------------------ Get a FREE DOWNLOAD! and learn more about uberSVN rich system, user administration capabilities and model configuration. Take the hassle out of deploying and managing Subversion and the tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2 _______________________________________________ witty-interest mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/witty-interest
