diff options
author | saturneric <[email protected]> | 2024-11-27 20:23:51 +0000 |
---|---|---|
committer | saturneric <[email protected]> | 2024-11-27 20:23:51 +0000 |
commit | a83c6e28a16f998d89b956688f07ce5352a2864f (patch) | |
tree | 796ad69eee3add96df38e3e4f1dc78a82745a9db /src/ui/UIModuleManager.cpp | |
parent | fix: solve devops build issues (diff) | |
download | GpgFrontend-a83c6e28a16f998d89b956688f07ce5352a2864f.tar.gz GpgFrontend-a83c6e28a16f998d89b956688f07ce5352a2864f.zip |
feat: improve ui logic and support more email operations
Diffstat (limited to 'src/ui/UIModuleManager.cpp')
-rw-r--r-- | src/ui/UIModuleManager.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/src/ui/UIModuleManager.cpp b/src/ui/UIModuleManager.cpp index ed18f473..ba6172a4 100644 --- a/src/ui/UIModuleManager.cpp +++ b/src/ui/UIModuleManager.cpp @@ -61,7 +61,7 @@ auto UIModuleManager::DeclareMountPoint( auto UIModuleManager::MountEntry(const QString& id, QMap<QString, QString> meta_data, - EntryFactory factory) -> bool { + QObjectFactory factory) -> bool { if (id.isEmpty() || !mount_points_.contains(id)) return false; if (factory == nullptr) return false; @@ -82,7 +82,7 @@ auto UIModuleManager::QueryMountedEntries(QString id) -> QList<MountedUIEntry> { } auto MountedUIEntry::GetWidget() const -> QWidget* { - return qobject_cast<QWidget*>(static_cast<QObject*>(factory_(id_.toUtf8()))); + return qobject_cast<QWidget*>(static_cast<QObject*>(factory_(nullptr))); } auto MountedUIEntry::GetMetaDataByDefault( @@ -176,4 +176,15 @@ void UIModuleManager::TranslateAllModulesParams() { #endif } +auto UIModuleManager::RegisterQObject(const QString& id, QObject* p) -> bool { + if (id.isEmpty() || registered_qobjects_.contains(id)) return false; + + registered_qobjects_[id] = p; + return true; +} + +auto UIModuleManager::GetQObject(const QString& id) -> QObject* { + return registered_qobjects_.value(id, nullptr); +} + } // namespace GpgFrontend::UI
\ No newline at end of file |