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);
|
||||
|
||||
if (legalLeft() && legalRight()) {
|
||||
if (qApp->keyboardModifiers().testFlag(Qt::ShiftModifier) && m_validPos.has_value()) {
|
||||
if (qApp->keyboardModifiers().testFlag(Qt::ShiftModifier) && m_validPos) {
|
||||
if (m_firstPos) {
|
||||
auto firstToNow = QLineF(*m_firstPos, position);
|
||||
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);
|
||||
|
||||
QmlVisualNode visualNode(pastedNode);
|
||||
if (!firstVisualNode.has_value() && visualNode.isValid()){
|
||||
if (!firstVisualNode && visualNode) {
|
||||
firstVisualNode = visualNode;
|
||||
translationVect = (position.has_value() && firstVisualNode.has_value())
|
||||
? position.value() - firstVisualNode->position()
|
||||
translationVect = (position && firstVisualNode) ? *position - firstVisualNode->position()
|
||||
: QVector3D();
|
||||
}
|
||||
visualNode.translate(translationVect);
|
||||
|
@@ -18,7 +18,7 @@ bool couldBeProjectModule(const Utils::FilePath &path, const QString &projectNam
|
||||
return false;
|
||||
|
||||
const QString expectedLine = QLatin1String("module %1").arg(projectName);
|
||||
QByteArray fileContents = qmldirContents.value();
|
||||
QByteArray fileContents = *qmldirContents;
|
||||
QTextStream stream(fileContents);
|
||||
while (!stream.atEnd()) {
|
||||
QString lineData = stream.readLine().trimmed();
|
||||
|
@@ -184,8 +184,8 @@ void QmlVisualNode::scatter(const ModelNode &targetNode, const std::optional<int
|
||||
if (!scatter)
|
||||
return;
|
||||
|
||||
if (offset.has_value()) { // offset
|
||||
double offsetValue = offset.value();
|
||||
if (offset) { // offset
|
||||
double offsetValue = *offset;
|
||||
this->translate(QVector3D(offsetValue, offsetValue, offsetValue));
|
||||
} else { // scatter in range
|
||||
const double scatterRange = 20.;
|
||||
|
Reference in New Issue
Block a user