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. Qpushbutton with little red circles indicating notifications
Qt 6.11 is out! See what's new in the release blog

Qpushbutton with little red circles indicating notifications

Scheduled Pinned Locked Moved Solved General and Desktop
9 Posts 2 Posters 5.6k Views 1 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.
  • T Offline
    T Offline
    Tejas Virpariya
    wrote on last edited by
    #1

    Hi,

    I want to developed one Notification Button, when any notification come then one little red dot come with number of notification on push button as shown bellow, I tried to get help online but I can't, only this forum can help me, thanks in advance.

    alt text

    -Thanks
    Tejas Patel

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

      Hi
      For that u need to make a custom widget
      http://www.informit.com/articles/article.aspx?p=1405227
      And paint it yourself and handle the notifications.

      Notice the Red Circle goes outside button that is not easy to make unless the button is
      actually bigger and its just transparent there.

      T 1 Reply Last reply
      3
      • mrjjM mrjj

        Hi
        For that u need to make a custom widget
        http://www.informit.com/articles/article.aspx?p=1405227
        And paint it yourself and handle the notifications.

        Notice the Red Circle goes outside button that is not easy to make unless the button is
        actually bigger and its just transparent there.

        T Offline
        T Offline
        Tejas Virpariya
        wrote on last edited by
        #3

        @mrjj can I get any reference to get more clear cut way to developed?

        -Thanks
        Tejas Patel

        mrjjM 1 Reply Last reply
        0
        • T Tejas Virpariya

          @mrjj can I get any reference to get more clear cut way to developed?

          mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          @Tejas-Virpariya

          What would be a more clear way ?
          That book is easy to read. (IMHO)
          Else there is mostly Qt docs.

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

            Hi
            Well if you are new to Qt this will be a bit complex for you.
            You need to be ok with c++ else it will hurt.

            You need to subclass
            http://doc.qt.io/qt-5/qabstractbutton.html

            and override Paint and other functions.
            Then add new code for the notification stuff.

            So you MUST know signals and slots
            http://doc.qt.io/qt-5/signalsandslots.html

            To paint you need to read about
            http://doc.qt.io/qt-5/qpainter.html

            Alternatively, you might be able to dress up a normal button with style sheet and icon but
            im not sure it will work well.

            1 Reply Last reply
            3
            • T Offline
              T Offline
              Tejas Virpariya
              wrote on last edited by
              #6

              Ohk, thanks, I will try I know C++, Signal & Slots, now I have to learn paint event. thanks a lot.

              -Thanks
              Tejas Patel

              mrjjM 1 Reply Last reply
              0
              • T Tejas Virpariya

                Ohk, thanks, I will try I know C++, Signal & Slots, now I have to learn paint event. thanks a lot.

                mrjjM Offline
                mrjjM Offline
                mrjj
                Lifetime Qt Champion
                wrote on last edited by
                #7

                @Tejas-Virpariya
                Ok super
                There are many sampes to study
                https://www.youtube.com/watch?v=m4NIeakn1Xw

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  Tejas Virpariya
                  wrote on last edited by
                  #8

                  I done with this job without pain event, I made one custom widget, in this widget I put one PushButton and one label at right-up corner, I set style-sheet for label and create model to set label value and done just it.

                  Thanks @mrjj

                  -Thanks
                  Tejas Patel

                  mrjjM 1 Reply Last reply
                  2
                  • T Tejas Virpariya

                    I done with this job without pain event, I made one custom widget, in this widget I put one PushButton and one label at right-up corner, I set style-sheet for label and create model to set label value and done just it.

                    Thanks @mrjj

                    mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by mrjj
                    #9

                    @Tejas-Virpariya

                    Good work :)

                    Can we see the final result ?

                    ( use postimage.org , image upload is broken here)

                    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