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. Using a single `QGraphicsEffect` for multiple widgets
Forum Updated to NodeBB v4.3 + New Features

Using a single `QGraphicsEffect` for multiple widgets

Scheduled Pinned Locked Moved Solved General and Desktop
7 Posts 3 Posters 780 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
    diniamo
    wrote on last edited by
    #1

    I'm looking to use a single QGraphicsEffect, which I constructed, for multiple widgets.
    If I set a single effect object to multiple widgets, only the last one that I set actually gets the effect.

    eyllanescE 1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      As stated in the documentation of QWidget::setGraphicsEffect, the widget retrieves it if it was already applied and takes ownership of the effect.

      It will apply it to all its children.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • D diniamo

        I'm looking to use a single QGraphicsEffect, which I constructed, for multiple widgets.
        If I set a single effect object to multiple widgets, only the last one that I set actually gets the effect.

        eyllanescE Offline
        eyllanescE Offline
        eyllanesc
        wrote on last edited by
        #3

        @diniamo A QGraphicsEffect can only be set on a single widget as indicated in the docs: If effect is the installed effect on a different widget, setGraphicsEffect() will remove the effect from the widget and install it on this widget.

        If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

        1 Reply Last reply
        0
        • D Offline
          D Offline
          diniamo
          wrote on last edited by
          #4

          Hmm I see, but then how do I solve this in a simple way? QGraphicsEffects don't tend to have a copy constructor.

          eyllanescE 1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            If they are separated, you use one for each widget.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • D diniamo

              Hmm I see, but then how do I solve this in a simple way? QGraphicsEffects don't tend to have a copy constructor.

              eyllanescE Offline
              eyllanescE Offline
              eyllanesc
              wrote on last edited by
              #6

              @diniamo QGraphicsEffect is a QObject so it does not have a copy-constructor. You have to create a new QGraphicsEffect for each QWidget

              If you want me to help you develop some work then you can write to my email: e.yllanescucho@gmal.com.

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

                What I do right now is have an array and then loop over it and set the stuff I need for each and then just manually set for each widget. I thought there would be an easier way.

                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