Skip to content
Extraits de code Groupes Projets
Valider 4e0c072e rédigé par Elliu's avatar Elliu
Parcourir les fichiers

Add getCurrentVivyDocument

parent f396541f
Branches
Aucune étiquette associée trouvée
1 requête de fusion!17Api update
...@@ -91,3 +91,14 @@ VivyApplication::getMainWindow() const ...@@ -91,3 +91,14 @@ VivyApplication::getMainWindow() const
throw std::logic_error("No main window in the graphic VivyApplication"); throw std::logic_error("No main window in the graphic VivyApplication");
return mainWindowPtr.get(); return mainWindowPtr.get();
} }
/*
* @return the current VivyDocument, or null if there isn't one or if the current document is not a VivyDocument
*/
VivyDocument *
VivyApplication::getCurrentVivyDocument() const
{
if (!mainWindowPtr)
throw std::logic_error("No main window in the graphic VivyApplication");
return dynamic_cast<VivyDocument*>(mainWindowPtr.get()->getCurrentDocument());
}
...@@ -71,6 +71,7 @@ public: ...@@ -71,6 +71,7 @@ public:
QFont getApplicationFont(Font) const noexcept; QFont getApplicationFont(Font) const noexcept;
[[nodiscard("handle-it")]] MainWindow *getMainWindow() const; [[nodiscard("handle-it")]] MainWindow *getMainWindow() const;
[[nodiscard("handle-it")]] VivyDocument *getCurrentVivyDocument() const;
void setTheme(Theme) noexcept; void setTheme(Theme) noexcept;
}; };
......
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Veuillez vous inscrire ou vous pour commenter