Commit 88de3bb2 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

QmlDesigner: Avoid repetitive calls



Change-Id: Id33e46f925c94a970b001e7f34b7deb56224cc97
Reviewed-by: default avatarMarco Bubke <marco.bubke@digia.com>
parent caf29650
...@@ -90,14 +90,15 @@ ResizeControllerData::ResizeControllerData(const ResizeControllerData &other) ...@@ -90,14 +90,15 @@ ResizeControllerData::ResizeControllerData(const ResizeControllerData &other)
ResizeControllerData::~ResizeControllerData() ResizeControllerData::~ResizeControllerData()
{ {
if (layerItem) { if (layerItem) {
layerItem->scene()->removeItem(topLeftItem.data()); QGraphicsScene *scene = layerItem->scene();
layerItem->scene()->removeItem(topRightItem.data()); scene->removeItem(topLeftItem.data());
layerItem->scene()->removeItem(bottomLeftItem.data()); scene->removeItem(topRightItem.data());
layerItem->scene()->removeItem(bottomRightItem.data()); scene->removeItem(bottomLeftItem.data());
layerItem->scene()->removeItem(topItem.data()); scene->removeItem(bottomRightItem.data());
layerItem->scene()->removeItem(leftItem.data()); scene->removeItem(topItem.data());
layerItem->scene()->removeItem(rightItem.data()); scene->removeItem(leftItem.data());
layerItem->scene()->removeItem(bottomItem.data()); scene->removeItem(rightItem.data());
scene->removeItem(bottomItem.data());
} }
} }
......
...@@ -173,15 +173,18 @@ void ShortCutManager::updateActions(Core::IEditor* currentEditor) ...@@ -173,15 +173,18 @@ void ShortCutManager::updateActions(Core::IEditor* currentEditor)
{ {
int openedCount = Core::DocumentModel::documentCount(); int openedCount = Core::DocumentModel::documentCount();
m_saveAction.setEnabled(currentEditor != 0 && currentEditor->document()->isModified()); Core::IDocument *document = 0;
m_saveAsAction.setEnabled(currentEditor != 0 && currentEditor->document()->isSaveAsAllowed()); if (currentEditor)
m_revertToSavedAction.setEnabled(currentEditor != 0 document = currentEditor->document();
&& !currentEditor->document()->filePath().isEmpty() m_saveAction.setEnabled(document && document->isModified());
&& currentEditor->document()->isModified()); m_saveAsAction.setEnabled(document && document->isSaveAsAllowed());
m_revertToSavedAction.setEnabled(document
&& !document->filePath().isEmpty()
&& document->isModified());
QString quotedName; QString quotedName;
if (currentEditor) if (currentEditor)
quotedName = '"' + currentEditor->document()->displayName() + '"'; quotedName = '"' + document->displayName() + '"';
m_saveAsAction.setText(tr("Save %1 As...").arg(quotedName)); m_saveAsAction.setText(tr("Save %1 As...").arg(quotedName));
m_saveAction.setText(tr("&Save %1").arg(quotedName)); m_saveAction.setText(tr("&Save %1").arg(quotedName));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment