Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Forum Updated on Feb 6th

    How to place an widget over the desktop screen using qt

    General and Desktop
    3
    10
    4258
    Loading More Posts
    • 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.
    • D
      developer last edited by

      i want to place an widget on the screen any where for eg. the way cario dock places it slef or many application places i want to get control at screen.
      i am using qt with c++.
      please tell the easiest way to do that.
      i am developing for desktop using qt widget qt gui

      1 Reply Last reply Reply Quote 0
      • G
        goetz last edited by

        Looks like you're looking for a toplevel window, maybe some of the convenience classes like QDialog, QMainWindow, etc. are your solution.

        http://www.catb.org/~esr/faqs/smart-questions.html

        1 Reply Last reply Reply Quote 0
        • D
          developer last edited by

          QDialog, QMainWindow are not the thing of my choice they are windows
          have you used cario dock avant dock or any other theere icon does not appear as they open a window they are running and placed at screen positions

          1 Reply Last reply Reply Quote 0
          • G
            goetz last edited by

            No I didn't, sorry.

            http://www.catb.org/~esr/faqs/smart-questions.html

            1 Reply Last reply Reply Quote 0
            • L
              lgeyer last edited by

              You might want to post a screenshot or a sketch of what you actually want to achieve. This would help a lot.

              1 Reply Last reply Reply Quote 0
              • D
                developer last edited by

                this is a screen shot which shows an widget placed over screen
                http://dl.dropbox.com/u/35031827/toshowhowtoplace.png

                1 Reply Last reply Reply Quote 0
                • L
                  lgeyer last edited by

                  Well, that's quite easy. Just create a frameless, semi-transparent, translucent top-level widget.
                  @
                  QWidget *widget = new QWidget;
                  widget->setAttribute(Qt::WA_TranslucentBackground);
                  widget->setWindowFlags(Qt::FramelessWindowHint);
                  widget->setWindowOpacity(0.75);

                  QLabel *label = new QLabel(widget);
                  label->setFixedSize(640, 480);
                  label->setStyleSheet("background: black; border-radius: 20px;");

                  widget->show();
                  @
                  Be aware that you will still receive event for the non-visible parts of your widget (the remains of the rounded-off corners in this case). If you want to have a truly irregaluar-shaped widget apply an appropriate widget mask using <code>QWidget::setMask()</code>.

                  1 Reply Last reply Reply Quote 0
                  • D
                    developer last edited by

                    hey lukas i dont want this . this is a window as i window icon appears and i want to do many things like show with graphics when mouse is hovered near and i think i need a graphics item here

                    1 Reply Last reply Reply Quote 0
                    • L
                      lgeyer last edited by

                      Just add the <code>Qt::Tool</code> window flag.
                      @
                      widget->setWindowFlags(Qt::FramelessWindowHint | Qt::Tool);
                      @
                      You cannot just paint to the desktop, you will have to use a window.

                      1 Reply Last reply Reply Quote 0
                      • D
                        developer last edited by

                        thanks lukas right anwser

                        1 Reply Last reply Reply Quote 0
                        • First post
                          Last post