Пример #1
0
QVariant flightDataModel::data(const QModelIndex &index, int role) const
{
    if (role == Qt::DisplayRole||role==Qt::EditRole)
    {
        int rowNumber=index.row();
        int columnNumber=index.column();
        if(rowNumber>dataStorage.length()-1 || rowNumber<0)
            return QVariant::Invalid;
        pathPlanData * myRow=dataStorage.at(rowNumber);
        QVariant ret=getColumnByIndex(myRow,columnNumber);
        return ret;
    }
    /*
    else if (role == Qt::BackgroundRole) {
      //  WaypointActive::DataFields waypointActive = waypointActiveObj->getData();

        if(index.row() == waypointActive.Index) {
            return QBrush(Qt::lightGray);
        } else
            return QVariant::Invalid;
    }*/
    else {
        return QVariant::Invalid;
    }
}
Пример #2
0
geChannel *gKeyboard::addChannel(int colIndex, Channel *ch, bool build)
{
	gColumn *col = getColumnByIndex(colIndex);

	/* no column with index 'colIndex' found? Just create it and set its index
	to 'colIndex'. */

	if (!col) {
		__cb_addColumn();
		col = columns.back();
		col->setIndex(colIndex);
		gu_log("[gKeyboard::addChannel] created new column with index=%d\n", colIndex);
	}

	gu_log("[gKeyboard::addChannel] add to column with index = %d\n", col->getIndex());
	return col->addChannel(ch);
}