Gui: modernize some classes
This commit is contained in:
@@ -154,7 +154,7 @@ PythonToCppFunc toCppPointerCheckFuncQuantity(PyObject* obj)
|
||||
if (PyObject_TypeCheck(obj, &(Base::QuantityPy::Type)))
|
||||
return toCppPointerConvFuncQuantity;
|
||||
else
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void BaseQuantity_PythonToCpp_QVariant(PyObject* pyIn, void* cppOut)
|
||||
@@ -167,7 +167,7 @@ PythonToCppFunc isBaseQuantity_PythonToCpp_QVariantConvertible(PyObject* obj)
|
||||
{
|
||||
if (PyObject_TypeCheck(obj, &(Base::QuantityPy::Type)))
|
||||
return BaseQuantity_PythonToCpp_QVariant;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
#if defined (HAVE_PYSIDE)
|
||||
@@ -360,7 +360,7 @@ QObject* PythonWrapper::toQObject(const Py::Object& pyobject)
|
||||
return reinterpret_cast<QObject*>(ptr);
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
QGraphicsItem* PythonWrapper::toQGraphicsItem(PyObject* pyPtr)
|
||||
@@ -413,7 +413,7 @@ QIcon *PythonWrapper::toQIcon(PyObject *pyobj)
|
||||
#else
|
||||
Q_UNUSED(pyobj);
|
||||
#endif
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Py::Object PythonWrapper::fromQDir(const QDir& dir)
|
||||
|
||||
@@ -48,8 +48,8 @@ public:
|
||||
bool toCString(const Py::Object&, std::string&);
|
||||
QObject* toQObject(const Py::Object&);
|
||||
QGraphicsItem* toQGraphicsItem(PyObject* ptr);
|
||||
Py::Object fromQObject(QObject*, const char* className=0);
|
||||
Py::Object fromQWidget(QWidget*, const char* className=0);
|
||||
Py::Object fromQObject(QObject*, const char* className=nullptr);
|
||||
Py::Object fromQWidget(QWidget*, const char* className=nullptr);
|
||||
const char* getWrapperName(QObject*) const;
|
||||
/*!
|
||||
Create a Python wrapper for the icon. The icon must be created on the heap
|
||||
|
||||
@@ -60,7 +60,7 @@ Py::Object wrapFromWidgetFactory(const Py::Tuple& args, const std::function<QWid
|
||||
std::string className;
|
||||
className = str.as_std_string("utf-8");
|
||||
// 2nd argument
|
||||
QWidget* parent = 0;
|
||||
QWidget* parent = nullptr;
|
||||
if (wrap.loadCoreModule() && args.size() > 1) {
|
||||
QObject* object = wrap.toQObject(args[1]);
|
||||
if (object)
|
||||
@@ -537,7 +537,7 @@ QWidget* UiLoader::createWidget(const QString & className, QWidget * parent,
|
||||
PyObject *UiLoaderPy::PyMake(struct _typeobject * /*type*/, PyObject * args, PyObject * /*kwds*/)
|
||||
{
|
||||
if (!PyArg_ParseTuple(args, ""))
|
||||
return 0;
|
||||
return nullptr;
|
||||
return new UiLoaderPy();
|
||||
}
|
||||
|
||||
|
||||
@@ -106,14 +106,14 @@ private:
|
||||
class UiLoader : public QUiLoader
|
||||
{
|
||||
public:
|
||||
UiLoader(QObject* parent=0);
|
||||
UiLoader(QObject* parent=nullptr);
|
||||
virtual ~UiLoader();
|
||||
|
||||
/**
|
||||
* Creates a widget of the type \a className with the parent \a parent.
|
||||
* For more details see the documentation to QWidgetFactory.
|
||||
*/
|
||||
QWidget* createWidget(const QString & className, QWidget * parent=0,
|
||||
QWidget* createWidget(const QString & className, QWidget * parent=nullptr,
|
||||
const QString& name = QString());
|
||||
|
||||
private:
|
||||
@@ -125,7 +125,7 @@ private:
|
||||
class UiLoaderPy : public Py::PythonExtension<UiLoaderPy>
|
||||
{
|
||||
public:
|
||||
static void init_type(void); // announce properties and methods
|
||||
static void init_type(); // announce properties and methods
|
||||
|
||||
UiLoaderPy();
|
||||
~UiLoaderPy();
|
||||
|
||||
@@ -52,26 +52,26 @@
|
||||
|
||||
using namespace Gui;
|
||||
|
||||
Gui::WidgetFactoryInst* Gui::WidgetFactoryInst::_pcSingleton = NULL;
|
||||
Gui::WidgetFactoryInst* Gui::WidgetFactoryInst::_pcSingleton = nullptr;
|
||||
|
||||
WidgetFactoryInst& WidgetFactoryInst::instance()
|
||||
{
|
||||
if (_pcSingleton == 0L)
|
||||
if (_pcSingleton == nullptr)
|
||||
_pcSingleton = new WidgetFactoryInst;
|
||||
return *_pcSingleton;
|
||||
}
|
||||
|
||||
void WidgetFactoryInst::destruct ()
|
||||
{
|
||||
if (_pcSingleton != 0)
|
||||
if (_pcSingleton != nullptr)
|
||||
delete _pcSingleton;
|
||||
_pcSingleton = 0;
|
||||
_pcSingleton = nullptr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a widget with the name \a sName which is a child of \a parent.
|
||||
* To create an instance of this widget once it must has been registered.
|
||||
* If there is no appropriate widget registered 0 is returned.
|
||||
* If there is no appropriate widget registered nullptr is returned.
|
||||
*/
|
||||
QWidget* WidgetFactoryInst::createWidget (const char* sName, QWidget* parent) const
|
||||
{
|
||||
@@ -84,7 +84,7 @@ QWidget* WidgetFactoryInst::createWidget (const char* sName, QWidget* parent) co
|
||||
#else
|
||||
Base::Console().Log("\"%s\" is not registered\n", sName);
|
||||
#endif
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
try {
|
||||
@@ -100,7 +100,7 @@ QWidget* WidgetFactoryInst::createWidget (const char* sName, QWidget* parent) co
|
||||
Base::Console().Log("%s does not inherit from \"QWidget\"\n", sName);
|
||||
#endif
|
||||
delete w;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// set the parent to the widget
|
||||
@@ -113,7 +113,7 @@ QWidget* WidgetFactoryInst::createWidget (const char* sName, QWidget* parent) co
|
||||
/**
|
||||
* Creates a widget with the name \a sName which is a child of \a parent.
|
||||
* To create an instance of this widget once it must has been registered.
|
||||
* If there is no appropriate widget registered 0 is returned.
|
||||
* If there is no appropriate widget registered nullptr is returned.
|
||||
*/
|
||||
Gui::Dialog::PreferencePage* WidgetFactoryInst::createPreferencePage (const char* sName, QWidget* parent) const
|
||||
{
|
||||
@@ -126,7 +126,7 @@ Gui::Dialog::PreferencePage* WidgetFactoryInst::createPreferencePage (const char
|
||||
#else
|
||||
Base::Console().Log("Cannot create an instance of \"%s\"\n", sName);
|
||||
#endif
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
if (qobject_cast<Gui::Dialog::PreferencePage*>(w)) {
|
||||
@@ -139,7 +139,7 @@ Gui::Dialog::PreferencePage* WidgetFactoryInst::createPreferencePage (const char
|
||||
Base::Console().Error("%s does not inherit from 'Gui::Dialog::PreferencePage'\n", sName);
|
||||
#endif
|
||||
delete w;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
// set the parent to the widget
|
||||
@@ -153,7 +153,7 @@ Gui::Dialog::PreferencePage* WidgetFactoryInst::createPreferencePage (const char
|
||||
* Creates a preference widget with the name \a sName and the preference name \a sPref
|
||||
* which is a child of \a parent.
|
||||
* To create an instance of this widget once it must has been registered.
|
||||
* If there is no appropriate widget registered 0 is returned.
|
||||
* If there is no appropriate widget registered nullptr is returned.
|
||||
* After creation of this widget its recent preferences are restored automatically.
|
||||
*/
|
||||
QWidget* WidgetFactoryInst::createPrefWidget(const char* sName, QWidget* parent, const char* sPref)
|
||||
@@ -161,7 +161,7 @@ QWidget* WidgetFactoryInst::createPrefWidget(const char* sName, QWidget* parent,
|
||||
QWidget* w = createWidget(sName);
|
||||
// this widget class is not registered
|
||||
if (!w)
|
||||
return 0; // no valid QWidget object
|
||||
return nullptr; // no valid QWidget object
|
||||
|
||||
// set the parent to the widget
|
||||
w->setParent(parent);
|
||||
@@ -178,7 +178,7 @@ QWidget* WidgetFactoryInst::createPrefWidget(const char* sName, QWidget* parent,
|
||||
Base::Console().Error("%s does not inherit from \"PrefWidget\"\n", w->metaObject()->className());
|
||||
#endif
|
||||
delete w;
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
return w;
|
||||
@@ -186,7 +186,7 @@ QWidget* WidgetFactoryInst::createPrefWidget(const char* sName, QWidget* parent,
|
||||
|
||||
// ----------------------------------------------------
|
||||
|
||||
WidgetFactorySupplier* WidgetFactorySupplier::_pcSingleton = 0L;
|
||||
WidgetFactorySupplier* WidgetFactorySupplier::_pcSingleton = nullptr;
|
||||
|
||||
WidgetFactorySupplier & WidgetFactorySupplier::instance()
|
||||
{
|
||||
@@ -201,7 +201,7 @@ void WidgetFactorySupplier::destruct()
|
||||
// delete the widget factory and all its producers first
|
||||
WidgetFactoryInst::destruct();
|
||||
delete _pcSingleton;
|
||||
_pcSingleton=0;
|
||||
_pcSingleton=nullptr;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------
|
||||
@@ -254,13 +254,13 @@ void* PrefPagePyProducer::Produce () const
|
||||
QWidget* widget = new Gui::Dialog::PreferencePagePython(page);
|
||||
if (!widget->layout()) {
|
||||
delete widget;
|
||||
widget = 0;
|
||||
widget = nullptr;
|
||||
}
|
||||
return widget;
|
||||
}
|
||||
catch (Py::Exception&) {
|
||||
PyErr_Print();
|
||||
return 0;
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,7 +405,7 @@ void PyResource::init_type()
|
||||
add_varargs_method("connect",&PyResource::connect);
|
||||
}
|
||||
|
||||
PyResource::PyResource() : myDlg(0)
|
||||
PyResource::PyResource() : myDlg(nullptr)
|
||||
{
|
||||
}
|
||||
|
||||
@@ -462,7 +462,7 @@ void PyResource::load(const char* name)
|
||||
}
|
||||
}
|
||||
|
||||
QWidget* w=0;
|
||||
QWidget* w=nullptr;
|
||||
try {
|
||||
UiLoader loader;
|
||||
loader.setLanguageChangeEnabled(true);
|
||||
@@ -497,7 +497,7 @@ bool PyResource::connect(const char* sender, const char* signal, PyObject* cb)
|
||||
if ( !myDlg )
|
||||
return false;
|
||||
|
||||
QObject* objS=0L;
|
||||
QObject* objS=nullptr;
|
||||
QList<QWidget*> list = myDlg->findChildren<QWidget*>();
|
||||
QList<QWidget*>::const_iterator it = list.begin();
|
||||
QObject *obj;
|
||||
@@ -534,7 +534,7 @@ Py::Object PyResource::repr()
|
||||
/**
|
||||
* Searches for a widget and its value in the argument object \a args
|
||||
* to returns its value as Python object.
|
||||
* In the case it fails 0 is returned.
|
||||
* In the case it fails nullptr is returned.
|
||||
*/
|
||||
Py::Object PyResource::value(const Py::Tuple& args)
|
||||
{
|
||||
@@ -605,7 +605,7 @@ Py::Object PyResource::value(const Py::Tuple& args)
|
||||
/**
|
||||
* Searches for a widget, its value name and the new value in the argument object \a args
|
||||
* to set even this new value.
|
||||
* In the case it fails 0 is returned.
|
||||
* In the case it fails nullptr is returned.
|
||||
*/
|
||||
Py::Object PyResource::setValue(const Py::Tuple& args)
|
||||
{
|
||||
@@ -693,7 +693,7 @@ Py::Object PyResource::show(const Py::Tuple&)
|
||||
|
||||
/**
|
||||
* Searches for the sender, the signal and the callback function to connect with
|
||||
* in the argument object \a args. In the case it fails 0 is returned.
|
||||
* in the argument object \a args. In the case it fails nullptr is returned.
|
||||
*/
|
||||
Py::Object PyResource::connect(const Py::Tuple& args)
|
||||
{
|
||||
|
||||
@@ -55,8 +55,8 @@ public:
|
||||
static WidgetFactoryInst& instance();
|
||||
static void destruct ();
|
||||
|
||||
QWidget* createWidget (const char* sName, QWidget* parent=0) const;
|
||||
Gui::Dialog::PreferencePage* createPreferencePage (const char* sName, QWidget* parent=0) const;
|
||||
QWidget* createWidget (const char* sName, QWidget* parent=nullptr) const;
|
||||
Gui::Dialog::PreferencePage* createPreferencePage (const char* sName, QWidget* parent=nullptr) const;
|
||||
QWidget* createPrefWidget(const char* sName, QWidget* parent, const char* sPref);
|
||||
|
||||
private:
|
||||
@@ -330,7 +330,7 @@ private:
|
||||
class PyResource : public Py::PythonExtension<PyResource>
|
||||
{
|
||||
public:
|
||||
static void init_type(void); // announce properties and methods
|
||||
static void init_type(); // announce properties and methods
|
||||
|
||||
PyResource();
|
||||
~PyResource();
|
||||
@@ -383,7 +383,7 @@ class GuiExport PreferencePagePython : public PreferencePage
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PreferencePagePython(const Py::Object& dlg, QWidget* parent = 0);
|
||||
PreferencePagePython(const Py::Object& dlg, QWidget* parent = nullptr);
|
||||
virtual ~PreferencePagePython();
|
||||
|
||||
void loadSettings();
|
||||
|
||||
Reference in New Issue
Block a user