Qt
Python
pqPythonTabWidget.h
Go to the documentation of this file.
1
// SPDX-FileCopyrightText: Copyright (c) Kitware Inc.
2
// SPDX-FileCopyrightText: Copyright (c) Sandia Corporation
3
// SPDX-License-Identifier: BSD-3-Clause
4
5
#ifndef pqPythonTabWidget_h
6
#define pqPythonTabWidget_h
7
8
#include "
pqPythonModule.h
"
9
10
#include "
vtkType.h
"
// For vtkTypeUInt32
11
12
#include <QLabel>
13
#include <QMouseEvent>
14
#include <QStyle>
15
#include <QTabWidget>
16
17
class
pqPythonTextArea
;
18
struct
pqPythonEditorActions
;
19
28
class
PQPYTHON_EXPORT
pqPythonTabWidget
:
public
QTabWidget
29
{
30
Q_OBJECT
31
32
public
:
37
pqPythonTabWidget
(QWidget* parent);
38
42
pqPythonTextArea
* getCurrentTextArea()
const
;
43
47
void
connectActions(
pqPythonEditorActions
& actions);
48
53
void
updateActions(
pqPythonEditorActions
& actions);
54
59
bool
saveOnClose();
60
65
void
updateTrace(
const
QString& str);
66
72
void
stopTrace(
const
QString& str);
73
81
template
<
typename
T>
82
void
linkTo
(T*
/*obj*/
)
83
{
84
static_assert(
sizeof
(T) == 0,
"Only specializations of linkTo(T* t) can be used"
);
85
}
86
87
void
loadFile(
const
QString& filename);
88
89
public
Q_SLOTS:
// NOLINT(readability-redundant-access-specifiers)
93
void
createNewEmptyTab();
94
101
void
addNewTextArea(
102
const
QString& filename, vtkTypeUInt32
location
= 0x10
/*vtkPVSession::CLIENT*/
);
103
107
void
closeCurrentTab();
108
109
Q_SIGNALS:
114
void
fileOpened(
const
QString&);
115
119
void
fileSaved(
const
QString&);
120
121
protected
:
122
void
keyPressEvent(QKeyEvent* keyEvent)
override
;
123
void
mousePressEvent(QMouseEvent* mouseEvent)
override
;
124
125
private
:
126
void
updateTab(QWidget* widget);
127
void
addNewTabWidget();
128
void
setTabCloseButton(
pqPythonTextArea
* widget);
129
void
createParaviewTraceTab();
130
void
generateTabName(
const
pqPythonTextArea
* widget, QString& tabName, QString& elidedTabName,
131
QString& unstyledTabName)
const
;
132
137
int
fileIsOpened(
const
QString& filename)
const
;
138
139
template
<
typename
T>
140
T* getWidget(
int
idx)
const
141
{
142
if
(idx < 0 || idx >= this->count() - 1)
143
{
144
return
nullptr
;
145
}
146
147
return
reinterpret_cast<
T*
>
(this->widget(idx));
148
}
149
150
pqPythonTextArea
* lastFocus =
nullptr
;
151
152
pqPythonTextArea
* TraceWidget =
nullptr
;
153
};
154
155
#include "pqPythonTabWidget.txx"
156
157
#endif // pqPythonTabWidget_h
pqPythonTabWidget
Encapsulates the multitab python editor.
Definition:
pqPythonTabWidget.h:28
location
location
PQPYTHON_EXPORT
#define PQPYTHON_EXPORT
Definition:
pqPythonModule.h:15
pqPythonEditorActions
Definition:
pqPythonEditorActions.h:73
pqPythonModule.h
pqPythonTextArea
A python text editor widget.
Definition:
pqPythonTextArea.h:32
vtkType.h
pqPythonTabWidget::linkTo
void linkTo(T *)
Link the input QTextEdit to one of the tab of the editor.
Definition:
pqPythonTabWidget.h:82
Generated by
1.8.13 on Fri Jan 10 2025