File indexing completed on 2025-01-19 04:25:16
0001 /* 0002 * Replacement fot QT Bindings that were removed from QT5 0003 * Copyright (C) 2020 Pedro de Carvalho Gomes <pedrogomes81@gmail.com> 0004 * 0005 * This program is free software: you can redistribute it and/or modify 0006 * it under the terms of the GNU General Public License as published by 0007 * the Free Software Foundation, either version 3 of the License, or 0008 * (at your option) any later version. 0009 * 0010 * This program is distributed in the hope that it will be useful, 0011 * but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 0013 * GNU General Public License for more details. 0014 * 0015 * You should have received a copy of the GNU General Public License 0016 * along with this program. If not, see <http://www.gnu.org/licenses/>. 0017 */ 0018 0019 #ifndef UITOOLSUILOADER_H 0020 #define UITOOLSUILOADER_H 0021 0022 #include "QtBinding.h" 0023 #include <QFile> 0024 #include <QUiLoader> 0025 #include <QDialogButtonBox> 0026 0027 namespace QtBindings 0028 { 0029 namespace UiTools 0030 { 0031 class UiLoader : public QUiLoader, public QtBindings::Base<UiLoader> 0032 { 0033 Q_OBJECT 0034 public: 0035 Q_INVOKABLE UiLoader(QObject *parent = Q_NULLPTR); 0036 Q_INVOKABLE UiLoader(const UiLoader &other); 0037 Q_INVOKABLE UiLoader(const QJSValue &other); 0038 Q_INVOKABLE virtual ~UiLoader(); 0039 UiLoader &operator=(const UiLoader &other); 0040 public slots: 0041 void addPluginPath(const QString &path); 0042 QStringList availableLayouts() const; 0043 QStringList availableWidgets() const; 0044 void clearPluginPaths(); 0045 virtual QAction *createAction(QObject *parent = Q_NULLPTR, const QString &name = QString()) override; 0046 virtual QActionGroup *createActionGroup(QObject *parent = Q_NULLPTR, const QString &name = QString()) override; 0047 virtual QLayout *createLayout(const QString &className, QObject *parent = Q_NULLPTR, const QString &name = QString()) override; 0048 virtual QWidget *createWidget(const QString &className, QWidget *parent = Q_NULLPTR, const QString &name = QString()) override; 0049 QString errorString() const; 0050 bool isLanguageChangeEnabled() const; 0051 QJSValue load(QFile *device, QJSValue parentWidget); 0052 QStringList pluginPaths() const; 0053 void setLanguageChangeEnabled(bool enabled); 0054 void setWorkingDirectory(const QDir &dir); 0055 QDir workingDirectory() const; 0056 }; 0057 } 0058 } 0059 Q_DECLARE_METATYPE(QtBindings::UiTools::UiLoader) 0060 #endif //UITOOLSUILOADER_H