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
4#ifndef SIGNALSLOTEDITOR_P_H
5#define SIGNALSLOTEDITOR_P_H
6
7//
8// W A R N I N G
9// -------------
10//
11// This file is not part of the Qt API. It exists purely as an
12// implementation detail. This header file may change from version to
13// version without notice, or even be removed.
14//
15// We mean it.
16//
17
18#include <QtCore/qstring.h>
19#include <QtCore/qstringlist.h>
20#include <QtCore/qlist.h>
21#include <QtCore/qpointer.h>
22#include <QtCore/qabstractitemmodel.h>
23
24#include <connectionedit_p.h>
25
27
28class QDesignerFormWindowInterface;
29class QDesignerFormEditorInterface;
30class DomConnection;
31
32namespace qdesigner_internal {
33
35
37{
38public:
39 explicit SignalSlotConnection(ConnectionEdit *edit, QWidget *source = nullptr, QWidget *target = nullptr);
40
41 void setSignal(const QString &signal);
42 void setSlot(const QString &slot);
43
44 QString sender() const;
45 QString receiver() const;
46 inline QString signal() const { return m_signal; }
47 inline QString slot() const { return m_slot; }
48
49 DomConnection *toUi() const;
50
52
54 State isValid(const QWidget *background) const;
55
56 // format for messages, etc.
57 QString toString() const;
58
59private:
60 QString m_signal, m_slot;
61};
62
64{
66public:
67 explicit ConnectionModel(QObject *parent = nullptr);
68 void setEditor(SignalSlotEditor *editor = nullptr);
69
70 QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const override;
71 QModelIndex parent(const QModelIndex &child) const override;
72 int rowCount(const QModelIndex &parent = QModelIndex()) const override;
73 int columnCount(const QModelIndex &parent = QModelIndex()) const override;
74 QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
75 bool setData(const QModelIndex &index, const QVariant &data, int role = Qt::DisplayRole) override;
76 Qt::ItemFlags flags(const QModelIndex &index) const override;
77 QVariant headerData(int section, Qt::Orientation orientation, int role = Qt::DisplayRole) const override;
78
79 QModelIndex connectionToIndex(Connection *con) const;
80 Connection *indexToConnection(const QModelIndex &index) const;
81 void updateAll();
82
83 const SignalSlotConnection *connectionAt(const QModelIndex &index) const;
84 static QString columnText(const SignalSlotConnection *con, int column);
85
86private slots:
88 void connectionRemoved(int idx);
89 void aboutToRemoveConnection(qdesigner_internal::Connection *con);
90 void aboutToAddConnection(int idx);
91 void connectionChanged(qdesigner_internal::Connection *con);
92
93private:
94 QPointer<SignalSlotEditor> m_editor;
95};
96
97} // namespace qdesigner_internal
98
99QT_END_NAMESPACE
100
101#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