mirror of
https://github.com/tnodir/fort
synced 2024-11-15 08:35:08 +00:00
ZoneListModel: Simplify headerData()
This commit is contained in:
parent
77fb73cd4b
commit
fe16207a2f
@ -44,18 +44,7 @@ int ZoneListModel::columnCount(const QModelIndex &parent) const
|
||||
QVariant ZoneListModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
{
|
||||
if (orientation == Qt::Horizontal && (role == Qt::DisplayRole || role == Qt::ToolTipRole)) {
|
||||
switch (section) {
|
||||
case 0:
|
||||
return tr("Zone");
|
||||
case 1:
|
||||
return tr("Source");
|
||||
case 2:
|
||||
return tr("Addresses");
|
||||
case 3:
|
||||
return tr("Last Run");
|
||||
case 4:
|
||||
return tr("Last Success");
|
||||
}
|
||||
return headerDataDisplay(section);
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
@ -79,6 +68,23 @@ QVariant ZoneListModel::data(const QModelIndex &index, int role) const
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant ZoneListModel::headerDataDisplay(int section) const
|
||||
{
|
||||
switch (section) {
|
||||
case 0:
|
||||
return tr("Zone");
|
||||
case 1:
|
||||
return tr("Source");
|
||||
case 2:
|
||||
return tr("Addresses");
|
||||
case 3:
|
||||
return tr("Last Run");
|
||||
case 4:
|
||||
return tr("Last Success");
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
QVariant ZoneListModel::dataDisplay(const QModelIndex &index) const
|
||||
{
|
||||
const int row = index.row();
|
||||
|
@ -70,6 +70,7 @@ protected:
|
||||
QString sqlBase() const override;
|
||||
|
||||
private:
|
||||
QVariant headerDataDisplay(int section) const;
|
||||
QVariant dataDisplay(const QModelIndex &index) const;
|
||||
QVariant dataCheckState(const QModelIndex &index) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user