Skip to content
Extraits de code Groupes Projets
Vérifiée Valider f396541f rédigé par Kubat's avatar Kubat
Parcourir les fichiers

LIB: Add the getMainWindow to the VivyApplication

parent 80ce325b
Aucune branche associée trouvée
Aucune étiquette associée trouvée
1 requête de fusion!17Api update
...@@ -57,8 +57,8 @@ VivyApplication::exec() noexcept ...@@ -57,8 +57,8 @@ VivyApplication::exec() noexcept
setCursorFlashTime(0); setCursorFlashTime(0);
// Show the main window // Show the main window
MainWindow mainWindow; mainWindowPtr = std::make_unique<MainWindow>();
mainWindow.show(); mainWindowPtr->show();
// Main loop // Main loop
return QApplication::exec(); return QApplication::exec();
...@@ -83,3 +83,11 @@ VivyApplication::getApplicationFont(Font id) const noexcept ...@@ -83,3 +83,11 @@ VivyApplication::getApplicationFont(Font id) const noexcept
// Let the program crash // Let the program crash
qFatal("UNREACHABLE"); qFatal("UNREACHABLE");
} }
MainWindow *
VivyApplication::getMainWindow() const
{
if (!mainWindowPtr)
throw std::logic_error("No main window in the graphic VivyApplication");
return mainWindowPtr.get();
}
...@@ -33,6 +33,9 @@ ...@@ -33,6 +33,9 @@
namespace Vivy namespace Vivy
{ {
class MainWindow;
// Vivy application class
class VivyApplication : public QApplication { class VivyApplication : public QApplication {
Q_OBJECT Q_OBJECT
...@@ -59,12 +62,15 @@ private: ...@@ -59,12 +62,15 @@ private:
int fontIdBold; int fontIdBold;
int fontIdBoldItalic; int fontIdBoldItalic;
std::unique_ptr<MainWindow> mainWindowPtr{ nullptr };
public: public:
VivyApplication(int &argc, char **argv); VivyApplication(int &argc, char **argv);
int exec() noexcept; int exec() noexcept;
QFont getApplicationFont(Font) const noexcept; QFont getApplicationFont(Font) const noexcept;
[[nodiscard("handle-it")]] MainWindow *getMainWindow() 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