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.
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] Put application on notification bar.

Scheduled Pinned Locked Moved Solved General and Desktop
applicationnotificationdesktopbar
12 Posts 3 Posters 4.8k 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.
  • V Offline
    V Offline
    vibolvireak
    wrote on 16 Nov 2015, 06:23 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 16 Nov 2015, 06:29 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 16 Nov 2015, 11:58
      1
      • M mcosta
        16 Nov 2015, 06:29

        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 16 Nov 2015, 11:58 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 16 Nov 2015, 12:05 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 16 Nov 2015, 12:33
          0
          • M mcosta
            16 Nov 2015, 12:05

            Hi,

            you have to put

            void closeEvent(QCloseEvent*);
            

            in the protected part of your class declaration

            V Offline
            V Offline
            vibolvireak
            wrote on 16 Nov 2015, 12:33 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 16 Nov 2015, 12:37 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 16 Nov 2015, 12:43
              0
              • M mcosta
                16 Nov 2015, 12:37

                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 16 Nov 2015, 12:43 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 16 Nov 2015, 12:57 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 16 Nov 2015, 13:27 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 16 Nov 2015, 13:29
                    1
                    • M mcosta
                      16 Nov 2015, 13:27

                      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 16 Nov 2015, 13:29 last edited by
                      #12

                      @mcosta Thank you it all finally working fine :)

                      1 Reply Last reply
                      0

                      12/12

                      16 Nov 2015, 13:29

                      • Login

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