QTfrontend/netserverslist.cpp
changeset 2948 3f21a9dc93d0
parent 1066 1f1b3686a2b0
child 3236 4ab3917d7d44
equal deleted inserted replaced
2947:803b277e4894 2948:3f21a9dc93d0
    33 }
    33 }
    34 
    34 
    35 QVariant HWNetServersModel::headerData(int section,
    35 QVariant HWNetServersModel::headerData(int section,
    36             Qt::Orientation orientation, int role) const
    36             Qt::Orientation orientation, int role) const
    37 {
    37 {
    38 	if (role != Qt::DisplayRole)
    38     if (role != Qt::DisplayRole)
    39 		return QVariant();
    39         return QVariant();
    40 
    40 
    41 	if (orientation == Qt::Horizontal)
    41     if (orientation == Qt::Horizontal)
    42 	{
    42     {
    43 		switch (section)
    43         switch (section)
    44 		{
    44         {
    45 			case 0: return tr("Title");
    45             case 0: return tr("Title");
    46 			case 1: return tr("IP");
    46             case 1: return tr("IP");
    47 			case 2: return tr("Port");
    47             case 2: return tr("Port");
    48 			default: return QVariant();
    48             default: return QVariant();
    49 		}
    49         }
    50 	} else
    50     } else
    51 		return QString("%1").arg(section + 1);
    51         return QString("%1").arg(section + 1);
    52 }
    52 }
    53 
    53 
    54 int HWNetServersModel::rowCount(const QModelIndex &parent) const
    54 int HWNetServersModel::rowCount(const QModelIndex &parent) const
    55 {
    55 {
    56 	if (parent.isValid())
    56     if (parent.isValid())
    57 		return 0;
    57         return 0;
    58 	else
    58     else
    59 		return games.size();
    59         return games.size();
    60 }
    60 }
    61 
    61 
    62 int HWNetServersModel::columnCount(const QModelIndex & parent) const
    62 int HWNetServersModel::columnCount(const QModelIndex & parent) const
    63 {
    63 {
    64 	if (parent.isValid())
    64     if (parent.isValid())
    65 		return 0;
    65         return 0;
    66 	else
    66     else
    67 		return 3;
    67         return 3;
    68 }
    68 }