diff --git a/src/Mod/Spreadsheet/App/Cell.cpp b/src/Mod/Spreadsheet/App/Cell.cpp index 62f2dfbab8..667a47c337 100644 --- a/src/Mod/Spreadsheet/App/Cell.cpp +++ b/src/Mod/Spreadsheet/App/Cell.cpp @@ -85,7 +85,7 @@ Cell::Cell(const CellAddress &_address, PropertySheet *_owner) , alignment(ALIGNMENT_HIMPLIED | ALIGNMENT_LEFT | ALIGNMENT_VIMPLIED | ALIGNMENT_VCENTER) , style() , foregroundColor(0, 0, 0, 1) - , backgroundColor(1, 1, 1, 1) + , backgroundColor(1, 1, 1, 0) , displayUnit() , computedUnit() , rowSpan(1) @@ -339,7 +339,7 @@ void Cell::setBackground(const App::Color &color) PropertySheet::Signaller signaller(*owner); backgroundColor = color; - setUsed(BACKGROUND_COLOR_SET, backgroundColor != App::Color(1, 1, 1, 1)); + setUsed(BACKGROUND_COLOR_SET, backgroundColor != App::Color(1, 1, 1, 0)); } } diff --git a/src/Mod/Spreadsheet/Gui/SheetModel.cpp b/src/Mod/Spreadsheet/Gui/SheetModel.cpp index 70efaf3e56..e1ebfd369c 100644 --- a/src/Mod/Spreadsheet/Gui/SheetModel.cpp +++ b/src/Mod/Spreadsheet/Gui/SheetModel.cpp @@ -28,6 +28,7 @@ # include #endif +#include #include "SheetModel.h" #include #include @@ -46,6 +47,9 @@ SheetModel::SheetModel(Sheet *_sheet, QObject *parent) , sheet(_sheet) { cellUpdatedConnection = sheet->cellUpdated.connect(bind(&SheetModel::cellUpdated, this, _1)); + + ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/Mod/Spreadsheet"); + aliasBgColor = QColor(Base::Tools::fromStdString(hGrp->GetASCII("AliasedCellBackgroundColor", "#feff9e"))); } SheetModel::~SheetModel() @@ -167,6 +171,13 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const } return QVariant(v); } +#else + if (role == Qt::ToolTipRole) { + std::string alias; + if (cell->getAlias(alias)) + return QVariant(Base::Tools::fromStdString(alias)); + return QVariant(); + } #endif if (cell->hasException()) { @@ -214,8 +225,14 @@ QVariant SheetModel::data(const QModelIndex &index, int role) const if (role == Qt::BackgroundRole) { if (cell->getBackground(color)) return QVariant::fromValue(QColor(255.0 * color.r, 255.0 * color.g, 255.0 * color.b, 255.0 * color.a)); - else - return QVariant(); + else { + std::string alias; + if (cell->getAlias(alias)) { + return QVariant::fromValue(aliasBgColor); + } + else + return QVariant(); + } } int qtAlignment = 0; diff --git a/src/Mod/Spreadsheet/Gui/SheetModel.h b/src/Mod/Spreadsheet/Gui/SheetModel.h index 577c5e6603..dbb8b92e54 100644 --- a/src/Mod/Spreadsheet/Gui/SheetModel.h +++ b/src/Mod/Spreadsheet/Gui/SheetModel.h @@ -53,6 +53,7 @@ private: boost::BOOST_SIGNALS_NAMESPACE::scoped_connection cellUpdatedConnection; Spreadsheet::Sheet * sheet; + QColor aliasBgColor; }; }