0

Currently I am writing a C++ Qt GUI standard (i.e. via Qt Creator) application.

Basically, what I am trying to do is an application, which operates the following singleton classes:

  1. a MainWindow class, which is responsible for the core logic;
  2. a ServerWindow class, which is responsible for the server connection;
  3. a User class, which is returned (in form of a pointer) by the ServerWindow class after successfull authentication;
  4. a Data class, which is initialized with the data, recieved via ServerWindow upon user authentication.

    The algorithm is:
  5. Construct a MainWindow and create a Data class; it also holds a pointer (nullptr at this step) at the current user.
  6. When the constructor has finished, the ServerWindow (derived from QDialog) is executed (via Qt delayed connection). At this step the MainWindow is frozen and set invisible, untill the ServerWindow emits one of the signals (logged, fail). The ServerWindow has a modal mode flag set.
  7. When the ServerWindow is done, a pointer to the current user is passed to the MainWindow. The ServerWindow also knows about the Data class and initializes it.

The main problem is that at step 2 the application icon in the taskbar (I use Windows OS) is not shown. When the MainWindow is "offline" (i.e., not shown, invisible via setVisibility(false)), there is no icon. It is highly annoying, especially if there is a bunch of other applications open. So that, my question is: what can I do to make ServerWindow create an application icon in the taskbar without MainWindow being shown?

The additional, by-the-way question is about possible application architecture remastering. I cannot find any books in my small library about similar applications designing. Frankly, I cannot even figure out, which words I should pass to the Google search line. Any advice?

Preliminary, thanks for any answers!

6
  • 1
    All the singleton classes don’t need to be singletons. Forget about that idea, it’s entirely unnecessary. Any notion of “frozen” windows is going to lead to abhorrent user experience – a hidden window is not frozen. I’ll elaborate some more later. Commented Dec 24, 2018 at 21:14
  • 4
    Business logic being tied to UI like that is code smell. Commented Dec 24, 2018 at 21:20
  • Singletons are in my opinion (and I'm not alone) an anti-pattern. They lead to tight coupling, problems with destruction if multiple singletons depend on each other, the whole initialization-order-fiasco thing and more. They are too moch pain for too little gain in most cases and I personally consider their use a code smell. Commented Dec 24, 2018 at 21:34
  • Do you want an icon in the task tray (like the volume and date in the bottom right corner)? Or did you mean a minimized task bar where most applications are accessible when minimized?
    – selbie
    Commented Dec 24, 2018 at 21:36
  • @selbie, yes, I mean a task bar, NOT the tray. Commented Dec 25, 2018 at 20:27

0

Browse other questions tagged or ask your own question.