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
Ce commit fait partie de la requête de fusion !17. Les commentaires créés ici seront créés dans le contexte de cette requête de fusion.
......@@ -57,8 +57,8 @@ VivyApplication::exec() noexcept
setCursorFlashTime(0);
// Show the main window
MainWindow mainWindow;
mainWindow.show();
mainWindowPtr = std::make_unique<MainWindow>();
mainWindowPtr->show();
// Main loop
return QApplication::exec();
......@@ -83,3 +83,11 @@ VivyApplication::getApplicationFont(Font id) const noexcept
// Let the program crash
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 @@
namespace Vivy
{
class MainWindow;
// Vivy application class
class VivyApplication : public QApplication {
Q_OBJECT
......@@ -59,12 +62,15 @@ private:
int fontIdBold;
int fontIdBoldItalic;
std::unique_ptr<MainWindow> mainWindowPtr{ nullptr };
public:
VivyApplication(int &argc, char **argv);
int exec() noexcept;
QFont getApplicationFont(Font) const noexcept;
[[nodiscard("handle-it")]] MainWindow *getMainWindow() const;
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