Unsolicited checkboxes in QTableView
	
	
		Hi,
I'm using QAbstractTableModel/QTableView to display a table of numeric data stored as strings that have been cast to QVariant--that is, in a vector<QVariant> in my QAbstractTableModel subclass.  When I show the data, in every cell there is a checkbox in tri-state mode--checked when the value is 2, darkened when it is 1, and empty otherwise. :confused::confused:
In no place did I (explicitly) 'ask' for this checkbox, I just want to display the data in the cell all by itself.  Here is the code I use to set the QTableView properties:
(DataTable is a QWidget, saTableModel is my QAbstractTableModel subclass)
	Code:
	
DataTable
::DataTable(QWidget* parent, saTableModel
* _satm
) : QWidget(parent
), satm
(_satm
){
    layMain->addWidget(tblv);
    setLayout(layMain);
 
    SetUpTableView();
 
    tblv->setHorizontalHeader(hdrv);
 
    tblv->show();
}
void DataTable::SetUpTableView()
{
    tblv->setModel(satm);
    tblv->setAlternatingRowColors(true);
    tblv->setSelectionModel(select);
}
 
Anybody know why I'm getting unwanted checkboxes?  
Best,
Matt
	 
	
	
	
		Re: Unsolicited checkboxes in QTableView
	
	
		Your model is incorrect. You are not returning empty QVariants for Qt::CheckStateRole in your implementation of data(). You probably don't differentiate roles at all.
	 
	
	
	
		Re: Unsolicited checkboxes in QTableView
	
	
		wysota,
Right you were!  Adding 'if (role==QtDisplayRole) return ...; return QVariant();' solved the problem.  And your answer came in time for my deadline too, thanks!
Matt