2022-08-19 15:59:36 +02:00
|
|
|
// Copyright (C) 2016 The Qt Company Ltd.
|
2022-12-21 10:12:09 +01:00
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
2010-01-07 12:14:35 +01:00
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2010-01-07 12:14:35 +01:00
|
|
|
|
|
|
|
|
#include <coreplugin/imode.h>
|
|
|
|
|
|
2010-02-26 11:08:17 +01:00
|
|
|
namespace Core {
|
2010-03-17 17:44:46 +01:00
|
|
|
class IEditor;
|
2010-02-26 11:08:17 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* A global mode for Design pane - used by Bauhaus (QML Designer) and
|
|
|
|
|
* Qt Designer. Other plugins can register themselves by registerDesignWidget()
|
|
|
|
|
* and giving a list of mimetypes that the editor understands, as well as an instance
|
|
|
|
|
* to the main editor widget itself.
|
|
|
|
|
*/
|
2010-03-17 17:44:46 +01:00
|
|
|
|
2020-01-29 04:15:25 +03:00
|
|
|
class CORE_EXPORT DesignMode final : public IMode
|
2010-01-07 12:14:35 +01:00
|
|
|
{
|
|
|
|
|
Q_OBJECT
|
|
|
|
|
|
|
|
|
|
public:
|
2011-10-19 13:05:53 +02:00
|
|
|
static DesignMode *instance();
|
|
|
|
|
|
2018-01-23 09:09:46 +01:00
|
|
|
static void setDesignModeIsRequired();
|
2011-10-19 13:05:53 +02:00
|
|
|
|
2018-01-23 09:09:46 +01:00
|
|
|
static void registerDesignWidget(QWidget *widget,
|
|
|
|
|
const QStringList &mimeTypes,
|
|
|
|
|
const Context &context);
|
|
|
|
|
static void unregisterDesignWidget(QWidget *widget);
|
2010-03-16 16:51:45 +01:00
|
|
|
|
2018-01-23 10:33:18 +01:00
|
|
|
static void createModeIfRequired();
|
|
|
|
|
static void destroyModeIfRequired();
|
|
|
|
|
|
2010-02-26 11:08:17 +01:00
|
|
|
signals:
|
|
|
|
|
void actionsUpdated(Core::IEditor *editor);
|
|
|
|
|
|
2016-02-02 09:10:54 +02:00
|
|
|
private:
|
2018-01-23 10:33:18 +01:00
|
|
|
DesignMode();
|
|
|
|
|
~DesignMode() final;
|
|
|
|
|
|
2010-01-07 12:14:35 +01:00
|
|
|
void updateActions();
|
|
|
|
|
|
2014-11-16 10:52:41 +02:00
|
|
|
void currentEditorChanged(IEditor *editor);
|
2020-06-26 13:59:38 +02:00
|
|
|
void updateContext(Utils::Id newMode, Utils::Id oldMode);
|
2010-06-25 12:56:16 +02:00
|
|
|
void setActiveContext(const Context &context);
|
2010-01-07 12:14:35 +01:00
|
|
|
};
|
|
|
|
|
|
2010-02-26 11:08:17 +01:00
|
|
|
} // namespace Core
|