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
signalsloteditor_p.h
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
5#ifndef SIGNALSLOTEDITOR_P_H
6#define SIGNALSLOTEDITOR_P_H
7
8//
9// W A R N I N G
10// -------------
11//
12// This file is not part of the Qt API. It exists purely as an
13// implementation detail. This header file may change from version to
14// version without notice, or even be removed.
15//
16// We mean it.
17//
18
19#include <QtCore/qstring.h>
20#include <QtCore/qstringlist.h>
21#include <QtCore/qlist.h>
22#include <QtCore/qpointer.h>
23#include <QtCore/qabstractitemmodel.h>
24
25#include <connectionedit_p.h>
26
28
29class QDesignerFormWindowInterface;
30class QDesignerFormEditorInterface;
31class DomConnection;
32
33namespace qdesigner_internal {
34
36
38{
39public:
40 explicit SignalSlotConnection(ConnectionEdit *edit, QWidget *source = nullptr, QWidget *target = nullptr);
41
42 void setSignal(const QString &signal);
43 void setSlot(const QString &slot);
44
45 QString sender() const;
46 QString receiver() const;
47 QString signal() const { return m_signal; }
48 QString slot() const { return m_slot; }
49
50 DomConnection *toUi() const;
51
53
55 State isValid(const QWidget *background) const;
56
57 // format for messages, etc.
58 QString toString() const;
59
60private:
61 QString m_signal, m_slot;
62};
63
65{
67public:
68 explicit ConnectionModel(QObject *parent = nullptr);
69 void setEditor(SignalSlotEditor *editor = nullptr);
70
71 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
72 QModelIndex parent(const QModelIndex &child) const override;
73 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
74 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
75 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
76 bool setData(const QModelIndex &index, const QVariant &data, int role = Qt::DisplayRole) override;
77 Qt::ItemFlags flags(const QModelIndex &index) const override;
78 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
79
80 QModelIndex connectionToIndex(Connection *con) const;
81 Connection *indexToConnection(const QModelIndex &index) const;
82 void updateAll();
83
84 const SignalSlotConnection *connectionAt(const QModelIndex &index) const;
85 static QString columnText(const SignalSlotConnection *con, int column);
86
87private slots:
89 void connectionRemoved(int idx);
90 void aboutToRemoveConnection(qdesigner_internal::Connection *con);
91 void aboutToAddConnection(int idx);
92 void connectionChanged(qdesigner_internal::Connection *con);
93
94private:
95 QPointer<SignalSlotEditor> m_editor;
96};
97
98} // namespace qdesigner_internal
99
100QT_END_NAMESPACE
101
102#endif // SIGNALSLOTEDITOR_P_H
static QString columnText(const SignalSlotConnection *con, int column)
QModelIndex parent(const QModelIndex &child) const override
QVariant data(const QModelIndex &index, int role=Qt::DisplayRole) const override
Returns the data stored under the given role for the item referred to by the index.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
Returns the index of the item in the model specified by the given row, column and parent index.
int columnCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of columns for the children of the given parent.
Qt::ItemFlags flags(const QModelIndex &index) const override
Returns the item flags for the given index.
const SignalSlotConnection * connectionAt(const QModelIndex &index) const
QModelIndex connectionToIndex(Connection *con) const
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
Returns the data for the given role and section in the header with the specified orientation.
void setEditor(SignalSlotEditor *editor=nullptr)
int rowCount(const QModelIndex &parent=QModelIndex()) const override
Returns the number of rows under the given parent.
bool setData(const QModelIndex &index, const QVariant &data, int role=Qt::DisplayRole) override
Sets the role data for the item at index to value.
Connection * indexToConnection(const QModelIndex &index) const
void redo() override
Applies a change to the document.
ModifyConnectionCommand(QDesignerFormWindowInterface *form, SignalSlotConnection *conn, const QString &newSignal, const QString &newSlot)
void undo() override
Reverts a change to the document.
void redo() override
Applies a change to the document.
void undo() override
Reverts a change to the document.
SetMemberCommand(SignalSlotConnection *con, EndPoint::Type type, const QString &member, SignalSlotEditor *editor)
SignalSlotConnection(ConnectionEdit *edit, QWidget *source=nullptr, QWidget *target=nullptr)
State isValid(const QWidget *background) const
virtual void setSlot(SignalSlotConnection *con, const QString &member)
virtual void setSignal(SignalSlotConnection *con, const QString &member)
void setTarget(Connection *con, const QString &obj_name) override
void setSource(Connection *con, const QString &obj_name) override
Connection * createConnection(QWidget *source, QWidget *destination) override
void fromUi(const DomConnections *connections, QWidget *parent)
QWidget * widgetAt(const QPoint &pos) const override
QObject * objectByName(QWidget *topLevel, const QString &name) const
void modifyConnection(Connection *con) override
QDesignerFormWindowInterface * formWindow() const
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
static bool skipWidget(const QWidget *w)
#define QT_SIGNALSLOTEDITOR_EXPORT