Qpushbutton with little red circles indicating notifications
-
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.
-
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. -
What would be a more clear way ?
That book is easy to read. (IMHO)
Else there is mostly Qt docs. -
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.htmland 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.htmlTo paint you need to read about
http://doc.qt.io/qt-5/qpainter.htmlAlternatively, you might be able to dress up a normal button with style sheet and icon but
im not sure it will work well. -
Ohk, thanks, I will try I know C++, Signal & Slots, now I have to learn paint event. thanks a lot.
-
@Tejas-Virpariya
Ok super
There are many sampes to study
https://www.youtube.com/watch?v=m4NIeakn1Xw -
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
-