QTfrontend/netudpwidget.cpp
changeset 668 0d7683a66d61
parent 667 194dc62d1519
child 883 07a568ba44e0
equal deleted inserted replaced
667:194dc62d1519 668:0d7683a66d61
    67 		|| role != Qt::DisplayRole)
    67 		|| role != Qt::DisplayRole)
    68 	return QVariant();
    68 	return QVariant();
    69 
    69 
    70 	return games[index.row()][index.column()];
    70 	return games[index.row()][index.column()];
    71 }
    71 }
    72 
       
    73 QVariant HWNetUdpModel::headerData(int section,
       
    74             Qt::Orientation orientation, int role) const
       
    75 {
       
    76 	if (role != Qt::DisplayRole)
       
    77 		return QVariant();
       
    78 
       
    79 	if (orientation == Qt::Horizontal)
       
    80 	{
       
    81 		switch (section)
       
    82 		{
       
    83 			case 0: return tr("Title");
       
    84 			case 1: return tr("IP");
       
    85 			case 2: return tr("Port");
       
    86 			default: return QVariant();
       
    87 		}
       
    88 	} else
       
    89 		return QString("%1").arg(section + 1);
       
    90 }
       
    91 
       
    92 int HWNetUdpModel::rowCount(const QModelIndex &parent) const
       
    93 {
       
    94 	if (parent.isValid())
       
    95 		return 0;
       
    96 	else
       
    97 		return games.size();
       
    98 }
       
    99 
       
   100 int HWNetUdpModel::columnCount(const QModelIndex & parent) const
       
   101 {
       
   102 	if (parent.isValid())
       
   103 		return 0;
       
   104 	else
       
   105 		return 3;
       
   106 }