Replaced all Qt foreach loops with modern C++ range-based loops. (#277)
This commit is contained in:
@@ -35,7 +35,7 @@ namespace glabels
|
||||
///
|
||||
BarcodeMenu::BarcodeMenu()
|
||||
{
|
||||
foreach ( const barcode::Style& bcStyle, barcode::Backends::styleList() )
|
||||
for ( const barcode::Style& bcStyle : barcode::Backends::styleList() )
|
||||
{
|
||||
if ( bcStyle.backendId() == "" )
|
||||
{
|
||||
@@ -47,11 +47,11 @@ namespace glabels
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( const QString& backendId, barcode::Backends::backendList() )
|
||||
for ( const QString& backendId : barcode::Backends::backendList() )
|
||||
{
|
||||
QMenu* subMenu = addMenu( barcode::Backends::backendName( backendId ) );
|
||||
|
||||
foreach ( const barcode::Style& bcStyle, barcode::Backends::styleList() )
|
||||
for ( const barcode::Style& bcStyle : barcode::Backends::styleList() )
|
||||
{
|
||||
if ( bcStyle.backendId() == backendId )
|
||||
{
|
||||
|
||||
@@ -288,7 +288,7 @@ namespace glabels
|
||||
QList<QColor> colorList = mColorHistory->getColors();
|
||||
|
||||
int id = 0;
|
||||
foreach ( QColor color, colorList )
|
||||
for ( QColor color : colorList )
|
||||
{
|
||||
mHistoryItem[id]->setColor( id, color, nameList[id] );
|
||||
mHistoryItem[id]->setEnabled( true );
|
||||
|
||||
+1
-1
@@ -289,7 +289,7 @@ namespace glabels
|
||||
///
|
||||
void File::exit()
|
||||
{
|
||||
foreach ( QWidget* qwidget, QApplication::topLevelWidgets() )
|
||||
for ( QWidget* qwidget : QApplication::topLevelWidgets() )
|
||||
{
|
||||
if ( auto* window = qobject_cast<MainWindow*>(qwidget) )
|
||||
{
|
||||
|
||||
@@ -1283,7 +1283,7 @@ namespace glabels
|
||||
{
|
||||
painter->save();
|
||||
|
||||
foreach ( model::ModelObject* object, mModel->objectList() )
|
||||
for ( model::ModelObject* object : mModel->objectList() )
|
||||
{
|
||||
if ( object->isSelected() )
|
||||
{
|
||||
|
||||
@@ -138,7 +138,7 @@ namespace glabels
|
||||
similarProductsNullBox->hide();
|
||||
|
||||
QString similarListString;
|
||||
foreach ( QString name, list )
|
||||
for ( QString name : list )
|
||||
{
|
||||
similarListString += name + "\n";
|
||||
}
|
||||
|
||||
@@ -298,7 +298,7 @@ namespace glabels
|
||||
{
|
||||
mCategoryIdList.clear();
|
||||
|
||||
foreach( QCheckBox* check, mCheckList )
|
||||
for ( QCheckBox* check : mCheckList )
|
||||
{
|
||||
if ( check->isChecked() )
|
||||
{
|
||||
|
||||
@@ -211,7 +211,7 @@ namespace glabels
|
||||
else
|
||||
{
|
||||
categoryMask = false;
|
||||
foreach ( QString id, categoryIds )
|
||||
for ( QString id : categoryIds )
|
||||
{
|
||||
categoryMask = categoryMask || tItem->tmplate().hasCategory( id );
|
||||
}
|
||||
@@ -248,7 +248,7 @@ namespace glabels
|
||||
if ( auto* tItem = dynamic_cast<TemplatePickerItem *>( mModel->item( i, 0 ) ) )
|
||||
{
|
||||
bool match = false;
|
||||
foreach ( QString name, names )
|
||||
for ( QString name : names )
|
||||
{
|
||||
if ( tItem->tmplate().name() == name )
|
||||
{
|
||||
|
||||
+1
-1
@@ -112,7 +112,7 @@ int main( int argc, char **argv )
|
||||
// Open each file in its own main window
|
||||
//
|
||||
bool openedFiles = false;
|
||||
foreach ( QString filename, parser.positionalArguments() )
|
||||
for ( QString filename : parser.positionalArguments() )
|
||||
{
|
||||
glabels::model::Model *model = glabels::model::XmlLabelParser::readFile( filename );
|
||||
if ( model )
|
||||
|
||||
Reference in New Issue
Block a user