myEye = QPixmap( 16, 16 );
myEye.fill( Qt::black );
}
-
- // Set the supported drag actions for the items in the model
- setSupportedDragActions( Qt::MoveAction | Qt::CopyAction );
}
/**
{
}
+void HYDROGUI_ListModel::setBackgroundColor(int theInd, QColor theColor)
+{
+ myColoredRow[theInd] = theColor;
+}
+
+void HYDROGUI_ListModel::clearAllBackgroundColors()
+{
+ myColoredRow.clear();
+}
+
+QColor HYDROGUI_ListModel::getBackgroundColor(int theInd) const
+{
+ if (myColoredRow.count( theInd ))
+ return myColoredRow[theInd];
+ else
+ return QColor();
+}
+
/**
*/
QVariant HYDROGUI_ListModel::data( const QModelIndex &theIndex, int theRole ) const
return QVariant();
}
break;
+ case Qt::BackgroundRole:
+ {
+ if( aColumn==0 && aRow >=0 && aRow < myObjects.count() && myColoredRow.contains(aRow))
+ {
+ QBrush aBackgr(myColoredRow[aRow]);
+ return aBackgr;
+ }
+ else
+ return QVariant();
+ }
case Qt::DecorationRole:
{
*/
void HYDROGUI_ListModel::setObjects( const Object2VisibleList& theObjects )
{
+ beginResetModel();
myObjects = theObjects;
-
- reset();
+ endResetModel();
}
/**
*/
void HYDROGUI_ListModel::addObject( const Object2Visible& theObject )
{
+ beginResetModel();
myObjects << theObject;
-
- reset();
+ endResetModel();
}
/**
}
}
+ beginResetModel();
myObjects.removeAll(anItem);
-
- reset();
+ endResetModel();
}
return Qt::MoveAction | Qt::CopyAction;
}
+/**
+*/
+Qt::DropActions HYDROGUI_ListModel::supportedDragActions() const
+{
+ // Set the supported drag actions for the items in the model
+ return Qt::MoveAction | Qt::CopyAction;
+}
+
/**
Get list of ids by the list model indexes.
@param theIsToSort defines if the list of ids should be sorted in ascending order
void HYDROGUI_ListModel::undoLastMove()
{
+ beginResetModel();
myObjects = myPrevObjects;
- reset();
+ endResetModel();
}