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// Qt-Security score:significant reason:default
4
6#include "buddyeditor.h"
7
8#include <QtDesigner/abstractformwindow.h>
9
10#include <QtGui/qaction.h>
11
13
14namespace qdesigner_internal {
15
16BuddyEditorTool::BuddyEditorTool(QDesignerFormWindowInterface *formWindow, QObject *parent)
17 : QDesignerFormWindowToolInterface(parent),
18 m_formWindow(formWindow),
19 m_action(new QAction(tr("Edit Buddies"), this))
20{
21}
22
24
25QDesignerFormEditorInterface *BuddyEditorTool::core() const
26{
27 return m_formWindow->core();
28}
29
30QDesignerFormWindowInterface *BuddyEditorTool::formWindow() const
31{
32 return m_formWindow;
33}
34
35bool BuddyEditorTool::handleEvent(QWidget *widget, QWidget *managedWidget, QEvent *event)
36{
37 Q_UNUSED(widget);
38 Q_UNUSED(managedWidget);
39 Q_UNUSED(event);
40
41 return false;
42}
43
45{
46 if (!m_editor) {
47 Q_ASSERT(formWindow() != nullptr);
48 m_editor = new BuddyEditor(formWindow(), nullptr);
49 connect(formWindow(), &QDesignerFormWindowInterface::mainContainerChanged,
50 m_editor.data(), &BuddyEditor::setBackground);
51 connect(formWindow(), &QDesignerFormWindowInterface::changed,
52 m_editor.data(), &BuddyEditor::updateBackground);
53 }
54
55 return m_editor;
56}
57
59{
60 m_editor->enableUpdateBackground(true);
61}
62
64{
65 m_editor->enableUpdateBackground(false);
66}
67
68QAction *BuddyEditorTool::action() const
69{
70 return m_action;
71}
72
73} // namespace qdesigner_internal
74
75QT_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.