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. QWidget with parent fully transparent

QWidget with parent fully transparent

Scheduled Pinned Locked Moved General and Desktop
9 Posts 4 Posters 6.9k 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.
  • D Offline
    D Offline
    dmitrij
    wrote on last edited by
    #1

    Hello!

    I'm trying to change a qwidget opacity, when it has a parent. As I found out the setWindowOpacity is working only for a window without parent. I tried to reimplement paintEvent for the widget. But in this case I changed only widget's opacity(made its background a bit transparant), not its elements. The question is: what I need to reimplement in case I want to change widget's opacity with its elements?

    Thank you for your answers beforehand.

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mohsen
      wrote on last edited by
      #2

      when a widget has parent then it has no background except when it opened window like. other states you may use a label as your background and objects opacity can be changed via style or opacity property.
      but if its window like,whats the reason to give it a parent? you can already show a widget with modal flag or if you need to have access to parent window just keep the parent widget on another pointer.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dmitrij
        wrote on last edited by
        #3

        Thank you for your answer.

        Good question about the reason. I'm starting thinking, I don't need it anymore actually, if of course with a modal flag the window icon will not appear in a task bar. At this moment I know only way to hide icon from task bar: parent adding.

        1 Reply Last reply
        0
        • M Offline
          M Offline
          mohsen
          wrote on last edited by
          #4

          you can either use Qt::Tool or Qt::SubWindow flags.

          1 Reply Last reply
          0
          • D Offline
            D Offline
            dmitrij
            wrote on last edited by
            #5

            I forgot about those flags at all. Thank you!

            1 Reply Last reply
            0
            • D Offline
              D Offline
              dbzhang800
              wrote on last edited by
              #6

              [quote author="dmitrij" date="1319837582"]Hello!

              The question is: what I need to reimplement in case I want to change widget's opacity with its elements?
              [/quote]

              @
              void QWidget::setGraphicsEffect ( QGraphicsEffect * effect )
              @
              And
              @
              QGraphicsOpacityEffect
              @
              can be used to achive this.

              But from this wiki page:
              http://developer.qt.nokia.com/wiki/Qt_Modules_Maturity_Level

              We can see taht:
              @
              Graphics Effects
              State: Deprecated
              Reasoning: flawed design, we don’t recommend taking maintainership of this code.
              @

              1 Reply Last reply
              0
              • D Offline
                D Offline
                dmitrij
                wrote on last edited by
                #7

                [quote]
                But from this wiki page:
                http://developer.qt.nokia.com/wiki/Qt_Modules_Maturity_Level

                We can see taht:
                @
                Graphics Effects
                State: Deprecated
                Reasoning: flawed design, we don’t recommend taking maintainership of this code.
                @[/quote]

                Thank you for answer.
                I guess they suppose to introduce something new in nearest future. I'm not sure=) But it seems so.

                1 Reply Last reply
                0
                • A Offline
                  A Offline
                  andre
                  wrote on last edited by
                  #8

                  The new thing they introduced is called QML/Qt Quick. That UI framework is much more suited to doing graphics effects like this. Making these fluent, animated bling UI's using QWidgets just doesn't work out nicely, even if there are tricks you can use to do some of these.

                  1 Reply Last reply
                  0
                  • D Offline
                    D Offline
                    dmitrij
                    wrote on last edited by
                    #9

                    I didn't try QML/Qt Quick still. Currently was another goal - study basics of this FrameWork and trying to do something cool and nice with that. Without basics the jump to QML would have been a very stupid step.

                    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