Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Running action at start of the programm
Forum Update on Monday, May 27th 2025

Running action at start of the programm

Scheduled Pinned Locked Moved Unsolved General and Desktop
3 Posts 3 Posters 196 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    HalfTough
    wrote on last edited by
    #1

    I have my custom class inheriting QMainWindow and I want it to show a dialog as the very first thing that happens when application starts.

    My first idea, was to run exec() on dialog in constructor of my class, but it meant code would run before QApplication.exec() and I don't think that should be the case.

    How do I handle actions, that should happen before user does anything or main window is even shown?

    JonBJ 1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Simply use a signal/slot connection to call show() only when the login screen was successful.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      3
      • H HalfTough

        I have my custom class inheriting QMainWindow and I want it to show a dialog as the very first thing that happens when application starts.

        My first idea, was to run exec() on dialog in constructor of my class, but it meant code would run before QApplication.exec() and I don't think that should be the case.

        How do I handle actions, that should happen before user does anything or main window is even shown?

        JonBJ Offline
        JonBJ Offline
        JonB
        wrote on last edited by JonB
        #3

        @HalfTough
        Another possibility is that your case may be remarkably similar to the recent https://forum.qt.io/topic/109802/how-can-i-show-an-other-widget-or-dialog-before-mainwindow ? There a QSplashScreen turned out to be just what was wanted.

        1 Reply Last reply
        1

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved