i am trying to color a particular column in AbstractTableModel. But I wonder why its not working.........Here is the code snipp....
thanks.
function ColorModel(parent)
{
}
{
return 2;
}
ColorModel.
prototype.
columnCount= function
(QModelIndex){
return 5;
}
ColorModel.prototype.color=function(){
return new QColor(127,
200 ,
24);
}
ColorModel.prototype.data = function(index, role)
{
var dataR;
if (role == Qt.DisplayRole) {
return 5;
}
if (role == Qt.BackgroundRole) {
if (index.column() == 1)
//return new QColor(127, 200 , 24);
return this.color;
//var color = new RGBColor('darkblue');
}
return dataR;
}
function ColorModel(parent)
{
QAbstractTableModel.call(this, parent);
}
ColorModel.prototype= new QAbstractTableModel();
ColorModel.prototype.rowCount= function (QModelIndex)
{
return 2;
}
ColorModel.prototype.columnCount= function (QModelIndex)
{
return 5;
}
ColorModel.prototype.color=function(){
return new QColor(127, 200 , 24);
}
ColorModel.prototype.data = function(index, role)
{
var dataR;
if (role == Qt.DisplayRole) {
return 5;
}
if (role == Qt.BackgroundRole) {
if (index.column() == 1)
//return new QColor(127, 200 , 24);
return this.color;
//var color = new RGBColor('darkblue');
}
return dataR;
}
To copy to clipboard, switch view to plain text mode
Bookmarks