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. [SOLVED] Put application on notification bar.

[SOLVED] Put application on notification bar.

Scheduled Pinned Locked Moved Solved General and Desktop
applicationnotificationdesktopbar
12 Posts 3 Posters 4.7k 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.
  • V Offline
    V Offline
    vibolvireak
    wrote on last edited by vibolvireak
    #1

    Hello is there anyway to hide and put application on notification bar?

    1 Reply Last reply
    0
    • Hamed.MasafiH Offline
      Hamed.MasafiH Offline
      Hamed.Masafi
      wrote on last edited by
      #2

      Use QSystemTrayIcon

      Remote object sharing (OO RPC)
      http://forum.qt.io/topic/60680/remote-object-sharing-oo-rpc-solved

      Advanced, Powerful and easy to use ORM for Qt5
      https://forum.qt.io/topic/67417/advanced-powerful-and-easy-to-use-orm-for-qt5

      1 Reply Last reply
      2
      • V Offline
        V Offline
        vibolvireak
        wrote on last edited by
        #3

        @Hamed-Masafi I'm really thank you for your help. Do you know how to hide and application if user click on close bt on the top-right of the windows ?

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mcosta
          wrote on last edited by mcosta
          #4

          Hi and welcome to devnet,

          you could try to reimplement the QWidget::closeEvent() then call hide() and reject the event.

          Anyway you have to provide a way to really quit from you application.

          Once your problem is solved don't forget to:

          • Mark the thread as SOLVED using the Topic Tool menu
          • Vote up the answer(s) that helped you to solve the issue

          You can embed images using (http://imgur.com/) or (http://postimage.org/)

          V 1 Reply Last reply
          1
          • M mcosta

            Hi and welcome to devnet,

            you could try to reimplement the QWidget::closeEvent() then call hide() and reject the event.

            Anyway you have to provide a way to really quit from you application.

            V Offline
            V Offline
            vibolvireak
            wrote on last edited by
            #5

            @mcosta Hello, thank for help :) let me apology for less education with c++ i just start today. I have append the code MainWindow.cpp

            void MainWindow::closeEvent(QCloseEvent *event){

            }

            And i got error message
            no 'void MainWindow::closeEvent(QCloseEvent*)' member function declared in class 'MainWindow'

            I'm thank for help

            1 Reply Last reply
            0
            • M Offline
              M Offline
              mcosta
              wrote on last edited by
              #6

              Hi,

              you have to put

              void closeEvent(QCloseEvent*);
              

              in the protected part of your class declaration

              Once your problem is solved don't forget to:

              • Mark the thread as SOLVED using the Topic Tool menu
              • Vote up the answer(s) that helped you to solve the issue

              You can embed images using (http://imgur.com/) or (http://postimage.org/)

              V 1 Reply Last reply
              0
              • M mcosta

                Hi,

                you have to put

                void closeEvent(QCloseEvent*);
                

                in the protected part of your class declaration

                V Offline
                V Offline
                vibolvireak
                wrote on last edited by
                #7

                *@mcosta Hello i have put void closeEvent(QCloseEvent); on the protected line of my header file. And the run look successfully however. i got error message when i try to use event->ignore(); in

                void MainWindow::closeEvent(QCloseEvent *event){
                QMessageBox::information(this, "Comfirmed", "We will hide your application");
                if(QMessageBox::Ok){
                event->ignore();
                }
                }

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mcosta
                  wrote on last edited by
                  #8

                  Your code should be like this

                  void MainWindow::closeEvent(QCloseEvent *event){
                      int result = QMessageBox::information(this, "Comfirmed", "We will hide your application");
                      if(QMessageBox::Ok == result) {
                          event->ignore();
                      }
                  }
                  

                  anyway is better to post also the error.

                  Once your problem is solved don't forget to:

                  • Mark the thread as SOLVED using the Topic Tool menu
                  • Vote up the answer(s) that helped you to solve the issue

                  You can embed images using (http://imgur.com/) or (http://postimage.org/)

                  V 1 Reply Last reply
                  0
                  • M mcosta

                    Your code should be like this

                    void MainWindow::closeEvent(QCloseEvent *event){
                        int result = QMessageBox::information(this, "Comfirmed", "We will hide your application");
                        if(QMessageBox::Ok == result) {
                            event->ignore();
                        }
                    }
                    

                    anyway is better to post also the error.

                    V Offline
                    V Offline
                    vibolvireak
                    wrote on last edited by
                    #9

                    @mcosta Obb look like i forgot. i got error "In member function 'virtual void MainWindow::closeEvent(QCloseEvent*)'"

                    1 Reply Last reply
                    0
                    • V Offline
                      V Offline
                      vibolvireak
                      wrote on last edited by
                      #10

                      Update:
                      C:\Users\vibolvireak\Documents\Clossdrive\mainwindow.cpp:25: error: invalid use of incomplete type 'class QCloseEvent'
                      event->ignore();
                      ^

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        mcosta
                        wrote on last edited by
                        #11

                        you have a missing include

                        #include <QCloseEvent>
                        

                        NOTE: IMO you're some weakness in C++. I Suggest to study a little bit more the language

                        Once your problem is solved don't forget to:

                        • Mark the thread as SOLVED using the Topic Tool menu
                        • Vote up the answer(s) that helped you to solve the issue

                        You can embed images using (http://imgur.com/) or (http://postimage.org/)

                        V 1 Reply Last reply
                        1
                        • M mcosta

                          you have a missing include

                          #include <QCloseEvent>
                          

                          NOTE: IMO you're some weakness in C++. I Suggest to study a little bit more the language

                          V Offline
                          V Offline
                          vibolvireak
                          wrote on last edited by
                          #12

                          @mcosta Thank you it all finally working fine :)

                          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