{ // Avoid name clash Shiboken::AutoDecRef regFunc((PyObject*)NULL); Shiboken::AutoDecRef atexit(Shiboken::Module::import("atexit")); if (atexit.isNull()) { qWarning() << "Module atexit not found for registering __moduleShutdown"; PyErr_Clear(); }else{ regFunc.reset(PyObject_GetAttrString(atexit, "register")); if (regFunc.isNull()) { qWarning() << "Function atexit.register not found for registering __moduleShutdown"; PyErr_Clear(); } } if (!atexit.isNull() && !regFunc.isNull()){ PyObject *shutDownFunc = PyObject_GetAttrString(module, "__moduleShutdown"); Shiboken::AutoDecRef args(PyTuple_New(1)); PyTuple_SET_ITEM(args, 0, shutDownFunc); Shiboken::AutoDecRef retval(PyObject_Call(regFunc, args, 0)); Q_ASSERT(!retval.isNull()); } } Returns a read only buffer object pointing to the segment of data that this resource represents. If the resource is compressed the data returns is compressed and qUncompress() must be used to access the data. If the resource is a directory None is returned. To find the child of a certain QObject, the first argument of this function should be the child's type, and the second the name of the child: :: ... parent = QWidget() ... # The first argument must be the child type child1 = parent.findChild(QPushButton, "child_button") child2 = parent.findChild(QWidget, "child_widget") Like the method *findChild*, the first parameter should be the child's type. Replaces every occurrence of the regular expression in *sourceString* with *after*. Returns a new Python string with the modified contents. For example: :: s = "Banana" re = QRegExp("a[mn]") s = re.replace(s, "ox") # s == "Boxoxa" For regular expressions containing capturing parentheses, occurrences of \1, \2, ..., in *after* are replaced with rx.cap(1), cap(2), ... :: t = "A <i>bon mot</i>." re = QRegExp("<i>([^<]*)</i>") t = re.replace(t, "\\emph{\\1}") # t == "A \\emph{bon mot}." QByteArray ba(1 + int(%2), char(0)); %CPPSELF.%FUNCTION_NAME(ba.data(), int(%2)); %PYARG_0 = Shiboken::String::fromCString(ba.constData()); %RETURN_TYPE %out = 0; if (PyBytes_Check(%PYARG_0)) { %out = PyBytes_GET_SIZE((PyObject*)%PYARG_0); memcpy(%1, PyBytes_AS_STRING((PyObject*)%PYARG_0), %out); } else if (Shiboken::String::check(%PYARG_0)) { %out = Shiboken::String::len((PyObject*)%PYARG_0); memcpy(%1, Shiboken::String::toCString((PyObject*)%PYARG_0), %out); } QByteArray ba(1 + int(%2), char(0)); %CPPSELF.%FUNCTION_NAME(ba.data(), int(%2)); %PYARG_0 = Shiboken::String::fromCString(ba.constData()); %RETURN_TYPE %out = 0; if (PyBytes_Check(%PYARG_0)) { %out = PyBytes_GET_SIZE((PyObject*)%PYARG_0); memcpy(%1, PyBytes_AS_STRING((PyObject*)%PYARG_0), %out); } else if (Shiboken::String::check(%PYARG_0)) { %out = Shiboken::String::len((PyObject*)%PYARG_0); memcpy(%1, Shiboken::String::toCString((PyObject*)%PYARG_0), %out); } .. class:: QCoreApplication(args) Constructs a Qt kernel application. Kernel applications are applications without a graphical user interface. These type of applications are used at the console or as server processes. The *args* argument is processed by the application, and made available in a more convenient form by the :meth:`~QCoreApplication.arguments()` method. .. warning:: QSettings.value can return different types (QVariant types) depending on the platform it's running on, so the safest way to use it is always casting the result to the desired type, e.g.: int(settings.value("myKey")) QString &res = *%0; %PYARG_0 = %CONVERTTOPYTHON[QString](res); <code>machine = QStateMachine() s1 = QState() s11 = QState(s1) s12 = QState(s1) s1h = QHistoryState(s1) s1h.setDefaultState(s11) machine.addState(s1) s2 = QState() machine.addState(s2) button = QPushButton() # Clicking the button will cause the state machine to enter the child state # that s1 was in the last time s1 was exited, or the history state's default # state if s1 has never been entered. s1.addTransition(button.clicked, s1h)</code>