Files
create/src/Mod/Spreadsheet/Gui/SheetModel.h
luzpaz be64da3de5 Spreadsheet: fix header uniformity
+ trailing whitespace
2023-01-22 21:46:17 +01:00

71 lines
2.9 KiB
C++

/***************************************************************************
* Copyright (c) 2015 Eivind Kvedalen <eivind@kvedalen.name> *
* *
* This file is part of the FreeCAD CAx development system. *
* *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Library General Public *
* License as published by the Free Software Foundation; either *
* version 2 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU Library General Public License for more details. *
* *
* You should have received a copy of the GNU Library General Public *
* License along with this library; see the file COPYING.LIB. If not, *
* write to the Free Software Foundation, Inc., 59 Temple Place, *
* Suite 330, Boston, MA 02111-1307, USA *
* *
***************************************************************************/
#ifndef SHEETMODEL_H
#define SHEETMODEL_H
#include <QAbstractTableModel>
#include <App/Range.h>
namespace Spreadsheet {
class Sheet;
}
namespace SpreadsheetGui {
class SheetModel : public QAbstractTableModel
{
Q_OBJECT
public:
explicit SheetModel(Spreadsheet::Sheet * _sheet, QObject *parent = nullptr);
~SheetModel() override;
explicit SheetModel(QObject *parent);
int rowCount(const QModelIndex &parent = QModelIndex()) const override ;
int columnCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
QVariant headerData(int section, Qt::Orientation orientation, int role) const override;
bool setData(const QModelIndex &index, const QVariant &value, int role) override;
Qt::ItemFlags flags(const QModelIndex &) const override;
private Q_SLOTS:
void setCellData(QModelIndex index, QString str);
private:
void cellUpdated(App::CellAddress address);
void rangeUpdated(const App::Range &range);
boost::signals2::scoped_connection cellUpdatedConnection;
boost::signals2::scoped_connection rangeUpdatedConnection;
Spreadsheet::Sheet * sheet;
QColor aliasBgColor;
QColor textFgColor;
QColor positiveFgColor;
QColor negativeFgColor;
};
}
#endif // SHEETMODEL_H