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. Multiple app icons on launch bar for single Qt app

Multiple app icons on launch bar for single Qt app

Scheduled Pinned Locked Moved Unsolved General and Desktop
12 Posts 4 Posters 1.9k Views 2 Watching
  • 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.
  • jsulmJ jsulm

    @dalishi said in Multiple app icons on launch bar for single Qt app:

    it closes

    Do you delete that dialog also?

    D Offline
    D Offline
    dalishi
    wrote on last edited by
    #3

    @jsulm i'm using

    int id = QInputDialog::getInt(this, tr("Domain id"), tr("domain_id:"), 0, 0, 100, 1, &ok); 
    

    Have no idea how to delete?

    J.HilkJ jsulmJ 2 Replies Last reply
    0
    • D dalishi

      @jsulm i'm using

      int id = QInputDialog::getInt(this, tr("Domain id"), tr("domain_id:"), 0, 0, 100, 1, &ok); 
      

      Have no idea how to delete?

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by J.Hilk
      #4

      @dalishi is this inside main?
      with a this pointer I can answer my question with no, it's not...


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      D 1 Reply Last reply
      0
      • D dalishi

        @jsulm i'm using

        int id = QInputDialog::getInt(this, tr("Domain id"), tr("domain_id:"), 0, 0, 100, 1, &ok); 
        

        Have no idea how to delete?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #5

        @dalishi No need to delete in this case.
        I don't know why this happens, could be an issue in Canonicals Unity desktop environment. Did you test with any other Linux desktop environment?

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

        D 1 Reply Last reply
        0
        • J.HilkJ J.Hilk

          @dalishi is this inside main?
          with a this pointer I can answer my question with no, it's not...

          D Offline
          D Offline
          dalishi
          wrote on last edited by
          #6

          @J.Hilk This is inside the constructor of my main window which is inherited from MainOpenGLWidget.

          1 Reply Last reply
          0
          • jsulmJ jsulm

            @dalishi No need to delete in this case.
            I don't know why this happens, could be an issue in Canonicals Unity desktop environment. Did you test with any other Linux desktop environment?

            D Offline
            D Offline
            dalishi
            wrote on last edited by
            #7

            @jsulm i have not tested on other linux desktops. Funny thing is this happens most of the time but not all the time. Very few time it works fine with one single app icon shown.

            jsulmJ 1 Reply Last reply
            0
            • D dalishi

              @jsulm i have not tested on other linux desktops. Funny thing is this happens most of the time but not all the time. Very few time it works fine with one single app icon shown.

              jsulmJ Offline
              jsulmJ Offline
              jsulm
              Lifetime Qt Champion
              wrote on last edited by
              #8

              @dalishi Try to remove it from where and call it in main instead

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

              D 1 Reply Last reply
              0
              • jsulmJ jsulm

                @dalishi Try to remove it from where and call it in main instead

                D Offline
                D Offline
                dalishi
                wrote on last edited by dalishi
                #9

                @jsulm Hi i move the call to main however the content of the window does not draw.

                    bool ok;
                    int domain_id = QInputDialog::getInt(nullptr, QObject::tr("Domain id"),
                                                   QObject::tr("domain_id:"), 0, 0, 100, 1, &ok);
                
                    if (ok) { // ok pressed
                        MainWindow w(domain_id);
                        w.show();
                    } else {
                        // do nothing
                    }
                    return a.exec();
                

                Remove the if-else it works....

                    bool ok;
                    int domain_id = QInputDialog::getInt(nullptr, QObject::tr("Domain id"),
                                                   QObject::tr("domain_id:"), 0, 0, 100, 1, &ok);
                
                    MainWindow w(domain_id);
                    w.show();
                    
                    return a.exec();
                
                J.HilkJ 1 Reply Last reply
                0
                • D dalishi

                  @jsulm Hi i move the call to main however the content of the window does not draw.

                      bool ok;
                      int domain_id = QInputDialog::getInt(nullptr, QObject::tr("Domain id"),
                                                     QObject::tr("domain_id:"), 0, 0, 100, 1, &ok);
                  
                      if (ok) { // ok pressed
                          MainWindow w(domain_id);
                          w.show();
                      } else {
                          // do nothing
                      }
                      return a.exec();
                  

                  Remove the if-else it works....

                      bool ok;
                      int domain_id = QInputDialog::getInt(nullptr, QObject::tr("Domain id"),
                                                     QObject::tr("domain_id:"), 0, 0, 100, 1, &ok);
                  
                      MainWindow w(domain_id);
                      w.show();
                      
                      return a.exec();
                  
                  J.HilkJ Offline
                  J.HilkJ Offline
                  J.Hilk
                  Moderators
                  wrote on last edited by
                  #10

                  @dalishi

                  well yes, of course, as soon as the scope closes } the MainWindow is destroyed, as it is on the stack and only exists inside the scope of the if condition!


                  Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


                  Q: What's that?
                  A: It's blue light.
                  Q: What does it do?
                  A: It turns blue.

                  1 Reply Last reply
                  3
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #11

                    hi
                    Seems you just want.

                     MainWindow w(domain_id);
                     if (ok) { // ok pressed
                            w.show();
                        } else {
                            // do nothing
                        }
                        return a.exec();
                    
                    D 1 Reply Last reply
                    3
                    • mrjjM mrjj

                      hi
                      Seems you just want.

                       MainWindow w(domain_id);
                       if (ok) { // ok pressed
                              w.show();
                          } else {
                              // do nothing
                          }
                          return a.exec();
                      
                      D Offline
                      D Offline
                      dalishi
                      wrote on last edited by dalishi
                      #12

                      @mrjj Hi thanks for the code. However, in this way, the mainwindow will be constructed anyway no matter the user click OK or Cancel. So i come up with the following:

                          bool ok;
                          int domain_id = QInputDialog::getInt(nullptr, QObject::tr("Domain id"),
                                                         QObject::tr("domain_id:"), 0, 0, 100, 1, &ok);
                      
                          if (ok) { // ok pressed
                              MainWindow w(domain_id);
                              w.show();
                              return a.exec();
                          } else { // Cancel pressed or message box closed
                              return 0;
                          }
                      

                      However, this still can not solve the double app icon problem. It seems randomly the first dialog icon just does not want to disappear.

                      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