File: sqlqueryrownummodel.cpp

package info (click to toggle)
sqlitestudio 3.4.21%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 54,880 kB
  • sloc: ansic: 406,208; cpp: 123,872; yacc: 2,692; tcl: 497; sh: 462; xml: 426; makefile: 19
file content (63 lines) | stat: -rw-r--r-- 1,354 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "sqlqueryrownummodel.h"
#include "common/unused.h"

SqlQueryRowNumModel::SqlQueryRowNumModel(QAbstractItemModel *value, QObject *parent) :
    QAbstractItemModel(parent)
{
    mainModel = value;
}

QModelIndex SqlQueryRowNumModel::index(int row, int column, const QModelIndex &parent) const
{
    UNUSED(row);
    UNUSED(column);
    UNUSED(parent);
    return QModelIndex();
}

QModelIndex SqlQueryRowNumModel::parent(const QModelIndex &child) const
{
    UNUSED(child);
    return QModelIndex();
}

int SqlQueryRowNumModel::rowCount(const QModelIndex &parent) const
{
    UNUSED(parent);

    if (!mainModel)
        return 0;

    return mainModel->rowCount();
}

int SqlQueryRowNumModel::columnCount(const QModelIndex &parent) const
{
    UNUSED(parent);

    if (!mainModel)
        return 0;

    return mainModel->columnCount();
}

QVariant SqlQueryRowNumModel::data(const QModelIndex &index, int role) const
{
    UNUSED(index);
    UNUSED(role);
    return QVariant();
}

QVariant SqlQueryRowNumModel::headerData(int section, Qt::Orientation orientation, int role) const
{
    UNUSED(role);
    if (orientation == Qt::Horizontal)
        return QVariant();

    return rowNumBase + section;
}

void SqlQueryRowNumModel::setRowNumBase(int value)
{
    rowNumBase = value;
}