QmlDesigner: Remove warning widget from DesignModeWidget

The form editor is now handling even initial warnings.
There is no need for an extra warning widget in the DesignModeWidget.

Change-Id: Iac85c1968e8040ee5f11435fa2876ce2d152c194
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
Thomas Hartmann
2017-03-24 12:27:19 +01:00
parent acd08f24b8
commit ddad6866eb
3 changed files with 1 additions and 51 deletions

View File

@@ -199,7 +199,7 @@ void DesignModeWidget::enableWidgets()
{ {
if (debug) if (debug)
qDebug() << Q_FUNC_INFO; qDebug() << Q_FUNC_INFO;
hideWarningWidget();
viewManager().enableWidgets(); viewManager().enableWidgets();
m_isDisabled = false; m_isDisabled = false;
} }
@@ -221,20 +221,6 @@ void DesignModeWidget::switchTextOrForm()
m_centralTabWidget->switchTo(viewManager().widget("TextEditor")); m_centralTabWidget->switchTo(viewManager().widget("TextEditor"));
} }
void DesignModeWidget::showWarningMessageBox(const QList<DocumentMessage> &warnings)
{
Q_ASSERT(!warnings.isEmpty());
warningWidget()->setWarnings(warnings);
warningWidget()->setVisible(true);
}
bool DesignModeWidget::gotoCodeWasClicked()
{
if (m_warningWidget)
return warningWidget()->gotoCodeWasClicked();
return false;
}
static void hideToolButtons(QList<QToolButton*> &buttons) static void hideToolButtons(QList<QToolButton*> &buttons)
{ {
foreach (QToolButton *button, buttons) foreach (QToolButton *button, buttons)
@@ -528,28 +514,6 @@ QWidget *DesignModeWidget::createCrumbleBarFrame()
return frame; return frame;
} }
DocumentWarningWidget *DesignModeWidget::warningWidget()
{
if (m_warningWidget.isNull()) {
m_warningWidget = new DocumentWarningWidget(this);
connect(m_warningWidget.data(), &DocumentWarningWidget::gotoCodeClicked, [=]
(const QString &filePath, int codeLine, int codeColumn) {
Q_UNUSED(filePath);
if (currentDesignDocument() && currentDesignDocument()->textEditor())
currentDesignDocument()->textEditor()->gotoLine(codeLine, codeColumn);
Core::ModeManager::activateMode(Core::Constants::MODE_EDIT);
});
}
return m_warningWidget;
}
void DesignModeWidget::hideWarningWidget()
{
if (m_warningWidget)
m_warningWidget->setVisible(false);
}
CrumbleBar *DesignModeWidget::crumbleBar() const CrumbleBar *DesignModeWidget::crumbleBar() const
{ {
return m_crumbleBar; return m_crumbleBar;

View File

@@ -78,9 +78,6 @@ public:
void disableWidgets(); void disableWidgets();
void switchTextOrForm(); void switchTextOrForm();
void showWarningMessageBox(const QList<DocumentMessage> &warnings);
bool gotoCodeWasClicked();
CrumbleBar* crumbleBar() const; CrumbleBar* crumbleBar() const;
void showInternalTextEditor(); void showInternalTextEditor();
@@ -100,12 +97,9 @@ private: // functions
void addNavigatorHistoryEntry(const Utils::FileName &fileName); void addNavigatorHistoryEntry(const Utils::FileName &fileName);
QWidget *createCenterWidget(); QWidget *createCenterWidget();
QWidget *createCrumbleBarFrame(); QWidget *createCrumbleBarFrame();
DocumentWarningWidget *warningWidget();
void hideWarningWidget();
private: // variables private: // variables
QSplitter *m_mainSplitter = nullptr; QSplitter *m_mainSplitter = nullptr;
QPointer<DocumentWarningWidget> m_warningWidget;
SwitchSplitTabWidget* m_centralTabWidget = nullptr; SwitchSplitTabWidget* m_centralTabWidget = nullptr;
QScopedPointer<Core::SideBar> m_leftSideBar; QScopedPointer<Core::SideBar> m_leftSideBar;

View File

@@ -329,13 +329,7 @@ void QmlDesignerPlugin::showDesigner()
void QmlDesignerPlugin::hideDesigner() void QmlDesignerPlugin::hideDesigner()
{ {
if (currentDesignDocument() && currentModel()) {
// the message box handle the cursor jump itself
}
if (d->documentManager.hasCurrentDesignDocument()) { if (d->documentManager.hasCurrentDesignDocument()) {
if (currentModel() && !mainWidget()->gotoCodeWasClicked())
jumpTextCursorToSelectedModelNode();
deactivateAutoSynchronization(); deactivateAutoSynchronization();
d->mainWidget->saveSettings(); d->mainWidget->saveSettings();
} }
@@ -417,8 +411,6 @@ void QmlDesignerPlugin::activateAutoSynchronization()
selectModelNodeUnderTextCursor(); selectModelNodeUnderTextCursor();
d->mainWidget->setupNavigatorHistory(currentDesignDocument()->textEditor()); d->mainWidget->setupNavigatorHistory(currentDesignDocument()->textEditor());
if (showWarningsForFeaturesInDesigner() && currentDesignDocument()->hasQmlParseWarnings())
d->mainWidget->showWarningMessageBox(currentDesignDocument()->qmlParseWarnings());
currentDesignDocument()->updateSubcomponentManager(); currentDesignDocument()->updateSubcomponentManager();
} }