chore: 格式化ElaWidgetTools代码
This commit is contained in:
@@ -1,18 +1,11 @@
|
||||
#include "ElaPivotModel.h"
|
||||
|
||||
ElaPivotModel::ElaPivotModel(QObject* parent)
|
||||
: QAbstractListModel{parent}
|
||||
{
|
||||
}
|
||||
ElaPivotModel::ElaPivotModel(QObject *parent) : QAbstractListModel{parent} {}
|
||||
|
||||
ElaPivotModel::~ElaPivotModel()
|
||||
{
|
||||
}
|
||||
ElaPivotModel::~ElaPivotModel() {}
|
||||
|
||||
void ElaPivotModel::appendPivot(QString pivot)
|
||||
{
|
||||
if (!pivot.isEmpty())
|
||||
{
|
||||
void ElaPivotModel::appendPivot(QString pivot) {
|
||||
if (!pivot.isEmpty()) {
|
||||
beginInsertRows(QModelIndex(), _pivotList.count(), _pivotList.count());
|
||||
_pivotList.append(pivot);
|
||||
endInsertRows();
|
||||
@@ -20,10 +13,8 @@ void ElaPivotModel::appendPivot(QString pivot)
|
||||
}
|
||||
}
|
||||
|
||||
void ElaPivotModel::removePivot(QString pivot)
|
||||
{
|
||||
if (_pivotList.contains(pivot))
|
||||
{
|
||||
void ElaPivotModel::removePivot(QString pivot) {
|
||||
if (_pivotList.contains(pivot)) {
|
||||
int index = _pivotList.lastIndexOf(pivot);
|
||||
beginRemoveRows(QModelIndex(), index, index);
|
||||
_pivotList.removeAt(index);
|
||||
@@ -31,20 +22,12 @@ void ElaPivotModel::removePivot(QString pivot)
|
||||
}
|
||||
}
|
||||
|
||||
int ElaPivotModel::getPivotListCount() const
|
||||
{
|
||||
return _pivotList.count();
|
||||
}
|
||||
int ElaPivotModel::getPivotListCount() const { return _pivotList.count(); }
|
||||
|
||||
int ElaPivotModel::rowCount(const QModelIndex& parent) const
|
||||
{
|
||||
return _pivotList.count();
|
||||
}
|
||||
int ElaPivotModel::rowCount(const QModelIndex &parent) const { return _pivotList.count(); }
|
||||
|
||||
QVariant ElaPivotModel::data(const QModelIndex& index, int role) const
|
||||
{
|
||||
if (role == Qt::DisplayRole)
|
||||
{
|
||||
QVariant ElaPivotModel::data(const QModelIndex &index, int role) const {
|
||||
if (role == Qt::DisplayRole) {
|
||||
return _pivotList[index.row()];
|
||||
}
|
||||
return QVariant();
|
||||
|
||||
Reference in New Issue
Block a user