A simple Widget-Model, tested with Qt4.4This is a ListModel where you can add your Widgets.The Title, Icon, ToolTip, StatusTip and WhatsThis from the widgets are translated to roles of the Model.If editing is enabled the user can edit the Title of the Widgets.If a widget is deleted, it is automatically removed from the model.To display the model you can use an QListView.Example usage:#include "widgetmodel.h"WidgetModel *model=new WidgetModel(this);//adds a widget to the modelmodel->addWidget(myWidget);//removes a widget form the modelmodel->removeWidget(myWidget);//sets the Model in Edit-Modemodel->setEditable(true);//Which index has your widgetQModelIndex index=model->indexForWidget(myWidget);
Ratings & Comments
0 Comments