Spreadsheet: [skip ci] Fix several clazy issues:
* Mixing iterators with const_iterators [-Wclazy-strict-iterators] * Q_PROPERTY should have either NOTIFY or CONSTANT [-Wclazy-qproperty-without-notify] * Missing reference in range-for with non trivial type [-Wclazy-range-loop-reference] * Missing emit keyword on signal call SpreadsheetGui::SheetViewHeader::resizeFinished [-Wclazy-incorrect-emit] * Missing emit keyword on signal call QAbstractItemModel::dataChanged [-Wclazy-incorrect-emit] * c++11 range-loop might detach Qt container (QStringList) [-Wclazy-range-loop-detach]
This commit is contained in:
@@ -626,7 +626,7 @@ void CmdSpreadsheetStyleBold::activated(int iMsg)
|
||||
if (selection.size() > 0) {
|
||||
bool allBold = true;
|
||||
|
||||
for (QModelIndexList::const_iterator it = selection.begin(); it != selection.end(); ++it) {
|
||||
for (QModelIndexList::const_iterator it = selection.cbegin(); it != selection.cend(); ++it) {
|
||||
const Cell * cell = sheet->getCell(CellAddress((*it).row(), (*it).column()));
|
||||
|
||||
if (cell) {
|
||||
@@ -700,7 +700,7 @@ void CmdSpreadsheetStyleItalic::activated(int iMsg)
|
||||
if (selection.size() > 0) {
|
||||
bool allItalic = true;
|
||||
|
||||
for (QModelIndexList::const_iterator it = selection.begin(); it != selection.end(); ++it) {
|
||||
for (QModelIndexList::const_iterator it = selection.cbegin(); it != selection.cend(); ++it) {
|
||||
const Cell * cell = sheet->getCell(CellAddress((*it).row(), (*it).column()));
|
||||
|
||||
if (cell) {
|
||||
@@ -774,7 +774,7 @@ void CmdSpreadsheetStyleUnderline::activated(int iMsg)
|
||||
if (selection.size() > 0) {
|
||||
bool allUnderline = true;
|
||||
|
||||
for (QModelIndexList::const_iterator it = selection.begin(); it != selection.end(); ++it) {
|
||||
for (QModelIndexList::const_iterator it = selection.cbegin(); it != selection.cend(); ++it) {
|
||||
const Cell * cell = sheet->getCell(CellAddress((*it).row(), (*it).column()));
|
||||
|
||||
if (cell) {
|
||||
|
||||
@@ -516,7 +516,7 @@ void SheetModel::cellUpdated(CellAddress address)
|
||||
{
|
||||
QModelIndex i = index(address.row(), address.col());
|
||||
|
||||
dataChanged(i, i);
|
||||
Q_EMIT dataChanged(i, i);
|
||||
}
|
||||
|
||||
void SheetModel::rangeUpdated(const Range &range)
|
||||
@@ -524,7 +524,7 @@ void SheetModel::rangeUpdated(const Range &range)
|
||||
QModelIndex i = index(range.from().row(), range.from().col());
|
||||
QModelIndex j = index(range.to().row(), range.to().col());
|
||||
|
||||
dataChanged(i, j);
|
||||
Q_EMIT dataChanged(i, j);
|
||||
}
|
||||
|
||||
#include "moc_SheetModel.cpp"
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace bp = boost::placeholders;
|
||||
void SheetViewHeader::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
QHeaderView::mouseReleaseEvent(event);
|
||||
resizeFinished();
|
||||
Q_EMIT resizeFinished();
|
||||
}
|
||||
|
||||
bool SheetViewHeader::viewportEvent(QEvent *e) {
|
||||
@@ -314,7 +314,7 @@ void SheetTableView::insertRows()
|
||||
std::vector<int> sortedRows;
|
||||
|
||||
/* Make sure rows are sorted in ascending order */
|
||||
for (QModelIndexList::const_iterator it = rows.begin(); it != rows.end(); ++it)
|
||||
for (QModelIndexList::const_iterator it = rows.cbegin(); it != rows.cend(); ++it)
|
||||
sortedRows.push_back(it->row());
|
||||
std::sort(sortedRows.begin(), sortedRows.end());
|
||||
|
||||
@@ -365,7 +365,7 @@ void SheetTableView::removeRows()
|
||||
std::vector<int> sortedRows;
|
||||
|
||||
/* Make sure rows are sorted in descending order */
|
||||
for (QModelIndexList::const_iterator it = rows.begin(); it != rows.end(); ++it)
|
||||
for (QModelIndexList::const_iterator it = rows.cbegin(); it != rows.cend(); ++it)
|
||||
sortedRows.push_back(it->row());
|
||||
std::sort(sortedRows.begin(), sortedRows.end(), std::greater<int>());
|
||||
|
||||
@@ -386,7 +386,7 @@ void SheetTableView::insertColumns()
|
||||
std::vector<int> sortedColumns;
|
||||
|
||||
/* Make sure rows are sorted in ascending order */
|
||||
for (QModelIndexList::const_iterator it = cols.begin(); it != cols.end(); ++it)
|
||||
for (QModelIndexList::const_iterator it = cols.cbegin(); it != cols.cend(); ++it)
|
||||
sortedColumns.push_back(it->column());
|
||||
std::sort(sortedColumns.begin(), sortedColumns.end());
|
||||
|
||||
@@ -438,7 +438,7 @@ void SheetTableView::removeColumns()
|
||||
std::vector<int> sortedColumns;
|
||||
|
||||
/* Make sure rows are sorted in descending order */
|
||||
for (QModelIndexList::const_iterator it = cols.begin(); it != cols.end(); ++it)
|
||||
for (QModelIndexList::const_iterator it = cols.cbegin(); it != cols.cend(); ++it)
|
||||
sortedColumns.push_back(it->column());
|
||||
std::sort(sortedColumns.begin(), sortedColumns.end(), std::greater<int>());
|
||||
|
||||
@@ -694,13 +694,13 @@ void SheetTableView::pasteClipboard()
|
||||
Range range = ranges.back();
|
||||
if (!mimeData->hasFormat(_SheetMime)) {
|
||||
CellAddress current = range.from();
|
||||
QStringList cells;
|
||||
QString text = mimeData->text();
|
||||
QStringList cells = text.split(QLatin1Char('\n'));
|
||||
int i=0;
|
||||
for (auto it : text.split(QLatin1Char('\n'))) {
|
||||
for (const auto& it : cells) {
|
||||
QStringList cols = it.split(QLatin1Char('\t'));
|
||||
int j=0;
|
||||
for (auto jt : cols) {
|
||||
for (const auto& jt : cols) {
|
||||
QModelIndex index = model()->index(current.row()+i, current.col()+j);
|
||||
model()->setData(index, jt);
|
||||
j++;
|
||||
|
||||
@@ -581,7 +581,7 @@ Py::Object SheetViewPy::getattr(const char * attr)
|
||||
if (name == "__dict__" || name == "__class__") {
|
||||
Py::Dict dict_self(BaseType::getattr("__dict__"));
|
||||
Py::Dict dict_base(base.getattr("__dict__"));
|
||||
for (auto it : dict_base) {
|
||||
for (const auto& it : dict_base) {
|
||||
dict_self.setItem(it.first, it.second);
|
||||
}
|
||||
return dict_self;
|
||||
|
||||
@@ -76,7 +76,7 @@ class QT_QTCOLORPICKER_EXPORT QtColorPicker : public QPushButton
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
Q_PROPERTY(bool colorDialog READ colorDialogEnabled WRITE setColorDialogEnabled)
|
||||
Q_PROPERTY(bool colorDialog READ colorDialogEnabled WRITE setColorDialogEnabled) // clazy:exclude=qproperty-without-notify
|
||||
|
||||
public:
|
||||
QtColorPicker(QWidget *parent = nullptr,
|
||||
|
||||
Reference in New Issue
Block a user