Gui: remove some superfluous const_cast
This commit is contained in:
@@ -292,7 +292,7 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
|
||||
// If we have an instance of PyObjectBase then determine whether it's valid or not
|
||||
if (PyObject_IsInstance(inst.ptr(), typeobj) == 1) {
|
||||
Base::PyObjectBase* baseobj = static_cast<Base::PyObjectBase*>(inst.ptr());
|
||||
const_cast<CallTipsList*>(this)->validObject = baseobj->isValid();
|
||||
validObject = baseobj->isValid();
|
||||
}
|
||||
else {
|
||||
// PyObject_IsInstance might set an exception
|
||||
|
||||
@@ -80,7 +80,7 @@ private:
|
||||
private:
|
||||
QPlainTextEdit* textEdit;
|
||||
int cursorPos;
|
||||
bool validObject;
|
||||
mutable bool validObject;
|
||||
bool doCallCompletion;
|
||||
QList<int> hideKeys;
|
||||
QList<int> compKeys;
|
||||
|
||||
@@ -239,15 +239,15 @@ namespace Gui {
|
||||
{
|
||||
if (out) {
|
||||
Base::PyGILStateLocker lock;
|
||||
old = PySys_GetObject(const_cast<char*>(std_out));
|
||||
PySys_SetObject(const_cast<char*>(std_out), out);
|
||||
old = PySys_GetObject(std_out);
|
||||
PySys_SetObject(std_out, out);
|
||||
}
|
||||
}
|
||||
~PythonRedirector()
|
||||
{
|
||||
if (out) {
|
||||
Base::PyGILStateLocker lock;
|
||||
PySys_SetObject(const_cast<char*>(std_out), old);
|
||||
PySys_SetObject(std_out, old);
|
||||
Py_DECREF(out);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ QWidget* SIM::Coin3D::Quarter::SoQTQuarterAdaptor::getWidget() const
|
||||
|
||||
QWidget* SIM::Coin3D::Quarter::SoQTQuarterAdaptor::getGLWidget() const
|
||||
{
|
||||
return const_cast<QWidget*>(viewport());
|
||||
return viewport();
|
||||
}
|
||||
|
||||
void SIM::Coin3D::Quarter::SoQTQuarterAdaptor::setCameraType(SoType type)
|
||||
|
||||
@@ -345,14 +345,14 @@ public:
|
||||
{
|
||||
if (!default_stdout) {
|
||||
Base::PyGILStateLocker lock;
|
||||
default_stdout = PySys_GetObject(const_cast<char*>("stdout"));
|
||||
default_stdout = PySys_GetObject("stdout");
|
||||
replace_stdout = new OutputStdout();
|
||||
redirected_stdout = false;
|
||||
}
|
||||
|
||||
if (!default_stderr) {
|
||||
Base::PyGILStateLocker lock;
|
||||
default_stderr = PySys_GetObject(const_cast<char*>("stderr"));
|
||||
default_stderr = PySys_GetObject("stderr");
|
||||
replace_stderr = new OutputStderr();
|
||||
redirected_stderr = false;
|
||||
}
|
||||
@@ -712,12 +712,12 @@ void ReportOutput::onToggleRedirectPythonStdout()
|
||||
if (d->redirected_stdout) {
|
||||
d->redirected_stdout = false;
|
||||
Base::PyGILStateLocker lock;
|
||||
PySys_SetObject(const_cast<char*>("stdout"), d->default_stdout);
|
||||
PySys_SetObject("stdout", d->default_stdout);
|
||||
}
|
||||
else {
|
||||
d->redirected_stdout = true;
|
||||
Base::PyGILStateLocker lock;
|
||||
PySys_SetObject(const_cast<char*>("stdout"), d->replace_stdout);
|
||||
PySys_SetObject("stdout", d->replace_stdout);
|
||||
}
|
||||
|
||||
getWindowParameter()->SetBool("RedirectPythonOutput", d->redirected_stdout);
|
||||
@@ -728,12 +728,12 @@ void ReportOutput::onToggleRedirectPythonStderr()
|
||||
if (d->redirected_stderr) {
|
||||
d->redirected_stderr = false;
|
||||
Base::PyGILStateLocker lock;
|
||||
PySys_SetObject(const_cast<char*>("stderr"), d->default_stderr);
|
||||
PySys_SetObject("stderr", d->default_stderr);
|
||||
}
|
||||
else {
|
||||
d->redirected_stderr = true;
|
||||
Base::PyGILStateLocker lock;
|
||||
PySys_SetObject(const_cast<char*>("stderr"), d->replace_stderr);
|
||||
PySys_SetObject("stderr", d->replace_stderr);
|
||||
}
|
||||
|
||||
getWindowParameter()->SetBool("RedirectPythonErrors", d->redirected_stderr);
|
||||
|
||||
Reference in New Issue
Block a user