Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
buddyeditor_tool.cpp
Go to the documentation of this file.
1// Copyright (C) 2016 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
3
5#include "buddyeditor.h"
6
7#include <QtDesigner/abstractformwindow.h>
8
9#include <QtGui/qaction.h>
10
12
13namespace qdesigner_internal {
14
15BuddyEditorTool::BuddyEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent)
16 : QDesignerFormWindowToolInterface(parent),
17 m_formWindow(formWindow),
18 m_action(new QAction(tr("Edit Buddies"), this))
19{
20}
21
23
24QDesignerFormEditorInterface *BuddyEditorTool::core() const
25{
26 return m_formWindow->core();
27}
28
29QDesignerFormWindowInterface *BuddyEditorTool::formWindow() const
30{
31 return m_formWindow;
32}
33
34bool BuddyEditorTool::handleEvent(QWidget *widget, QWidget *managedWidget, QEvent *event)
35{
36 Q_UNUSED(widget);
37 Q_UNUSED(managedWidget);
38 Q_UNUSED(event);
39
40 return false;
41}
42
44{
45 if (!m_editor) {
46 Q_ASSERT(formWindow() != nullptr);
47 m_editor = new BuddyEditor(formWindow(), nullptr);
48 connect(formWindow(), &QDesignerFormWindowInterface::mainContainerChanged,
49 m_editor.data(), &BuddyEditor::setBackground);
50 connect(formWindow(), &QDesignerFormWindowInterface::changed,
51 m_editor.data(), &BuddyEditor::updateBackground);
52 }
53
54 return m_editor;
55}
56
58{
59 m_editor->enableUpdateBackground(true);
60}
61
63{
64 m_editor->enableUpdateBackground(false);
65}
66
67QAction *BuddyEditorTool::action() const
68{
69 return m_action;
70}
71
72} // namespace qdesigner_internal
73
74QT_END_NAMESPACE
QDesignerFormWindowInterface * formWindow() const override
QAction * action() const override
QWidget * editor() const override
QDesignerFormEditorInterface * core() const override
bool handleEvent(QWidget *widget, QWidget *managedWidget, QEvent *event) override
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.