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:
wmayer
2022-07-25 11:23:27 +02:00
parent 96ac382805
commit e2f1452cb8
5 changed files with 15 additions and 15 deletions

View File

@@ -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++;