Results 1 to 5 of 5

Thread: Why blur effect on only one widget at a time?

  1. #1
    Join Date
    Sep 2008
    Posts
    58
    Thanks
    11
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Question Why blur effect on only one widget at a time?

    Hi,

    I am using 4.6.2 on linux, In my widget I have few pushbuttons.
    Now if i set blue effect by setting following.

    Qt Code:
    1. ui->pushbutton_1->setGraphicsEffect(blur);
    2. ui->pushbutton_2->setGraphicsEffect(blur);
    3. ui->pushbutton_3->setGraphicsEffect(blur);
    4. ui->pushbutton_4->setGraphicsEffect(blur);
    5. ui->pushbutton_5->setGraphicsEffect(blur);
    6.  
    7. it will show blur effect only on last pushbutton i.e. pushbutton_5 .
    8.  
    9. now if I do,
    10. ui->pushbutton_1->setGraphicsEffect(blur);
    11. ui->pushbutton_4->setGraphicsEffect(blur);
    12. ui->pushbutton_5->setGraphicsEffect(blur);
    13. ui->pushbutton_2->setGraphicsEffect(blur);
    14. ui->pushbutton_3->setGraphicsEffect(blur);
    15.  
    16. it will show blur effect only on pushbutton_3
    To copy to clipboard, switch view to plain text mode 

    so every time it will show blur effect on last widget only.

    Is there any way to show this blur effect on several widget(pushbuttons in my case) simultaneously?

  2. #2
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why blur effect on only one widget at a time?

    From the docs -
    void QWidget::setGraphicsEffect ( QGraphicsEffect * effect )
    The setGraphicsEffect function is for setting the widget's graphics effect.

    Sets effect as the widget's effect. If there already is an effect installed on this widget, QWidget will delete the existing effect before installing the new effect.

    If effect is the installed on a different widget, setGraphicsEffect() will remove the effect from the widget and install it on this widget.

    QWidget takes ownership of effect.
    [This explains why your code applies effect to the last widget ]

    Note: This function will apply the effect on itself and all its children.
    So in short, you will need to create a seperate object of graphics effect for each widget to apply.
    Or alternatively you can apply the effect to the parent item.

  3. #3
    Join Date
    Sep 2008
    Posts
    58
    Thanks
    11
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Why blur effect on only one widget at a time?

    Quote Originally Posted by aamer4yu View Post
    From the docs -
    Or alternatively you can apply the effect to the parent item.
    I have applied blur effect ot parent widget, my parent widget contains 18 pushbuttons and 1 label.
    I am able to manage blur on all the pushbuttons, but this makes pushbutton slower. ( we can differential click on pushbutton with blur applied to parent widget and without blur effect.)

    I am using on Linux platform with ARM9 400Mhz CPU.

    Is Graphics effect eat more CPU that degrads overall performance, or its a property of Graphics effect??

  4. #4
    Join Date
    Oct 2006
    Location
    New Delhi, India
    Posts
    2,467
    Thanks
    8
    Thanked 334 Times in 317 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Why blur effect on only one widget at a time?

    ui->pushbutton_1->setGraphicsEffect(blur);
    ui->pushbutton_2->setGraphicsEffect(blur);
    ui->pushbutton_3->setGraphicsEffect(blur);
    ui->pushbutton_4->setGraphicsEffect(blur);
    ui->pushbutton_5->setGraphicsEffect(blur);

    it will show blur effect only on last pushbutton i.e. pushbutton_5 .

    now if I do,
    ui->pushbutton_1->setGraphicsEffect(blur);
    ui->pushbutton_4->setGraphicsEffect(blur);
    ui->pushbutton_5->setGraphicsEffect(blur);
    ui->pushbutton_2->setGraphicsEffect(blur);
    ui->pushbutton_3->setGraphicsEffect(blur);

    it will show blur effect only on pushbutton_3
    From above doesnt seem you are applying effect only to parent item !

  5. #5
    Join Date
    Sep 2008
    Posts
    58
    Thanks
    11
    Qt products
    Qt/Embedded
    Platforms
    Unix/X11

    Default Re: Why blur effect on only one widget at a time?

    Sorry I just forget to put code.

    Qt Code:
    1. this->setGraphicsEffect(blur); // instead of ui->pushbutton_5->setGraphicsEffect(blur).
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 2
    Last Post: 11th February 2010, 07:45
  2. youtube fullscreen effect for a widget
    By cyrfer in forum Qt Programming
    Replies: 2
    Last Post: 5th January 2010, 12:57
  3. Replies: 2
    Last Post: 11th November 2009, 08:03
  4. How to dim / blur the background dialog?
    By german@it-missions.com in forum Qt Programming
    Replies: 2
    Last Post: 18th February 2009, 07:40
  5. argb windows and blur
    By kernel_panic in forum Qt Programming
    Replies: 6
    Last Post: 13th August 2007, 16:52

Tags for this Thread

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.