@@ -109,7 +109,7 @@ ExtendedTableWidget::ExtendedTableWidget(QWidget* parent) :
109109 useAsFilter ();
110110 });
111111 connect (nullAction, &QAction::triggered, [&]() {
112- foreach (const QModelIndex& index, selectedIndexes ())
112+ for (const QModelIndex& index : selectedIndexes ())
113113 model ()->setData (index, QVariant ());
114114 });
115115 connect (copyAction, &QAction::triggered, [&]() {
@@ -172,11 +172,13 @@ void ExtendedTableWidget::copy()
172172
173173 // If any of the cells contain binary data - we use inner buffer
174174 bool containsBinary = false ;
175- foreach (const QModelIndex& index, indices)
175+ for (const QModelIndex& index : indices)
176+ {
176177 if (m->isBinary (index)) {
177178 containsBinary = true ;
178179 break ;
179180 }
181+ }
180182
181183 if (containsBinary) {
182184 qApp->clipboard ()->clear ();
@@ -198,7 +200,7 @@ void ExtendedTableWidget::copy()
198200 QString result;
199201 int currentRow = 0 ;
200202
201- foreach (const QModelIndex& index, indices) {
203+ for (const QModelIndex& index : indices) {
202204 if (first == index) { /* first index */ }
203205 else if (index.row () != currentRow)
204206 result.append (" \r\n " );
@@ -259,9 +261,9 @@ void ExtendedTableWidget::paste()
259261
260262 int row = firstRow;
261263
262- foreach (const QByteArrayList& lst, m_buffer) {
264+ for (const QByteArrayList& lst : m_buffer) {
263265 int column = firstColumn;
264- foreach (const QByteArray& ba, lst) {
266+ for (const QByteArray& ba : lst) {
265267 m->setData (m->index (row, column), ba);
266268
267269 column++;
@@ -315,10 +317,10 @@ void ExtendedTableWidget::paste()
315317 int lastColumn = qMin (firstColumn + clipboardColumns - 1 , m->columnCount () - 1 );
316318
317319 int row = firstRow;
318- foreach (const QStringList& clipboardRow, clipboardTable)
320+ for (const QStringList& clipboardRow : clipboardTable)
319321 {
320322 int column = firstColumn;
321- foreach (const QString& cell, clipboardRow)
323+ for (const QString& cell : clipboardRow)
322324 {
323325 if (cell.isEmpty ())
324326 m->setData (m->index (row, column), QVariant ());
@@ -383,11 +385,11 @@ void ExtendedTableWidget::keyPressEvent(QKeyEvent* event)
383385 if (event->modifiers ().testFlag (Qt::AltModifier))
384386 {
385387 // When pressing Alt+Delete set the value to NULL
386- foreach (const QModelIndex& index, selectedIndexes ())
388+ for (const QModelIndex& index : selectedIndexes ())
387389 model ()->setData (index, QVariant ());
388390 } else {
389391 // When pressing Delete only set the value to empty string
390- foreach (const QModelIndex& index, selectedIndexes ())
392+ for (const QModelIndex& index : selectedIndexes ())
391393 model ()->setData (index, " " );
392394 }
393395 } else if (event->modifiers ().testFlag (Qt::ControlModifier) && (event->key () == Qt::Key_PageUp || event->key () == Qt::Key_PageDown)) {
@@ -442,7 +444,7 @@ int ExtendedTableWidget::numVisibleRows()
442444QSet<int > ExtendedTableWidget::selectedCols ()
443445{
444446 QSet<int > selectedCols;
445- foreach (const QModelIndex & idx, selectedIndexes ())
447+ for (const QModelIndex & idx : selectedIndexes ())
446448 selectedCols.insert (idx.column ());
447449 return selectedCols;
448450}
0 commit comments