forked from qt-creator/qt-creator
QmlDesigner: Compile fix: More Java-style iterator removal
We use QT_NO_JAVA_STYLE_ITERATORS, and Qt dev has wrapped more iterators with that, so without this patch (or undefining QT_NO_JAVA_STYLE_ITERATORS) creator does not compile. Change-Id: I7d3ef0ed11db72e07333e21311725cd13136696a Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io> Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
@@ -181,9 +181,9 @@ QPointF MoveManipulator::findSnappingOffset(const QHash<FormEditorItem*, QRectF>
|
||||
QMap<double, double> verticalOffsetMap;
|
||||
QMap<double, double> horizontalOffsetMap;
|
||||
|
||||
QHashIterator<FormEditorItem*, QRectF> hashIterator(boundingRectHash);
|
||||
while (hashIterator.hasNext()) {
|
||||
hashIterator.next();
|
||||
for (auto hashIterator = boundingRectHash.cbegin(), end = boundingRectHash.cend();
|
||||
hashIterator != end;
|
||||
++hashIterator) {
|
||||
FormEditorItem *formEditorItem = hashIterator.key();
|
||||
QRectF boundingRect = hashIterator.value();
|
||||
|
||||
@@ -230,10 +230,10 @@ QHash<FormEditorItem*, QRectF> MoveManipulator::tanslatedBoundingRects(const QHa
|
||||
{
|
||||
QHash<FormEditorItem*, QRectF> translatedBoundingRectHash;
|
||||
|
||||
QHashIterator<FormEditorItem*, QRectF> hashIterator(boundingRectHash);
|
||||
while (hashIterator.hasNext()) {
|
||||
for (auto hashIterator = boundingRectHash.cbegin(), end = boundingRectHash.cend();
|
||||
hashIterator != end;
|
||||
++hashIterator) {
|
||||
QPointF alignedOffset(offsetVector);
|
||||
hashIterator.next();
|
||||
FormEditorItem *formEditorItem = hashIterator.key();
|
||||
QRectF boundingRect = transform.mapRect(hashIterator.value());
|
||||
|
||||
|
@@ -42,19 +42,14 @@ ResizeIndicator::~ResizeIndicator()
|
||||
|
||||
void ResizeIndicator::show()
|
||||
{
|
||||
QHashIterator<FormEditorItem*, ResizeController> itemControllerIterator(m_itemControllerHash);
|
||||
while (itemControllerIterator.hasNext()) {
|
||||
ResizeController controller = itemControllerIterator.next().value();
|
||||
for (ResizeController controller : m_itemControllerHash)
|
||||
controller.show();
|
||||
}
|
||||
}
|
||||
|
||||
void ResizeIndicator::hide()
|
||||
{
|
||||
QHashIterator<FormEditorItem*, ResizeController> itemControllerIterator(m_itemControllerHash);
|
||||
while (itemControllerIterator.hasNext()) {
|
||||
ResizeController controller = itemControllerIterator.next().value();
|
||||
for (ResizeController controller : m_itemControllerHash)
|
||||
controller.hide();
|
||||
}
|
||||
}
|
||||
|
||||
void ResizeIndicator::clear()
|
||||
|
@@ -311,9 +311,9 @@ QList<QLineF> Snapper::findSnappingLines(const SnapLineMap &snappingLineMap,
|
||||
{
|
||||
QList<QLineF> lineList;
|
||||
|
||||
SnapLineMapIterator snappingLineIterator(snappingLineMap);
|
||||
while (snappingLineIterator.hasNext()) {
|
||||
snappingLineIterator.next();
|
||||
for (auto snappingLineIterator = snappingLineMap.cbegin(), end = snappingLineMap.cend();
|
||||
snappingLineIterator != end;
|
||||
++snappingLineIterator) {
|
||||
|
||||
if (compareLines(snapLine, snappingLineIterator.key())) { // near distance snapping lines
|
||||
lineList += createSnapLine(orientation,
|
||||
@@ -339,9 +339,9 @@ QList<QLineF> Snapper::findSnappingOffsetLines(const SnapLineMap &snappingOffset
|
||||
{
|
||||
QList<QLineF> lineList;
|
||||
|
||||
SnapLineMapIterator snappingOffsetIterator(snappingOffsetMap);
|
||||
while (snappingOffsetIterator.hasNext()) {
|
||||
snappingOffsetIterator.next();
|
||||
for (auto snappingOffsetIterator = snappingOffsetMap.cbegin(), end = snappingOffsetMap.cend();
|
||||
snappingOffsetIterator != end;
|
||||
++snappingOffsetIterator) {
|
||||
|
||||
const QRectF &formEditorItemRect(snappingOffsetIterator.value().first);
|
||||
double formEditorItemRectLowerLimit;
|
||||
@@ -377,9 +377,9 @@ double Snapper::snappedOffsetForLines(const SnapLineMap &snappingLineMap,
|
||||
{
|
||||
QMultiMap<double, double> minimumSnappingLineMap;
|
||||
|
||||
SnapLineMapIterator snappingLineIterator(snappingLineMap);
|
||||
while (snappingLineIterator.hasNext()) {
|
||||
snappingLineIterator.next();
|
||||
for (auto snappingLineIterator = snappingLineMap.cbegin(), end = snappingLineMap.cend();
|
||||
snappingLineIterator != end;
|
||||
++snappingLineIterator) {
|
||||
double snapLine = snappingLineIterator.key();
|
||||
double offset = value - snapLine;
|
||||
double distance = qAbs(offset);
|
||||
@@ -403,9 +403,9 @@ double Snapper::snappedOffsetForOffsetLines(const SnapLineMap &snappingOffsetMap
|
||||
{
|
||||
QMultiMap<double, double> minimumSnappingLineMap;
|
||||
|
||||
SnapLineMapIterator snappingOffsetIterator(snappingOffsetMap);
|
||||
while (snappingOffsetIterator.hasNext()) {
|
||||
snappingOffsetIterator.next();
|
||||
for (auto snappingOffsetIterator = snappingOffsetMap.cbegin(), end = snappingOffsetMap.cend();
|
||||
snappingOffsetIterator != end;
|
||||
++snappingOffsetIterator) {
|
||||
double snapLine = snappingOffsetIterator.key();
|
||||
const QRectF &formEditorItemRect(snappingOffsetIterator.value().first);
|
||||
double formEditorItemRectLowerLimit;
|
||||
@@ -492,13 +492,12 @@ static QList<QLineF> mergedHorizontalLines(const QList<QLineF> &lineList)
|
||||
});
|
||||
|
||||
QList<QLineF> lineWithTheSameY;
|
||||
QListIterator<QLineF> sortedLineListIterator(sortedLineList);
|
||||
while (sortedLineListIterator.hasNext()) {
|
||||
QLineF line = sortedLineListIterator.next();
|
||||
for (int i = 0, n = sortedLineList.size(); i < n; ++i) {
|
||||
QLineF line = sortedLineList.at(i);
|
||||
lineWithTheSameY.append(line);
|
||||
|
||||
if (sortedLineListIterator.hasNext()) {
|
||||
QLineF nextLine = sortedLineListIterator.peekNext();
|
||||
if (i + 1 < n) {
|
||||
QLineF nextLine = sortedLineList.at(i + 1);
|
||||
if (!qFuzzyCompare(line.y1(), nextLine.y1())) {
|
||||
mergedLineList.append(mergedHorizontalLine(lineWithTheSameY));
|
||||
lineWithTheSameY.clear();
|
||||
@@ -521,13 +520,12 @@ static QList<QLineF> mergedVerticalLines(const QList<QLineF> &lineList)
|
||||
});
|
||||
|
||||
QList<QLineF> lineWithTheSameX;
|
||||
QListIterator<QLineF> sortedLineListIterator(sortedLineList);
|
||||
while (sortedLineListIterator.hasNext()) {
|
||||
QLineF line = sortedLineListIterator.next();
|
||||
for (int i = 0, n = sortedLineList.size(); i < n; ++i) {
|
||||
QLineF line = sortedLineList.at(i);
|
||||
lineWithTheSameX.append(line);
|
||||
|
||||
if (sortedLineListIterator.hasNext()) {
|
||||
QLineF nextLine = sortedLineListIterator.peekNext();
|
||||
if (i + 1 < n) {
|
||||
QLineF nextLine = sortedLineList.at(i + 1);
|
||||
if (!qFuzzyCompare(line.x1(), nextLine.x1())) {
|
||||
mergedLineList.append(mergedVerticalLine(lineWithTheSameX));
|
||||
lineWithTheSameX.clear();
|
||||
@@ -565,9 +563,9 @@ static QmlItemNode findItemOnSnappingLine(const QmlItemNode &sourceQmlItemNode,
|
||||
else
|
||||
compareAnchorLineType = AnchorLineLeft;
|
||||
|
||||
SnapLineMapIterator snapLineIterator(snappingLines);
|
||||
while (snapLineIterator.hasNext()) {
|
||||
snapLineIterator.next();
|
||||
for (auto snapLineIterator = snappingLines.cbegin(), end = snappingLines.cend();
|
||||
snapLineIterator != end;
|
||||
++snapLineIterator) {
|
||||
double snapLine = snapLineIterator.key();
|
||||
|
||||
if (qAbs(snapLine - anchorLine ) < 1.0) {
|
||||
|
@@ -32,7 +32,6 @@ namespace QmlDesigner {
|
||||
class FormEditorItem;
|
||||
|
||||
using SnapLineMap = QMultiMap<double, QPair<QRectF, FormEditorItem*> >;
|
||||
using SnapLineMapIterator = QMapIterator<double, QPair<QRectF, FormEditorItem*> >;
|
||||
|
||||
class FormEditorItem;
|
||||
|
||||
|
@@ -104,9 +104,9 @@ void PathItem::writeCubicPath(const ModelNode &pathNode, const CubicSegment &cub
|
||||
|
||||
void PathItem::writePathAttributes(const ModelNode &pathNode, const QMap<QString, QVariant> &attributes)
|
||||
{
|
||||
QMapIterator<QString, QVariant> attributesIterator(attributes);
|
||||
while (attributesIterator.hasNext()) {
|
||||
attributesIterator.next();
|
||||
for (auto attributesIterator = attributes.cbegin(), end = attributes.cend();
|
||||
attributesIterator != end;
|
||||
++attributesIterator) {
|
||||
QList<QPair<PropertyName, QVariant> > propertyList;
|
||||
propertyList.append(PropertyPair("name", attributesIterator.key()));
|
||||
propertyList.append(PropertyPair("value", attributesIterator.value()));
|
||||
|
@@ -204,8 +204,8 @@ void NodeInstanceView::modelAboutToBeDetached(Model * model)
|
||||
|
||||
void NodeInstanceView::handleCrash()
|
||||
{
|
||||
int elaspsedTimeSinceLastCrash = m_lastCrashTime.restart();
|
||||
int forceRestartTime = 2000;
|
||||
qint64 elaspsedTimeSinceLastCrash = m_lastCrashTime.restart();
|
||||
qint64 forceRestartTime = 2000;
|
||||
#ifdef QT_DEBUG
|
||||
forceRestartTime = 4000;
|
||||
#endif
|
||||
@@ -816,9 +816,10 @@ CreateSceneCommand NodeInstanceView::createCreateSceneCommand()
|
||||
bindingPropertyList.append(node.bindingProperties());
|
||||
if (node.isValid() && hasInstanceForModelNode(node)) {
|
||||
NodeInstance instance = instanceForModelNode(node);
|
||||
QHashIterator<PropertyName, QVariant> auxiliaryIterator(node.auxiliaryData());
|
||||
while (auxiliaryIterator.hasNext()) {
|
||||
auxiliaryIterator.next();
|
||||
const QHash<PropertyName, QVariant> aux = node.auxiliaryData();
|
||||
for (auto auxiliaryIterator = aux.cbegin(), end = aux.cend();
|
||||
auxiliaryIterator != end;
|
||||
++auxiliaryIterator) {
|
||||
PropertyValueContainer container(instance.instanceId(), auxiliaryIterator.key(), auxiliaryIterator.value(), TypeName());
|
||||
auxiliaryContainerVector.append(container);
|
||||
}
|
||||
|
@@ -502,11 +502,8 @@ QMultiHash<ModelNode, InformationName> convertModelNodeInformationHash(const QMu
|
||||
{
|
||||
QMultiHash<ModelNode, InformationName> convertedModelNodeInformationHash;
|
||||
|
||||
QHashIterator<ModelNode, InformationName> hashIterator(informationChangeHash);
|
||||
while (hashIterator.hasNext()) {
|
||||
hashIterator.next();
|
||||
convertedModelNodeInformationHash.insert(ModelNode(hashIterator.key(), view), hashIterator.value());
|
||||
}
|
||||
for (auto it = informationChangeHash.cbegin(), end = informationChangeHash.cend(); it != end; ++it)
|
||||
convertedModelNodeInformationHash.insert(ModelNode(it.key(), view), it.value());
|
||||
|
||||
return convertedModelNodeInformationHash;
|
||||
}
|
||||
|
@@ -37,9 +37,7 @@ void ModelNodePositionStorage::cleanupInvalidOffsets()
|
||||
{
|
||||
QHash<ModelNode, RewriterData> validModelNodes;
|
||||
|
||||
QHashIterator<ModelNode, RewriterData> iter(m_rewriterData);
|
||||
while (iter.hasNext()) {
|
||||
iter.next();
|
||||
for (auto iter = m_rewriterData.cbegin(), end = m_rewriterData.cend(); iter != end; ++iter) {
|
||||
const ModelNode modelNode = iter.key();
|
||||
if (modelNode.isValid())
|
||||
validModelNodes.insert(modelNode, iter.value());
|
||||
|
@@ -67,10 +67,8 @@ void RewriteActionCompressor::compressImports(QList<RewriteAction *> &actions) c
|
||||
QHash<Import, RewriteAction *> addedImports;
|
||||
QHash<Import, RewriteAction *> removedImports;
|
||||
|
||||
QMutableListIterator<RewriteAction *> iter(actions);
|
||||
iter.toBack();
|
||||
while (iter.hasPrevious()) {
|
||||
RewriteAction *action = iter.previous();
|
||||
for (int i = actions.size(); --i >= 0; ) {
|
||||
RewriteAction *action = actions.at(i);
|
||||
|
||||
if (RemoveImportRewriteAction *removeImportAction = action->asRemoveImportRewriteAction()) {
|
||||
const Import import = removeImportAction->import();
|
||||
@@ -113,10 +111,8 @@ void RewriteActionCompressor::compressRereparentActions(QList<RewriteAction *> &
|
||||
QList<RewriteAction *> actionsToRemove;
|
||||
QHash<ModelNode, ReparentNodeRewriteAction *> reparentedNodes;
|
||||
|
||||
QMutableListIterator<RewriteAction*> iter(actions);
|
||||
iter.toBack();
|
||||
while (iter.hasPrevious()) {
|
||||
RewriteAction *action = iter.previous();
|
||||
for (int i = actions.size(); --i >= 0; ) {
|
||||
RewriteAction *action = actions.at(i);
|
||||
|
||||
if (ReparentNodeRewriteAction *reparentAction = action->asReparentNodeRewriteAction()) {
|
||||
const ModelNode reparentedNode = reparentAction->reparentedNode();
|
||||
@@ -139,10 +135,9 @@ void RewriteActionCompressor::compressRereparentActions(QList<RewriteAction *> &
|
||||
void RewriteActionCompressor::compressReparentIntoSamePropertyActions(QList<RewriteAction *> &actions) const
|
||||
{
|
||||
QList<RewriteAction *> actionsToRemove;
|
||||
QMutableListIterator<RewriteAction *> iter(actions);
|
||||
iter.toBack();
|
||||
while (iter.hasPrevious()) {
|
||||
RewriteAction *action = iter.previous();
|
||||
|
||||
for (int i = actions.size(); --i >= 0; ) {
|
||||
RewriteAction *action = actions.at(i);
|
||||
|
||||
if (ReparentNodeRewriteAction *reparentAction = action->asReparentNodeRewriteAction()) {
|
||||
if (reparentAction->targetProperty() == reparentAction->oldParentProperty())
|
||||
@@ -161,10 +156,8 @@ void RewriteActionCompressor::compressAddEditRemoveNodeActions(QList<RewriteActi
|
||||
QList<RewriteAction *> actionsToRemove;
|
||||
QHash<ModelNode, RewriteAction *> removedNodes;
|
||||
|
||||
QMutableListIterator<RewriteAction*> iter(actions);
|
||||
iter.toBack();
|
||||
while (iter.hasPrevious()) {
|
||||
RewriteAction *action = iter.previous();
|
||||
for (int i = actions.size(); --i >= 0; ) {
|
||||
RewriteAction *action = actions.at(i);
|
||||
|
||||
if (RemoveNodeRewriteAction *removeNodeAction = action->asRemoveNodeRewriteAction()) {
|
||||
const ModelNode modelNode = removeNodeAction->node();
|
||||
@@ -220,10 +213,8 @@ void RewriteActionCompressor::compressPropertyActions(QList<RewriteAction *> &ac
|
||||
QHash<AbstractProperty, ChangePropertyRewriteAction *> changedProperties;
|
||||
QHash<AbstractProperty, AddPropertyRewriteAction *> addedProperties;
|
||||
|
||||
QMutableListIterator<RewriteAction*> iter(actions);
|
||||
iter.toBack();
|
||||
while (iter.hasPrevious()) {
|
||||
RewriteAction *action = iter.previous();
|
||||
for (int i = actions.size(); --i >= 0; ) {
|
||||
RewriteAction *action = actions.at(i);
|
||||
|
||||
if (RemovePropertyRewriteAction *removeAction = action->asRemovePropertyRewriteAction()) {
|
||||
const AbstractProperty property = removeAction->property();
|
||||
@@ -271,10 +262,7 @@ void RewriteActionCompressor::compressAddEditActions(QList<RewriteAction *> &act
|
||||
QSet<ModelNode> addedNodes;
|
||||
QSet<RewriteAction *> dirtyActions;
|
||||
|
||||
QMutableListIterator<RewriteAction*> iter(actions);
|
||||
while (iter.hasNext()) {
|
||||
RewriteAction *action = iter.next();
|
||||
|
||||
for (RewriteAction *action : qAsConst(actions)) {
|
||||
if (action->asAddPropertyRewriteAction() || action->asChangePropertyRewriteAction()) {
|
||||
AbstractProperty property;
|
||||
ModelNode containedNode;
|
||||
@@ -343,10 +331,8 @@ void RewriteActionCompressor::compressAddReparentActions(QList<RewriteAction *>
|
||||
QList<RewriteAction *> actionsToRemove;
|
||||
QMap<ModelNode, RewriteAction*> addedNodes;
|
||||
|
||||
QMutableListIterator<RewriteAction*> iter(actions);
|
||||
while (iter.hasNext()) {
|
||||
RewriteAction *action = iter.next();
|
||||
|
||||
for (int i = 0, n = actions.size(); i < n; ++i) {
|
||||
RewriteAction *action = actions.at(i);
|
||||
if (action->asAddPropertyRewriteAction() || action->asChangePropertyRewriteAction()) {
|
||||
ModelNode containedNode;
|
||||
|
||||
@@ -377,7 +363,7 @@ void RewriteActionCompressor::compressAddReparentActions(QList<RewriteAction *>
|
||||
changeAction->containedModelNode());
|
||||
}
|
||||
|
||||
iter.setValue(replacementAction);
|
||||
actions[i] = replacementAction;
|
||||
delete action;
|
||||
}
|
||||
}
|
||||
|
@@ -96,9 +96,9 @@ static inline void applyProperties(ModelNode &node, const QHash<PropertyName, QV
|
||||
node.setAuxiliaryData(propertyName, QVariant());
|
||||
}
|
||||
|
||||
QHashIterator<PropertyName, QVariant> propertyIterator(propertyHash);
|
||||
while (propertyIterator.hasNext()) {
|
||||
propertyIterator.next();
|
||||
for (auto propertyIterator = propertyHash.cbegin(), end = propertyHash.cend();
|
||||
propertyIterator != end;
|
||||
++propertyIterator) {
|
||||
const PropertyName propertyName = propertyIterator.key();
|
||||
if (propertyName == "width" || propertyName == "height") {
|
||||
node.setAuxiliaryData(propertyIterator.key(), propertyIterator.value());
|
||||
|
Reference in New Issue
Block a user