Results 1 to 5 of 5

Thread: Cancel effect from parent qwidget

  1. #1
    Join Date
    Dec 2010
    Posts
    33
    Thanks
    3
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Cancel effect from parent qwidget

    Hi,
    If parent qwidget set a QGraphicsEffect, child qwidget will inherit that effect.
    Can I cancel child qwidget's effect?

    Title...seems to be wrong

  2. #2

    Default Re: Cancel effect from parent qwidget

    Hello guys,

    First, this is my first post and I know I'm resurrecting this post, but this is exactly my question so I though it would be better to use this post than create a new one with the exactly question.

    So.. The question is the same, I have some QGraphicsPixmapsItems childs with an QGraphicsItem parent, when someone clicks on one of the childrens, the parent effect is set to blur, so all it's childres (including the one I have clicked) are affected by the blur effect, what I want is to cancel the effect on this children, I'm posting an image so you guys can see better what I'm trying to do!

    This is what i get now:
    blur.jpg

    This is what I want to get:
    no_blur.jpg

    Thanks in advance and sorry about my bad english.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,368
    Thanks
    3
    Thanked 5,018 Times in 4,794 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Cancel effect from parent qwidget

    The whole point of effects is that children inherit them. If you don't want some item to inherit an effect from its parent then don't make it a child of that parent.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  4. #4

    Default Re: Cancel effect from parent qwidget

    Thanks for the reply, but as you can see in the image I uploaded, I'm trying to make an card game, the idea is that the cards at the bottom are the player deck, and when the player clicks in it, the card will scale and center on the scene, and all the rest of the scene will blur, so the card clicked got some "focus", but the thing is that all cards are children of the same parent so I just need an parentItem()->setGraphicsEffect(new QGraphicsBlurEffect()); and all the scene will be bluried instead of having to blur item by item, but obviously when I do this command the card that I need focus inherit the blur effect too.

    So, I think it's not possible to do what I want right? Then what would be the best solution, I can thing in a solution, but it just sounds wrong to me:
    I got the card with focus, do the command to blur the parent, remove the focused card from the parent GQraphicsItem so it will not inherit the blur anymore, then when i click it again (to return the card to the deck), I reasing the parent and remove the parent blur.
    Is this the best solution?

    Thanks a lot!

  5. #5
    Join Date
    Sep 2009
    Posts
    57
    Thanks
    7
    Thanked 5 Times in 4 Posts

    Default Re: Cancel effect from parent qwidget

    Anyone got any news on this?

    I would have thought the whole purpose of QGraphicsEffect is to apply a graphics effect, the scope should be controllable. I can see that the API is pretty thin in this area and am wondering if to get a 'frame' effect it might be better to do it myself during a paintEvent.

    Anyone done this before?


    Added after 1 10 minutes:


    scratch that, I did it but the QGraphicsDropShadowEffect is dog slow. Its not ready for prime time.
    Last edited by liversedge; 3rd August 2011 at 01:59.

Similar Threads

  1. Correctly deleting a qwidget with no parent
    By boblatino in forum Qt Programming
    Replies: 3
    Last Post: 27th July 2010, 06:01
  2. Promoting the parent QWidget of a QWidget form
    By extrakun in forum Qt Tools
    Replies: 6
    Last Post: 16th April 2010, 14:19
  3. Prevent a QLabel resizing the parent QWidget
    By danc81 in forum Qt Programming
    Replies: 6
    Last Post: 10th November 2009, 20:54
  4. QWidget *parent = 0 question
    By radek.z in forum Qt Programming
    Replies: 3
    Last Post: 18th May 2009, 09:32
  5. Enable QWidget child while parent disabled
    By ^NyAw^ in forum Qt Programming
    Replies: 2
    Last Post: 30th May 2008, 10:53

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.