9#include <QtDesigner/abstractpropertyeditor.h>
10#include <QtDesigner/abstractformeditor.h>
11#include <QtDesigner/abstractactioneditor.h>
12#include <QtDesigner/abstractobjectinspector.h>
13#include <QtDesigner/abstractwidgetbox.h>
14#include <QtDesigner/QDesignerComponents>
16#include <QtGui/qaction.h>
17#include <QtGui/qevent.h>
19#include <QtCore/qdebug.h>
25using namespace Qt::StringLiterals;
32 const QString &objectName,
34 const QString &actionObjectName,
35 Qt::DockWidgetArea dockAreaHint,
37 Qt::WindowFlags flags) :
39 m_dockAreaHint(dockAreaHint),
40 m_workbench(workbench),
41 m_action(
new QAction(
this))
43 setObjectName(objectName);
46 setWindowTitle(title);
48 m_action->setObjectName(actionObjectName);
49 m_action->setShortcutContext(Qt::ApplicationShortcut);
50 m_action->setText(title);
51 m_action->setCheckable(
true);
52 connect(m_action, &QAction::triggered,
this, &QDesignerToolWindow::showMe);
60 target->setWindowState(target->windowState() & ~Qt::WindowMinimized);
61 target->setVisible(v);
69 bool blocked = m_action->blockSignals(
true);
70 m_action->setChecked(
true);
71 m_action->blockSignals(blocked);
78 bool blocked = m_action->blockSignals(
true);
79 m_action->setChecked(
false);
80 m_action->blockSignals(blocked);
91 case QEvent::WindowTitleChange:
92 m_action->setText(windowTitle());
94 case QEvent::WindowIconChange:
95 m_action->setIcon(windowIcon());
100 QMainWindow::changeEvent(e);
112 QDesignerPropertyEditorInterface *widget = QDesignerComponents::createPropertyEditor(core, parent);
113 core->setPropertyEditor(widget);
131 u"qt_designer_propertyeditor"_s,
133 u"__qt_property_editor_action"_s,
136 action()->setShortcut(Qt::CTRL | Qt::Key_I);
142 const int spacing = 40;
143 const QSize sz(g.width() * 1/4, g.height() * 4/6);
145 const QRect rc = QRect((g.right() + 1 - sz.width() - margin),
146 (g.top() + margin + g.height() * 1/6) + spacing,
147 sz.width(), sz.height());
149 qDebug() << Q_FUNC_INFO << rc;
155 if (QDesignerPropertyEditorInterface *e = workbench()->core()->propertyEditor()) {
157 e->setObject(e->object());
160 QDesignerToolWindow::showEvent(event);
167 QDesignerActionEditorInterface *widget = QDesignerComponents::createActionEditor(core, parent);
168 core->setActionEditor(widget);
183 u"qt_designer_actioneditor"_s,
185 u"__qt_action_editor_tool_action"_s,
192 const QSize sz(g.width() * 1/4, g.height() * 1/6);
194 const QRect rc = QRect((g.right() + 1 - sz.width() - margin),
196 sz.width(), sz.height());
198 qDebug() << Q_FUNC_INFO << rc;
206 QDesignerObjectInspectorInterface *widget = QDesignerComponents::createObjectInspector(core, parent);
207 core->setObjectInspector(widget);
222 u"qt_designer_objectinspector"_s,
224 u"__qt_object_inspector_tool_action"_s,
231 const QSize sz(g.width() * 1/4, g.height() * 1/6);
233 const QRect rc = QRect((g.right() + 1 - sz.width() - margin),
235 sz.width(), sz.height());
237 qDebug() << Q_FUNC_INFO << rc;
254 u"qt_designer_resourceeditor"_s,
256 u"__qt_resource_editor_tool_action"_s,
263 const QSize sz(g.width() * 1/3, g.height() * 1/6);
264 QRect r(QPoint(0, 0), sz);
265 r.moveCenter(g.center());
266 r.moveBottom(g.bottom() -
margin);
268 qDebug() << Q_FUNC_INFO << r;
285 u"qt_designer_signalsloteditor"_s,
287 u"__qt_signal_slot_editor_tool_action"_s,
294 const QSize sz(g.width() * 1/3, g.height() * 1/6);
295 QRect r(QPoint(0, 0), sz);
296 r.moveCenter(g.center());
297 r.moveTop(
margin + g.top());
299 qDebug() << Q_FUNC_INFO << r;
307 QDesignerWidgetBoxInterface *widget = QDesignerComponents::createWidgetBox(core, parent);
308 core->setWidgetBox(widget);
323 u"qt_designer_widgetbox"_s,
325 u"__qt_widget_box_tool_action"_s,
332 const QRect rc = QRect(g.left() + margin,
334 g.width() * 1/4, g.height() * 5/6);
336 qDebug() << Q_FUNC_INFO << rc;