diff options
Diffstat (limited to 'ticket.cxx')
-rw-r--r-- | ticket.cxx | 53 |
1 files changed, 26 insertions, 27 deletions
@@ -3,36 +3,35 @@ namespace RTClient { - int TicketList::rowCount(QModelIndex const& parent) const - { - Q_UNUSED(parent) - return tickets.count(); - } +int TicketList::rowCount(QModelIndex const& parent) const +{ + Q_UNUSED(parent) + return tickets.count(); +} - QVariant TicketList::data(QModelIndex const& index, int role) const - { - auto row = index.row(); - - if (row < 0 || row >= tickets.count()) return QVariant(); - - auto ticket = tickets[row]; - switch (role) { - case IdRole: - return ticket.id(); - case SubjectRole: - return ticket.subject(); - default: - return QVariant(); - } - } +QVariant TicketList::data(QModelIndex const& index, int role) const +{ + auto row = index.row(); - QHash<int, QByteArray> TicketList::roleNames() const - { - return QHash<int, QByteArray>{ - {IdRole, "id"} - , {SubjectRole, "subject"} - }; + if (row < 0 || row >= tickets.count()) return QVariant(); + + auto ticket = tickets[row]; + switch (role) { + case IdRole: + return ticket.id(); + case SubjectRole: + return ticket.subject(); + default: + return QVariant(); } +} + +QHash<int, QByteArray> TicketList::roleNames() const +{ + return QHash<int, QByteArray>{{IdRole, "id"}, + {SubjectRole, "subject"} + }; +} void TicketList::addTicket(Ticket const& ticket) { |