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

Creating a notification banner

Scheduled Pinned Locked Moved General and Desktop
10 Posts 4 Posters 2.8k 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.
  • N Offline
    N Offline
    nicky j
    wrote on 22 Apr 2014, 04:24 last edited by
    #1

    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!

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      qxoz
      wrote on 22 Apr 2014, 04:52 last edited by
      #2

      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 ?

      1 Reply Last reply
      0
      • _ Offline
        _ Offline
        _dmp
        wrote on 22 Apr 2014, 05:15 last edited by
        #3

        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.

        1 Reply Last reply
        0
        • N Offline
          N Offline
          nicky j
          wrote on 22 Apr 2014, 05:32 last edited by
          #4

          Okay, I've now figured out everything except having it sit on a certain side of the screen and having it disappear after a while.

          1 Reply Last reply
          0
          • Q Offline
            Q Offline
            qxoz
            wrote on 22 Apr 2014, 07:46 last edited by
            #5

            Maybe "QDesktopWidget Class":http://qt-project.org/doc/qt-5/qdesktopwidget.html and "QTimer":http://qt-project.org/doc/qt-5/QTimer.html .

            1 Reply Last reply
            0
            • N Offline
              N Offline
              nicky j
              wrote on 27 Apr 2014, 23:31 last edited by
              #6

              How would I use the QDesktopWidget Class to place a window on a certain part of the screen? I read the docs but I didn't get it.

              Thanks!

              1 Reply Last reply
              0
              • M Offline
                M Offline
                MuldeR
                wrote on 27 Apr 2014, 23:36 last edited by
                #7

                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.

                My OpenSource software at: http://muldersoft.com/

                Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

                Go visit the coop: http://youtu.be/Jay...

                1 Reply Last reply
                0
                • N Offline
                  N Offline
                  nicky j
                  wrote on 27 Apr 2014, 23:39 last edited by
                  #8

                  Oh okay. Could you give me a short code example of how it would find the size of the screen then offset?

                  Thanks for your help!

                  1 Reply Last reply
                  0
                  • M Offline
                    M Offline
                    MuldeR
                    wrote on 27 Apr 2014, 23:41 last edited by
                    #9

                    For example, if it turns out that the user's screen size is 1920x1080 pixels and your window is 100x100 pixels in size and you wish to put it into the lower right corner, then you'd have to move it to coordinate (1820,980).

                    My OpenSource software at: http://muldersoft.com/

                    Qt v4.8.6 MSVC 2013, static/shared: http://goo.gl/BXqhrS

                    Go visit the coop: http://youtu.be/Jay...

                    1 Reply Last reply
                    0
                    • N Offline
                      N Offline
                      nicky j
                      wrote on 27 Apr 2014, 23:43 last edited by
                      #10

                      Okay that seems easy enough. Ill give it a shot!

                      1 Reply Last reply
                      0

                      1/10

                      22 Apr 2014, 04:24

                      • Login

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