10#include <QtDesigner/abstractpropertyeditor.h>
11#include <QtDesigner/abstractformeditor.h>
12#include <QtDesigner/abstractactioneditor.h>
13#include <QtDesigner/abstractobjectinspector.h>
14#include <QtDesigner/abstractwidgetbox.h>
15#include <QtDesigner/QDesignerComponents>
17#include <QtGui/qaction.h>
18#include <QtGui/qevent.h>
20#include <QtCore/qdebug.h>
26using namespace Qt::StringLiterals;
33 const QString &objectName,
35 const QString &actionObjectName,
36 Qt::DockWidgetArea dockAreaHint,
38 Qt::WindowFlags flags) :
40 m_dockAreaHint(dockAreaHint),
41 m_workbench(workbench),
42 m_action(
new QAction(
this))
44 setObjectName(objectName);
47 setWindowTitle(title);
49 m_action->setObjectName(actionObjectName);
50 m_action->setShortcutContext(Qt::ApplicationShortcut);
51 m_action->setText(title);
52 m_action->setCheckable(
true);
53 connect(m_action, &QAction::triggered,
this, &QDesignerToolWindow::showMe);
59 if (
QWidget *target = m_workbench
->mode() == DockedMode ? parentWidget() :
this) {
61 target->setWindowState(target->windowState() & ~Qt::WindowMinimized);
62 target->setVisible(v);
70 bool blocked = m_action->blockSignals(
true);
71 m_action->setChecked(
true);
72 m_action->blockSignals(blocked);
79 bool blocked = m_action->blockSignals(
true);
80 m_action->setChecked(
false);
81 m_action->blockSignals(blocked);
92 case QEvent::WindowTitleChange:
93 m_action->setText(windowTitle());
95 case QEvent::WindowIconChange:
96 m_action->setIcon(windowIcon());
101 QMainWindow::changeEvent(e);
113 QDesignerPropertyEditorInterface *widget = QDesignerComponents::createPropertyEditor(core, parent);
114 core->setPropertyEditor(widget);
132 u"qt_designer_propertyeditor"_s,
134 u"__qt_property_editor_action"_s,
137 action()->setShortcut(Qt::CTRL | Qt::Key_I);
143 const int spacing = 40;
144 const QSize sz(g.width() * 1/4, g.height() * 4/6);
146 const QRect rc = QRect((g.right() + 1 - sz.width() -
margin),
147 (g.top() +
margin + g.height() * 1/6) + spacing,
148 sz.width(), sz.height());
150 qDebug() << Q_FUNC_INFO << rc;
156 if (QDesignerPropertyEditorInterface *e = workbench()->core()->propertyEditor()) {
158 e->setObject(e->object());
161 QDesignerToolWindow::showEvent(event);
168 QDesignerActionEditorInterface *widget = QDesignerComponents::createActionEditor(core, parent);
169 core->setActionEditor(widget);
184 u"qt_designer_actioneditor"_s,
186 u"__qt_action_editor_tool_action"_s,
193 const QSize sz(g.width() * 1/4, g.height() * 1/6);
195 const QRect rc = QRect((g.right() + 1 - sz.width() -
margin),
197 sz.width(), sz.height());
199 qDebug() << Q_FUNC_INFO << rc;
207 QDesignerObjectInspectorInterface *widget = QDesignerComponents::createObjectInspector(core, parent);
208 core->setObjectInspector(widget);
223 u"qt_designer_objectinspector"_s,
225 u"__qt_object_inspector_tool_action"_s,
232 const QSize sz(g.width() * 1/4, g.height() * 1/6);
234 const QRect rc = QRect((g.right() + 1 - sz.width() -
margin),
236 sz.width(), sz.height());
238 qDebug() << Q_FUNC_INFO << rc;
255 u"qt_designer_resourceeditor"_s,
257 u"__qt_resource_editor_tool_action"_s,
264 const QSize sz(g.width() * 1/3, g.height() * 1/6);
265 QRect r(QPoint(0, 0), sz);
266 r.moveCenter(g.center());
267 r.moveBottom(g.bottom() -
margin);
269 qDebug() << Q_FUNC_INFO << r;
286 u"qt_designer_signalsloteditor"_s,
288 u"__qt_signal_slot_editor_tool_action"_s,
295 const QSize sz(g.width() * 1/3, g.height() * 1/6);
296 QRect r(QPoint(0, 0), sz);
297 r.moveCenter(g.center());
298 r.moveTop(
margin + g.top());
300 qDebug() << Q_FUNC_INFO << r;
308 QDesignerWidgetBoxInterface *widget = QDesignerComponents::createWidgetBox(core, parent);
309 core->setWidgetBox(widget);
324 u"qt_designer_widgetbox"_s,
326 u"__qt_widget_box_tool_action"_s,
333 const QRect rc = QRect(g.left() +
margin,
335 g.width() * 1/4, g.height() * 5/6);
337 qDebug() << Q_FUNC_INFO << rc;