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. Sub-windows (Qdialogs) have "application" icons in DEBIAN task bar when re-opening them on program start-up
QtWS25 Last Chance

Sub-windows (Qdialogs) have "application" icons in DEBIAN task bar when re-opening them on program start-up

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 5 Posters 2.8k 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.
  • P Offline
    P Offline
    PALYGAP
    wrote on 25 Apr 2016, 08:09 last edited by
    #1

    My program re-opens any opened sub-windows (QDialog) that was opened when the program was stopped. Under DEBIAN I get a funny behavior that is every sub-windows re-opened on program start-up has an "application" icon in the task bar of the desktop like it was a proper application. If I closed these sub-windows and then re-open them there is only one application icon and no more "application" icon for the sub-windows. This only haapens at start-up and the code that does that is :

    void MainWindow::showEvent( QShowEvent* event ) {
    QMainWindow::showEvent( event );
    if( settings.value(TheFirstQDialog_VISIBLE).toBool() )
    {
    dlgTheFirstQDialog()->init();
    dlgTheFirstQDialog()->setModal(false);
    dlgTheFirstQDialog()->show();
    }
    if( settings.value(TheSecongQDialog_VISIBLE).toBool() )
    {
    dlgTheSecongQDialog()->init();
    dlgTheSecongQDialog()->setModal(false);
    dlgTheSecongQDialog()->show();
    }
    }

    1 Reply Last reply
    0
    • S Offline
      S Offline
      SGaist
      Lifetime Qt Champion
      wrote on 25 Apr 2016, 21:17 last edited by
      #2

      Hi,

      What does init do ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • E Offline
        E Offline
        elveatles
        wrote on 27 Apr 2016, 01:04 last edited by
        #3

        @PALYGAP

        Are you sure you're setting the dialogs' parents to the main window when you create them? This could be happening if their parent is None.

        1 Reply Last reply
        1
        • P Offline
          P Offline
          PALYGAP
          wrote on 28 Apr 2016, 12:50 last edited by
          #4

          @SGaist : The init fonctions reads some QSettings and restores the geometry of the each QDialog then initiates and set properties of Widgets belonging to the QDialog.

          @elveates : Yes, AFAIK. Here is the code :
          TheFirstQDialog::TheFirstQDialog(QWidget *parent) :
          QDialog(parent),
          ui(new Ui::TheFirstQDialog),
          m_setup(false),
          m_initMode(false)
          {
          ui->setupUi(this);
          ..............................
          init();
          }

          K 1 Reply Last reply 28 Apr 2016, 20:34
          0
          • S Offline
            S Offline
            SGaist
            Lifetime Qt Champion
            wrote on 28 Apr 2016, 20:32 last edited by
            #5

            What if you call init after show ?

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • P PALYGAP
              28 Apr 2016, 12:50

              @SGaist : The init fonctions reads some QSettings and restores the geometry of the each QDialog then initiates and set properties of Widgets belonging to the QDialog.

              @elveates : Yes, AFAIK. Here is the code :
              TheFirstQDialog::TheFirstQDialog(QWidget *parent) :
              QDialog(parent),
              ui(new Ui::TheFirstQDialog),
              m_setup(false),
              m_initMode(false)
              {
              ui->setupUi(this);
              ..............................
              init();
              }

              K Offline
              K Offline
              kshegunov
              Moderators
              wrote on 28 Apr 2016, 20:34 last edited by
              #6

              @PALYGAP
              Can you provide your MainWindow constructor as well (I think this is what @elveatles had in mind)?

              Read and abide by the Qt Code of Conduct

              1 Reply Last reply
              0
              • P Offline
                P Offline
                PALYGAP
                wrote on 29 Apr 2016, 07:13 last edited by
                #7

                @SGaist : Tried putting init() after show() but no change in behaviour.

                @kshegunov : Here is the MainWindow constructor

                MidyAX::MainWindow ( QWidget * parent, Qt::WindowFlags flags )
                : QMainWindow(parent, flags),
                // Quite a few variables init
                m_dlgTheFirstQDialog(0),
                m_dlgTheSecongQDialog(0),
                ......
                {
                ui.setupUi(this);
                ....
                }

                K 1 Reply Last reply 29 Apr 2016, 09:14
                0
                • P PALYGAP
                  29 Apr 2016, 07:13

                  @SGaist : Tried putting init() after show() but no change in behaviour.

                  @kshegunov : Here is the MainWindow constructor

                  MidyAX::MainWindow ( QWidget * parent, Qt::WindowFlags flags )
                  : QMainWindow(parent, flags),
                  // Quite a few variables init
                  m_dlgTheFirstQDialog(0),
                  m_dlgTheSecongQDialog(0),
                  ......
                  {
                  ui.setupUi(this);
                  ....
                  }

                  K Offline
                  K Offline
                  kshegunov
                  Moderators
                  wrote on 29 Apr 2016, 09:14 last edited by
                  #8

                  @PALYGAP

                  So, as @elveatles suggested, create your dialogs with parent:

                  m_dlgTheFirstQDialog(0),
                  m_dlgTheSecongQDialog(0),
                  

                  These two don't have a parent and are free flowing.

                  Read and abide by the Qt Code of Conduct

                  1 Reply Last reply
                  1
                  • P Offline
                    P Offline
                    PALYGAP
                    wrote on 29 Apr 2016, 11:15 last edited by
                    #9

                    OK, didn't thought it had to be done there, but it makes sense why should it be any different. When I was opening the dialog throuoght the proper "init" : TheFirstQDialog::TheFirstQDialog(QWidget *parent) : QDialog(parent).

                    Thanks a lot.

                    1 Reply Last reply
                    0
                    • P Offline
                      P Offline
                      PALYGAP
                      wrote on 30 Apr 2016, 17:39 last edited by
                      #10

                      Actually the problem is not solved, the instructions :
                      m_dlgTheFirstQDialog(0),
                      m_dlgTheSecongQDialog(0),
                      in the constructor of the main windows are just pointers to the QDialogs.

                      The real call to the child QDialog creators are here :

                      TheFirstQDialog* MainWindow::dlgTheFirstQDialog()
                      {
                      if (m_dlgTheFirstQDialog == 0) {
                      m_dlgTheFirstQDialog= new TheFirstQDialog(this);
                      }
                      return m_dlgTheFirstQDialog;
                      }
                      TheSecongQDialog* MainWindow::dlgTheSecongQDialog()
                      {
                      if (m_dlgTheSecongQDialog == 0) {
                      m_dlgTheSecongQDialog = new TheSecongQDialog(this);
                      }
                      return m_dlgTheSecongQDialog;
                      }

                      this is the pointer to the MainWindow and I checked in the degugger it is set to the right value in the Qdialog constructor :
                      TheFirstQDialog::TheFirstQDialog(QWidget *parent) :
                      QDialog(parent),
                      ui(new Ui::TheFirstQDialog),
                      m_setup(false),
                      m_initMode(false)
                      {
                      .....
                      }

                      K 1 Reply Last reply 30 Apr 2016, 20:33
                      0
                      • P PALYGAP
                        30 Apr 2016, 17:39

                        Actually the problem is not solved, the instructions :
                        m_dlgTheFirstQDialog(0),
                        m_dlgTheSecongQDialog(0),
                        in the constructor of the main windows are just pointers to the QDialogs.

                        The real call to the child QDialog creators are here :

                        TheFirstQDialog* MainWindow::dlgTheFirstQDialog()
                        {
                        if (m_dlgTheFirstQDialog == 0) {
                        m_dlgTheFirstQDialog= new TheFirstQDialog(this);
                        }
                        return m_dlgTheFirstQDialog;
                        }
                        TheSecongQDialog* MainWindow::dlgTheSecongQDialog()
                        {
                        if (m_dlgTheSecongQDialog == 0) {
                        m_dlgTheSecongQDialog = new TheSecongQDialog(this);
                        }
                        return m_dlgTheSecongQDialog;
                        }

                        this is the pointer to the MainWindow and I checked in the degugger it is set to the right value in the Qdialog constructor :
                        TheFirstQDialog::TheFirstQDialog(QWidget *parent) :
                        QDialog(parent),
                        ui(new Ui::TheFirstQDialog),
                        m_setup(false),
                        m_initMode(false)
                        {
                        .....
                        }

                        K Offline
                        K Offline
                        kshegunov
                        Moderators
                        wrote on 30 Apr 2016, 20:33 last edited by
                        #11

                        @PALYGAP
                        That's curious. Can you prepare a minimal example that reproduces this, I could run it on my machine (I'm using Debian)?

                        Read and abide by the Qt Code of Conduct

                        1 Reply Last reply
                        0
                        • P Offline
                          P Offline
                          PALYGAP
                          wrote on 1 May 2016, 10:49 last edited by
                          #12

                          Ok I'll try to do that this Week.

                          1 Reply Last reply
                          0
                          • P Offline
                            P Offline
                            PALYGAP
                            wrote on 31 Jan 2017, 05:13 last edited by PALYGAP
                            #13

                            I have installed an new DEBIAN (Linux debian64SMP 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30) x86_64 GNU) with GNOME 3.14..1 in a new VirtualBox. I installed Qt5.8.0 and Qt Creator 4.2.1 and recompiled my applications. There are still as many application icon in the "task bar" as there are dialogs. The thing that has improved is that main dialog (main window) that I could not activate (or Alt-tab) to before if another dialog was open is now accessible.

                            Still don't understand why there is an icon in the "task bar" for each dialog of the application.

                            jsulmJ 1 Reply Last reply 31 Jan 2017, 05:23
                            0
                            • P PALYGAP
                              31 Jan 2017, 05:13

                              I have installed an new DEBIAN (Linux debian64SMP 3.16.0-4-amd64 #1 SMP Debian 3.16.39-1 (2016-12-30) x86_64 GNU) with GNOME 3.14..1 in a new VirtualBox. I installed Qt5.8.0 and Qt Creator 4.2.1 and recompiled my applications. There are still as many application icon in the "task bar" as there are dialogs. The thing that has improved is that main dialog (main window) that I could not activate (or Alt-tab) to before if another dialog was open is now accessible.

                              Still don't understand why there is an icon in the "task bar" for each dialog of the application.

                              jsulmJ Offline
                              jsulmJ Offline
                              jsulm
                              Lifetime Qt Champion
                              wrote on 31 Jan 2017, 05:23 last edited by jsulm
                              #14

                              @PALYGAP Well, I guess it is how window manager handles it (the one used by Gnome in your case), it is not Qt related.
                              If you were not able to access main window when a dialog was shown then I guess you used a modal dialog (calling exec() on it instead of show) - this is expected behaviour. Use show() if you want to be able to switch between dialogs/main window.

                              https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • P Offline
                                P Offline
                                PALYGAP
                                wrote on 31 Jan 2017, 09:06 last edited by
                                #15

                                @jsulm it could be. The thing is for the dialog (representing MIDI Controllers) I use QDialog::show(). I only use exec() for some error message QDialog or config dialog. So I can have the QMainWindow and several QDialog displayed with show() at the same time. They will all have one icon in the "task bar". The "not able to access main window when a dialog was shown" behavior was not wanted and none of the QDialogs (MIDI controller) were shown with modal exec(). Maybe it was just a bug of the previous GNOME environment that I was using. :)

                                1 Reply Last reply
                                0

                                • Login

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