The C++11 initializer list feature.

--HG--
branch : feature
This commit is contained in:
dismine 2014-05-30 12:52:19 +03:00
parent 18307e0a14
commit dce41a864f
8 changed files with 29 additions and 51 deletions

View file

@ -136,8 +136,7 @@ void DialogStandardMeasurements::CheckState()
//---------------------------------------------------------------------------------------------------------------------
void DialogStandardMeasurements::LoadStandardTables()
{
QStringList filters;
filters << "*.vst";
QStringList filters{"*.vst"};
QDir tablesDir(qApp->pathToTables());
tablesDir.setNameFilters(filters);
tablesDir.setCurrent(qApp->pathToTables());

View file

@ -784,9 +784,8 @@ void MainWindow::ToolBarOption()
{
ui->toolBarOption->addWidget(new QLabel(tr("Height: ")));
QStringList list;
list <<"92"<<"98"<<"104"<<"110"<<"116"<<"122"<<"128"<<"134"<<"140"<<"146"<<"152"<<"158"<<"164"<<"170"<<"176"
<<"182"<<"188";
QStringList list{"92", "98", "104", "110", "116", "122", "128", "134", "140", "146", "152", "158", "164", "170",
"176", "182", "188"};
QComboBox *comboBoxHeight = new QComboBox;
comboBoxHeight->addItems(list);
comboBoxHeight->setCurrentIndex(14);//176

View file

@ -228,8 +228,7 @@ void TableWindow::saveScene()
shadowPaper->setVisible(false);
paper->setPen(QPen(Qt::white, 0.1, Qt::NoPen));
QFileInfo fi( name );
QStringList suffix;
suffix << "svg" << "png" << "pdf" << "eps" << "ps";
QStringList suffix{"svg", "png", "pdf", "eps", "ps"};
switch (suffix.indexOf(fi.suffix()))
{
case 0: //svg
@ -510,10 +509,7 @@ void TableWindow::EpsFile(const QString &name) const
if (tmp.open())
{
PdfFile(tmp.fileName());
QStringList params;
params << "-eps" << tmp.fileName() << name;
QStringList params{"-eps", tmp.fileName(), name};
PdfToPs(params);
}
}
@ -525,10 +521,7 @@ void TableWindow::PsFile(const QString &name) const
if (tmp.open())
{
PdfFile(tmp.fileName());
QStringList params;
params << tmp.fileName() << name;
QStringList params{tmp.fileName(), name};
PdfToPs(params);
}
}

View file

@ -309,9 +309,8 @@ void VAbstractTool::LineCoefficients(const QLineF &line, qreal *a, qreal *b, qre
const QStringList VAbstractTool::Styles()
{
//Keep synchronize with DialogTool lineStyles list!!!
QStringList styles;
styles << TypeLineNone << TypeLineLine << TypeLineDashLine << TypeLineDotLine << TypeLineDashDotLine
<< TypeLineDashDotDotLine;
QStringList styles{TypeLineNone, TypeLineLine, TypeLineDashLine, TypeLineDotLine, TypeLineDashDotLine,
TypeLineDashDotDotLine};
return styles;
}

View file

@ -338,8 +338,7 @@ void VDomDocument::setContent(const QString &fileName)
//---------------------------------------------------------------------------------------------------------------------
Valentina::Units VDomDocument::StrToUnits(const QString &unit)
{
QStringList units;
units << UnitMM << UnitCM << UnitINCH;
QStringList units{UnitMM, UnitCM, UnitINCH};
Valentina::Units result = Valentina::Cm;
switch (units.indexOf(unit))
{

View file

@ -305,8 +305,7 @@ QString VIndividualMeasurements::GenderToStr(const VIndividualMeasurements::Gend
//---------------------------------------------------------------------------------------------------------------------
VIndividualMeasurements::Genders VIndividualMeasurements::StrToGender(const QString &sex)
{
QStringList genders;
genders << SexMale << SexFemale;
QStringList genders{SexMale, SexFemale};
switch (genders.indexOf(sex))
{
case 0: // SexMale

View file

@ -214,9 +214,8 @@ void VPattern::Parse(const Document::Documents &parse, VMainGraphicsScene *scene
const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false)
{
QStringList tags;
tags << TagDraw << TagIncrements << TagAuthor << TagDescription << TagNotes << TagMeasurements
<< TagVersion;
QStringList tags{TagDraw, TagIncrements, TagAuthor, TagDescription, TagNotes, TagMeasurements,
TagVersion};
switch (tags.indexOf(domElement.tagName()))
{
case 0: // TagDraw
@ -487,8 +486,7 @@ Valentina::Units VPattern::MUnit() const
QDomElement element = list.at(0).toElement();
if (element.isElement())
{
QStringList units;
units << "mm" << "cm" << "inch";
QStringList units{"mm", "cm", "inch"};
QString unit = GetParametrString(element, AttrUnit);
switch (units.indexOf(unit))
{
@ -520,8 +518,7 @@ Pattern::Measurements VPattern::MType() const
if (element.isElement())
{
QString type = GetParametrString(element, AttrType);
QStringList types;
types << "standard" << "individual";
QStringList types{"standard", "individual"};
switch (types.indexOf(type))
{
case 0:// standard
@ -613,8 +610,7 @@ void VPattern::ParseDrawElement(VMainGraphicsScene *sceneDraw, VMainGraphicsScen
const QDomElement domElement = domNode.toElement();
if (domElement.isNull() == false)
{
QStringList tags;
tags << TagCalculation << TagModeling << TagDetails;
QStringList tags{TagCalculation, TagModeling, TagDetails};
switch (tags.indexOf(domElement.tagName()))
{
case 0: // TagCalculation
@ -659,8 +655,7 @@ void VPattern::ParseDrawMode(VMainGraphicsScene *sceneDraw, VMainGraphicsScene *
QDomElement domElement = nodeList.at(i).toElement();
if (domElement.isNull() == false)
{
QStringList tags;
tags << TagPoint << TagLine << TagSpline << TagArc << TagTools;
QStringList tags{TagPoint, TagLine, TagSpline, TagArc, TagTools};
switch (tags.indexOf(domElement.tagName()))
{
case 0: // TagPoint
@ -719,9 +714,8 @@ void VPattern::ParseDetailElement(VMainGraphicsScene *sceneDetail, const QDomEle
const QString t = GetParametrString(element, AttrType, "NodePoint");
Valentina::Tools tool;
QStringList types;
types << VToolDetail::NodePoint << VToolDetail::NodeArc << VToolDetail::NodeSpline <<
VToolDetail::NodeSplinePath;
QStringList types{VToolDetail::NodePoint, VToolDetail::NodeArc, VToolDetail::NodeSpline,
VToolDetail::NodeSplinePath};
switch (types.indexOf(t))
{
case 0: // VToolDetail::NodePoint
@ -787,12 +781,11 @@ void VPattern::ParsePointElement(VMainGraphicsScene *scene, QDomElement &domElem
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of point is empty");
QStringList points;
points << VToolSinglePoint::ToolType << VToolEndLine::ToolType << VToolAlongLine::ToolType
<< VToolShoulderPoint::ToolType << VToolNormal::ToolType << VToolBisector::ToolType
<< VToolLineIntersect::ToolType << VToolPointOfContact::ToolType << VNodePoint::ToolType
<< VToolHeight::ToolType << VToolTriangle::ToolType << VToolPointOfIntersection::ToolType
<< VToolCutSpline::ToolType << VToolCutSplinePath::ToolType << VToolCutArc::ToolType;
QStringList points{VToolSinglePoint::ToolType, VToolEndLine::ToolType, VToolAlongLine::ToolType,
VToolShoulderPoint::ToolType, VToolNormal::ToolType, VToolBisector::ToolType,
VToolLineIntersect::ToolType, VToolPointOfContact::ToolType, VNodePoint::ToolType,
VToolHeight::ToolType, VToolTriangle::ToolType, VToolPointOfIntersection::ToolType,
VToolCutSpline::ToolType, VToolCutSplinePath::ToolType, VToolCutArc::ToolType};
switch (points.indexOf(type))
{
case 0: //VToolSinglePoint::ToolType
@ -1256,8 +1249,8 @@ void VPattern::ParseSplineElement(VMainGraphicsScene *scene, const QDomElement &
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
QStringList splines;
splines << VToolSpline::ToolType << VToolSplinePath::ToolType << VNodeSpline::ToolType << VNodeSplinePath::ToolType;
QStringList splines{VToolSpline::ToolType, VToolSplinePath::ToolType, VNodeSpline::ToolType,
VNodeSplinePath::ToolType};
switch (splines.indexOf(type))
{
case 0: //VToolSpline::ToolType
@ -1378,8 +1371,7 @@ void VPattern::ParseArcElement(VMainGraphicsScene *scene, const QDomElement &dom
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
QStringList arcs;
arcs << VToolArc::ToolType << VNodeArc::ToolType;
QStringList arcs{VToolArc::ToolType, VNodeArc::ToolType};
switch (arcs.indexOf(type))
{
@ -1442,8 +1434,7 @@ void VPattern::ParseToolsElement(VMainGraphicsScene *scene, const QDomElement &d
Q_ASSERT_X(domElement.isNull() == false, Q_FUNC_INFO, "domElement is null");
Q_ASSERT_X(type.isEmpty() == false, Q_FUNC_INFO, "type of spline is empty");
QStringList tools;
tools << VToolUnionDetails::ToolType;
QStringList tools{VToolUnionDetails::ToolType};
switch (tools.indexOf(type))
{

View file

@ -50,9 +50,8 @@ bool QmuParserBase::g_DbgDumpStack = false;
* When defining custom binary operators with #AddOprt(...) make sure not to choose
* names conflicting with these definitions.
*/
const QStringList QmuParserBase::c_DefaultOprt = QStringList() << "<=" << ">=" << "!=" << "==" << "<" << ">"
<< "+" << "-" << "*" << "/" << "^" << "&&"
<< "||" << "=" << "(" << ")" << "?" << ":";
const QStringList QmuParserBase::c_DefaultOprt{"<=", ">=", "!=", "==", "<", ">", "+", "-", "*", "/", "^", "&&", "||",
"=", "(", ")", "?", ":"};
//---------------------------------------------------------------------------------------------------------------------
/**