Results 1 to 4 of 4

Thread: disable pushbutton focus after mouse released

  1. #1
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11
    Thanks
    15
    Thanked 16 Times in 15 Posts

    Default disable pushbutton focus after mouse released

    I set the attributes with stylesheet:
    Qt Code:
    1. pb_Down->setStyleSheet("border-image: url(:/ArrowKey/Down_Default.jpg);border-width: 1px;border-style: solid; border-radius: 4px;");
    To copy to clipboard, switch view to plain text mode 

    when push button is clicked it becomes red inside and border is shown as written above. When button released I want the button to get back to its normal shape, not red anymore. for this I am using

    Qt Code:
    1. pb_Jack1Up->setFocusPolicy(Qt::FocusPolicy);
    To copy to clipboard, switch view to plain text mode 

    inside released slot (we're dealing with pressed() and released() slots), but this gives the error:

    error: expected primary-expression before ')' token
    how to resolve this?

  2. #2
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: disable pushbutton focus after mouse released

    you need to specify a VALUE of the ENUM, not try and pass the ENUM itself...

    http://qt-project.org/doc/qt-4.8/qt....cusPolicy-enum
    Qt Code:
    1. pb_Jack1Up->setFocusPolicy(Qt::ClickFocus);
    To copy to clipboard, switch view to plain text mode 
    Anyway, not sure that that will give you your desired result.
    Last edited by amleto; 20th April 2013 at 13:29.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

  3. #3
    Join Date
    Feb 2012
    Location
    Armenia/Yerevan
    Posts
    400
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11
    Thanks
    15
    Thanked 16 Times in 15 Posts

    Default Re: disable pushbutton focus after mouse released

    no, that's not what I want.

  4. #4
    Join Date
    Sep 2011
    Posts
    1,241
    Qt products
    Qt4
    Platforms
    Windows
    Thanks
    3
    Thanked 127 Times in 126 Posts

    Default Re: disable pushbutton focus after mouse released

    I know. Using the focus policy will not help you. You need to unset the focus manually.
    If you have a problem, CUT and PASTE your code. Do not retype or simplify it. Give a COMPLETE and COMPILABLE example of your problem. Otherwise we are all guessing the problem from a fabrication where relevant details are often missing.

Similar Threads

  1. pyQT how do I enable or disable a pushbutton from the main code?
    By Michael Druckenmiller Sr in forum Newbie
    Replies: 1
    Last Post: 12th January 2012, 18:44
  2. Replies: 3
    Last Post: 8th October 2011, 09:46
  3. Replies: 4
    Last Post: 16th September 2011, 02:10
  4. How to disable pushbutton after clicking it
    By Cengaver in forum Newbie
    Replies: 12
    Last Post: 19th April 2011, 15:22
  5. disable transition on Vista pushButton
    By Lele in forum Qt Programming
    Replies: 3
    Last Post: 18th February 2008, 18:22

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.