May/Jun 2015
,Efficient and elegant solutions to common problems in object-oriented programming, they
promoted code reuse and extensibility.
Common used programming practices/solutions to recurring programming problems, that is
efficient and ineffective.
A software architectural pattern for implementing user interfaces. It divides a given software
application three types of objects, the model, the view and the controller objects. The model is
the application object, the view is the screen representation, and the controller defines
communication between user and view
In MVC, controller defines the way in which the UI reacts to user input.
In Qt, the view and the controller are combined, and in place of a controller is a delegate, which
controls rendering, and editing of individual items.
QAbstractListModel provides abstract model that can be sublassed to create one-dimensional list
models, it provides a more specialized interface than QAbstractItemModel, and not suitable for
use with tree views.
,QStandardItemModel provides a generic model for storing custom data or standard Qt data
types, it provides an item-based approach to working with a model. this model can be used
directly.
class PlantListModel : public QAbstractListModel
{ ....};
QVariant PlantListModel::data(const QModelIndex &index, int role)const
{
if(index.row() >= strngList.size())
return QVariant();
if(role == Qt::DisplayRole/FontRole)
, return stringList.at(index.row());
else
return QVariant();
}
returns item flags for the given index. base class implementation returns a combination of flags
that enables the item(ItemIsEnabled),and allow it to be selected(ItemIsSelectable)
, Reflective Programming is that you reflect upon/inspect the code at run time. Which
means ýou are not aware of the actual name of the method or the field in the class but
you can enumerate what are the fields or methods available for a given class and then
invoke which ever you want to from the enumerated list.