forked from qt-creator/qt-creator
QmlDesigner: Use the noexcept interface for optional and unexpected
Optional and unexpected have a interface designed after pointer usage. That cannot throw exceptions. They added continuation too. That is making it harder to make mistakes. Change-Id: Ie9d41a2e69c7467a7e4ac4999825aede1326e529 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -422,7 +422,7 @@ QVariant KeyframeItem::itemChange(QGraphicsItem::GraphicsItemChange change, cons
|
|||||||
rseg.moveLeftTo(position);
|
rseg.moveLeftTo(position);
|
||||||
|
|
||||||
if (legalLeft() && legalRight()) {
|
if (legalLeft() && legalRight()) {
|
||||||
if (qApp->keyboardModifiers().testFlag(Qt::ShiftModifier) && m_validPos.has_value()) {
|
if (qApp->keyboardModifiers().testFlag(Qt::ShiftModifier) && m_validPos) {
|
||||||
if (m_firstPos) {
|
if (m_firstPos) {
|
||||||
auto firstToNow = QLineF(*m_firstPos, position);
|
auto firstToNow = QLineF(*m_firstPos, position);
|
||||||
if (std::abs(firstToNow.dx()) > std::abs(firstToNow.dy()))
|
if (std::abs(firstToNow.dx()) > std::abs(firstToNow.dy()))
|
||||||
|
@@ -284,10 +284,9 @@ void DesignDocument::moveNodesToPosition(const QList<ModelNode> &nodes, const st
|
|||||||
parentProperty.reparentHere(pastedNode);
|
parentProperty.reparentHere(pastedNode);
|
||||||
|
|
||||||
QmlVisualNode visualNode(pastedNode);
|
QmlVisualNode visualNode(pastedNode);
|
||||||
if (!firstVisualNode.has_value() && visualNode.isValid()){
|
if (!firstVisualNode && visualNode) {
|
||||||
firstVisualNode = visualNode;
|
firstVisualNode = visualNode;
|
||||||
translationVect = (position.has_value() && firstVisualNode.has_value())
|
translationVect = (position && firstVisualNode) ? *position - firstVisualNode->position()
|
||||||
? position.value() - firstVisualNode->position()
|
|
||||||
: QVector3D();
|
: QVector3D();
|
||||||
}
|
}
|
||||||
visualNode.translate(translationVect);
|
visualNode.translate(translationVect);
|
||||||
|
@@ -18,7 +18,7 @@ bool couldBeProjectModule(const Utils::FilePath &path, const QString &projectNam
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
const QString expectedLine = QLatin1String("module %1").arg(projectName);
|
const QString expectedLine = QLatin1String("module %1").arg(projectName);
|
||||||
QByteArray fileContents = qmldirContents.value();
|
QByteArray fileContents = *qmldirContents;
|
||||||
QTextStream stream(fileContents);
|
QTextStream stream(fileContents);
|
||||||
while (!stream.atEnd()) {
|
while (!stream.atEnd()) {
|
||||||
QString lineData = stream.readLine().trimmed();
|
QString lineData = stream.readLine().trimmed();
|
||||||
|
@@ -184,8 +184,8 @@ void QmlVisualNode::scatter(const ModelNode &targetNode, const std::optional<int
|
|||||||
if (!scatter)
|
if (!scatter)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (offset.has_value()) { // offset
|
if (offset) { // offset
|
||||||
double offsetValue = offset.value();
|
double offsetValue = *offset;
|
||||||
this->translate(QVector3D(offsetValue, offsetValue, offsetValue));
|
this->translate(QVector3D(offsetValue, offsetValue, offsetValue));
|
||||||
} else { // scatter in range
|
} else { // scatter in range
|
||||||
const double scatterRange = 20.;
|
const double scatterRange = 20.;
|
||||||
|
Reference in New Issue
Block a user