Creating a notification banner
-
Hey there,
I would like to create a notification banner similar to the ones in Ubuntu or OS X. Essentially it needs to be frameless, [ideally] translucent, sit on a certain side of the screen, and disappear after a certain amount of time.
How can I do this?
Thanks!
-
Do you ask how to create frameless and translucent window?
Have you seen "Window Flags Example":http://qt-project.org/doc/qt-4.8/widgets-windowflags.html ? -
You need create classes from QObject and QAbstractListModel and manipulate them. Class from QObject will hold properties your popup windows as window status, window color, text message, window caption text, icon and property "was seen" for closing and deleting message from internal QList.
Window you can create using the QML Rectangle. To change the transparency of window you need use property opacity of the Rectangle
I think you need more complex understanding how connect C++ and QML.
Regards. -
Maybe "QDesktopWidget Class":http://qt-project.org/doc/qt-5/qdesktopwidget.html and "QTimer":http://qt-project.org/doc/qt-5/QTimer.html .
-
You don't use QDesktopWidget to place your window, but you use it to query the size of screen! This way you can determine where (e.g. offset from the upper left corner) you want to place your window. Then you can place your window at the proper location, using QWidget::move(), for example.