Sheet: modernize C++: return braced init list
This commit is contained in:
@@ -33,7 +33,7 @@ using namespace Spreadsheet;
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string PropertyColumnWidthsPy::representation() const
|
||||
{
|
||||
return std::string("<PropertyColumnWidths object>");
|
||||
return {"<PropertyColumnWidths object>"};
|
||||
}
|
||||
|
||||
PyObject *PropertyColumnWidthsPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
|
||||
|
||||
@@ -33,7 +33,7 @@ using namespace Spreadsheet;
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string PropertyRowHeightsPy::representation() const
|
||||
{
|
||||
return std::string("<PropertyRowHeights object>");
|
||||
return {"<PropertyRowHeights object>"};
|
||||
}
|
||||
|
||||
PyObject *PropertyRowHeightsPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
|
||||
|
||||
@@ -33,7 +33,7 @@ using namespace Spreadsheet;
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string PropertySheetPy::representation() const
|
||||
{
|
||||
return std::string("<PropertySheet object>");
|
||||
return {"<PropertySheet object>"};
|
||||
}
|
||||
|
||||
PyObject *PropertySheetPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
|
||||
|
||||
@@ -1399,8 +1399,7 @@ std::string Sheet::getAddressFromAlias(const std::string &alias) const
|
||||
|
||||
if (cell)
|
||||
return cell->getAddress().toString();
|
||||
else
|
||||
return std::string();
|
||||
return {};
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,7 +40,7 @@ using namespace App;
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string SheetPy::representation() const
|
||||
{
|
||||
return std::string("<Sheet object>");
|
||||
return {"<Sheet object>"};
|
||||
}
|
||||
|
||||
PyObject *SheetPy::PyMake(struct _typeobject *, PyObject *, PyObject *) // Python wrapper
|
||||
|
||||
@@ -176,8 +176,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
|
||||
if (cell->getStringContent(str))
|
||||
return QVariant(QString::fromUtf8(str.c_str()));
|
||||
else
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
|
||||
// Get display value as computed property
|
||||
@@ -195,8 +194,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
if (cell->getAlias(alias)) {
|
||||
return QVariant::fromValue(aliasBgColor);
|
||||
}
|
||||
else
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -250,23 +248,23 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
case Qt::DisplayRole:
|
||||
if (cell->getExpression()) {
|
||||
std::string str;
|
||||
if (cell->getStringContent(str))
|
||||
if (!str.empty() && str[0] == '=')
|
||||
if (cell->getStringContent(str)) {
|
||||
if (!str.empty() && str[0] == '=') {
|
||||
// If this is a real computed value, indicate that a recompute is
|
||||
// needed before we can display it
|
||||
return QVariant(QLatin1String("#PENDING"));
|
||||
else
|
||||
}
|
||||
else {
|
||||
// If it's just a simple value, display the new value, but still
|
||||
// format it as a pending value to indicate to the user that
|
||||
// a recompute is needed
|
||||
return QVariant(QString::fromUtf8(str.c_str()));
|
||||
else
|
||||
return QVariant();
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
return QVariant();
|
||||
return {};
|
||||
default:
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
else if (prop->isDerivedFrom(App::PropertyString::getClassTypeId())) {
|
||||
@@ -299,7 +297,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
return QVariant::fromValue(qtAlignment);
|
||||
}
|
||||
default:
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
else if (prop->isDerivedFrom(App::PropertyQuantity::getClassTypeId())) {
|
||||
@@ -359,7 +357,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
return formatCellDisplay(v, cell);
|
||||
}
|
||||
default:
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
else if (prop->isDerivedFrom(App::PropertyFloat::getClassTypeId())
|
||||
@@ -421,7 +419,7 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
return formatCellDisplay(v, cell);
|
||||
}
|
||||
default:
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
else if (prop->isDerivedFrom(App::PropertyPythonObject::getClassTypeId())) {
|
||||
@@ -470,11 +468,11 @@ QVariant SheetModel::data(const QModelIndex& index, int role) const
|
||||
return formatCellDisplay(v, cell);
|
||||
}
|
||||
default:
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
}
|
||||
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
|
||||
QVariant SheetModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||
@@ -502,7 +500,7 @@ QVariant SheetModel::headerData(int section, Qt::Orientation orientation, int ro
|
||||
return QString::number(section + 1);
|
||||
}
|
||||
}
|
||||
return QVariant();
|
||||
return {};
|
||||
}
|
||||
|
||||
void SheetModel::setCellData(QModelIndex index, QString str)
|
||||
|
||||
@@ -94,7 +94,7 @@ QSize SpreadsheetDelegate::sizeHint(const QStyleOptionViewItem & option, const Q
|
||||
{
|
||||
Q_UNUSED(option);
|
||||
Q_UNUSED(index);
|
||||
return QSize();
|
||||
return {};
|
||||
}
|
||||
|
||||
static inline void drawBorder(QPainter *painter, const QStyleOptionViewItem &option,
|
||||
|
||||
@@ -32,7 +32,7 @@ using namespace SpreadsheetGui;
|
||||
// returns a string which represents the object e.g. when printed in python
|
||||
std::string ViewProviderSpreadsheetPy::representation() const
|
||||
{
|
||||
return std::string("<ViewProviderSpreadsheet object>");
|
||||
return {"<ViewProviderSpreadsheet object>"};
|
||||
}
|
||||
|
||||
PyObject* ViewProviderSpreadsheetPy::getView(PyObject* args)
|
||||
|
||||
Reference in New Issue
Block a user