56 lines
2.0 KiB
C++
56 lines
2.0 KiB
C++
/*==============================================================================
|
|
** Copyright (C) 2024-2027 WingSummer
|
|
**
|
|
** Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
** of this software and associated documentation files (the "Software"), to deal
|
|
** in the Software without restriction, including without limitation the rights
|
|
** to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
** copies of the Software, and to permit persons to whom the Software is
|
|
** furnished to do so.
|
|
**
|
|
** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
** THE SOFTWARE.
|
|
** =============================================================================
|
|
*/
|
|
|
|
#include "testtablemodel.h"
|
|
#include "WingPlugin/iwingpluginbase.h"
|
|
|
|
TestTableModel::TestTableModel(QObject *parent) : QAbstractTableModel(parent) {}
|
|
|
|
int TestTableModel::rowCount(const QModelIndex &parent) const {
|
|
Q_UNUSED(parent);
|
|
return WingHex::SDKVERSION;
|
|
}
|
|
|
|
int TestTableModel::columnCount(const QModelIndex &parent) const {
|
|
Q_UNUSED(parent);
|
|
return 5;
|
|
}
|
|
|
|
QVariant TestTableModel::data(const QModelIndex &index, int role) const {
|
|
switch (role) {
|
|
case Qt::DisplayRole:
|
|
case Qt::ToolTipRole: {
|
|
return QStringLiteral("(%1, %2)").arg(index.row()).arg(index.column());
|
|
}
|
|
case Qt::TextAlignmentRole:
|
|
return Qt::AlignCenter;
|
|
}
|
|
return QVariant();
|
|
}
|
|
|
|
QVariant TestTableModel::headerData(int section, Qt::Orientation orientation,
|
|
int role) const {
|
|
Q_UNUSED(orientation);
|
|
if (role == Qt::DisplayRole) {
|
|
return section + 1;
|
|
}
|
|
return QVariant();
|
|
}
|