forked from qt-creator/qt-creator
Remove parent argument from IEditor constructor
Editors are owned by whoever created them via the corresponding editor factory, usually the EditorManager. Change-Id: I4432eab1a3a8c38ce1bba6bb10b0f9273695a524 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -38,7 +38,7 @@ using namespace Android;
|
|||||||
using namespace Internal;
|
using namespace Internal;
|
||||||
|
|
||||||
AndroidManifestEditor::AndroidManifestEditor(AndroidManifestEditorWidget *editorWidget)
|
AndroidManifestEditor::AndroidManifestEditor(AndroidManifestEditorWidget *editorWidget)
|
||||||
: Core::IEditor(editorWidget), m_toolBar(nullptr)
|
: m_toolBar(nullptr)
|
||||||
{
|
{
|
||||||
m_toolBar = new QToolBar(editorWidget);
|
m_toolBar = new QToolBar(editorWidget);
|
||||||
m_actionGroup = new QActionGroup(this);
|
m_actionGroup = new QActionGroup(this);
|
||||||
|
@@ -103,8 +103,8 @@ namespace Core {
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
*/
|
*/
|
||||||
IEditor::IEditor(QObject *parent)
|
IEditor::IEditor()
|
||||||
: IContext(parent), m_duplicateSupported(false)
|
: m_duplicateSupported(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
@@ -39,7 +39,7 @@ class CORE_EXPORT IEditor : public IContext
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
IEditor(QObject *parent = nullptr);
|
IEditor();
|
||||||
|
|
||||||
bool duplicateSupported() const;
|
bool duplicateSupported() const;
|
||||||
void setDuplicateSupported(bool duplicateSupported);
|
void setDuplicateSupported(bool duplicateSupported);
|
||||||
|
@@ -75,17 +75,15 @@ static bool updateButtonIconByTheme(QAbstractButton *button, const QString &name
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageViewer::ImageViewer(QWidget *parent)
|
ImageViewer::ImageViewer()
|
||||||
: IEditor(parent),
|
: d(new ImageViewerPrivate)
|
||||||
d(new ImageViewerPrivate)
|
|
||||||
{
|
{
|
||||||
d->file.reset(new ImageViewerFile);
|
d->file.reset(new ImageViewerFile);
|
||||||
ctor();
|
ctor();
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageViewer::ImageViewer(const QSharedPointer<ImageViewerFile> &document, QWidget *parent)
|
ImageViewer::ImageViewer(const QSharedPointer<ImageViewerFile> &document)
|
||||||
: IEditor(parent),
|
: d(new ImageViewerPrivate)
|
||||||
d(new ImageViewerPrivate)
|
|
||||||
{
|
{
|
||||||
d->file = document;
|
d->file = document;
|
||||||
ctor();
|
ctor();
|
||||||
|
@@ -46,7 +46,7 @@ class ImageViewer : public Core::IEditor
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ImageViewer(QWidget *parent = nullptr);
|
ImageViewer();
|
||||||
~ImageViewer() override;
|
~ImageViewer() override;
|
||||||
|
|
||||||
Core::IDocument *document() const override;
|
Core::IDocument *document() const override;
|
||||||
@@ -69,7 +69,7 @@ public:
|
|||||||
void togglePlay();
|
void togglePlay();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
ImageViewer(const QSharedPointer<ImageViewerFile> &document, QWidget *parent = nullptr);
|
ImageViewer(const QSharedPointer<ImageViewerFile> &document);
|
||||||
void ctor();
|
void ctor();
|
||||||
void playToggled();
|
void playToggled();
|
||||||
void updatePauseAction();
|
void updatePauseAction();
|
||||||
|
@@ -141,16 +141,15 @@ public:
|
|||||||
QAction *syncEachOtherAction = nullptr;
|
QAction *syncEachOtherAction = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
ModelEditor::ModelEditor(UiController *uiController, ActionHandler *actionHandler, QWidget *parent)
|
ModelEditor::ModelEditor(UiController *uiController, ActionHandler *actionHandler)
|
||||||
: IEditor(parent),
|
: d(new ModelEditorPrivate)
|
||||||
d(new ModelEditorPrivate)
|
|
||||||
{
|
{
|
||||||
setContext(Core::Context(Constants::MODEL_EDITOR_ID));
|
setContext(Core::Context(Constants::MODEL_EDITOR_ID));
|
||||||
d->uiController = uiController;
|
d->uiController = uiController;
|
||||||
d->actionHandler = actionHandler;
|
d->actionHandler = actionHandler;
|
||||||
d->document = new ModelDocument(this);
|
d->document = new ModelDocument(this);
|
||||||
connect(d->document, &ModelDocument::contentSet, this, &ModelEditor::onContentSet);
|
connect(d->document, &ModelDocument::contentSet, this, &ModelEditor::onContentSet);
|
||||||
init(parent);
|
init();
|
||||||
}
|
}
|
||||||
|
|
||||||
ModelEditor::~ModelEditor()
|
ModelEditor::~ModelEditor()
|
||||||
@@ -206,13 +205,13 @@ bool ModelEditor::restoreState(const QByteArray &state)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ModelEditor::init(QWidget *parent)
|
void ModelEditor::init()
|
||||||
{
|
{
|
||||||
// create and configure properties view
|
// create and configure properties view
|
||||||
d->propertiesView = new qmt::PropertiesView(this);
|
d->propertiesView = new qmt::PropertiesView(this);
|
||||||
|
|
||||||
// create and configure editor ui
|
// create and configure editor ui
|
||||||
d->rightSplitter = new Core::MiniSplitter(parent);
|
d->rightSplitter = new Core::MiniSplitter;
|
||||||
connect(d->rightSplitter, &QSplitter::splitterMoved,
|
connect(d->rightSplitter, &QSplitter::splitterMoved,
|
||||||
this, &ModelEditor::onRightSplitterMoved);
|
this, &ModelEditor::onRightSplitterMoved);
|
||||||
connect(d->uiController, &UiController::rightSplitterChanged,
|
connect(d->uiController, &UiController::rightSplitterChanged,
|
||||||
|
@@ -63,8 +63,7 @@ class ModelEditor :
|
|||||||
class ModelEditorPrivate;
|
class ModelEditorPrivate;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit ModelEditor(UiController *uiController, ActionHandler *actionHandler,
|
ModelEditor(UiController *uiController, ActionHandler *actionHandler);
|
||||||
QWidget *parent = nullptr);
|
|
||||||
~ModelEditor();
|
~ModelEditor();
|
||||||
|
|
||||||
Core::IDocument *document() const override;
|
Core::IDocument *document() const override;
|
||||||
@@ -96,7 +95,7 @@ public:
|
|||||||
qmt::MPackage *guessSelectedPackage() const;
|
qmt::MPackage *guessSelectedPackage() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void init(QWidget *parent);
|
void init();
|
||||||
void initDocument();
|
void initDocument();
|
||||||
|
|
||||||
void updateSelectedArea(SelectedArea selectedArea);
|
void updateSelectedArea(SelectedArea selectedArea);
|
||||||
|
Reference in New Issue
Block a user