static PyObject *meth_QFileSystemWatcher_addPaths(PyObject *sipSelf, PyObject *sipArgs) { PyObject *sipParseErr = NULL; { const QStringList* a0; int a0State = 0; QFileSystemWatcher *sipCpp; if (sipParseArgs(&sipParseErr, sipArgs, "BJ1", &sipSelf, sipType_QFileSystemWatcher, &sipCpp, sipType_QStringList,&a0, &a0State)) { Py_BEGIN_ALLOW_THREADS sipCpp->addPaths(*a0); Py_END_ALLOW_THREADS sipReleaseType(const_cast<QStringList *>(a0),sipType_QStringList,a0State); Py_INCREF(Py_None); return Py_None; } } /* Raise an exception if the arguments couldn't be parsed. */ sipNoMethod(sipParseErr, sipName_QFileSystemWatcher, sipName_addPaths, doc_QFileSystemWatcher_addPaths); return NULL; }
CategoriesModel::CategoriesModel(QObject *parent) : QAbstractListModel(parent) , m_allCategory(true) { refresh(); QFileSystemWatcher *watcher = new QFileSystemWatcher(this); watcher->addPaths(xdgApplicationsPaths()); connect(watcher, &QFileSystemWatcher::directoryChanged, this, [this](const QString &) { refresh(); }); }