Results 1 to 20 of 20

Thread: Disable button click

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Sep 2009
    Location
    Wroclaw, Poland
    Posts
    1,394
    Thanked 342 Times in 324 Posts
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows Android

    Default Re: Disable button click

    @Archa4: it does not make any difference, "true==true" and "false==true" evaluates to "true" and "false" respectively

    Show the code where you assign the "x" property, maybe you set it to "true" for all the buttons.

  2. #2
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Disable button click

    hi, bumblebee
    as stampede mentioned, you need to check your logic,
    And it gives a bug,when I press any btn,the msg appears
    its the logical issue.
    post setProperty code here

    bala

  3. #3
    Join Date
    Jan 2011
    Posts
    128
    Thanks
    2

    Default Re: Disable button click

    Well I did what BalaQT said,but I know realised that I didn't put the false after text...does it change things?

  4. #4
    Join Date
    Aug 2009
    Location
    coimbatore,India
    Posts
    314
    Thanks
    37
    Thanked 47 Times in 43 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows

    Default Re: Disable button click

    I know realised that I didn't put the false after text.does it change things?
    yes, that will correct your problem. if you still not able to solve the problem, post the setProperty code here.

    bala

  5. #5
    Join Date
    Jan 2011
    Posts
    128
    Thanks
    2

    Default Re: Disable button click

    Well,no I still get the bug...
    The code is:
    Qt Code:
    1. void TicTacToe::btnChangeX(QPushButton * x) //this function is run on every pressed button
    2. {
    3. x->setIcon(QIcon("ex.png"));
    4. x->setIconSize(QSize(64,64));
    5. x->disconnect();
    6. x->setProperty("x",false); //here is set it to x,false
    7. lbl->setText("<b>Turn : Player 2</b>");
    8. turn = false;
    9. }
    10.  
    11. bool TicTacToe::winX() //this function is called to every btn as well and checks for winner
    12. {
    13. if(btn[0]->property("x").toBool() && btn[1]->property("x").toBool() && btn[2]->property("x").toBool())
    14. {
    15.  
    16.  
    17. btn[0]->setText("x won 1"); //here is the bug,although i did click only btn[0],the winner text has appeared....
    18. for(i; i < 9; i++)
    19. btn[i]->disconnect();
    20.  
    21. return true;
    22. }
    To copy to clipboard, switch view to plain text mode 

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

    Default Re: Disable button click

    "x" is an existing property name. Use something that doesn't exist, like:
    Qt Code:
    1. button->setProperty("I need to read Qt documentation more", true);
    To copy to clipboard, switch view to plain text mode 
    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.


  7. #7
    Join Date
    Jan 2011
    Posts
    128
    Thanks
    2

    Default Re: Disable button click

    Quote Originally Posted by wysota View Post
    "x" is an existing property name. Use something that doesn't exist, like:
    Qt Code:
    1. button->setProperty("I need to read Qt documentation more", true);
    To copy to clipboard, switch view to plain text mode 
    Ok thanks it works now.

  8. #8
    Join Date
    Jan 2011
    Posts
    128
    Thanks
    2

    Default Re: Disable button click

    Can someone tell me,why the icon doesn't show in /Debug?
    At runtime it's ok,but

Similar Threads

  1. Disable right mouse click on QAction
    By stefan in forum Newbie
    Replies: 13
    Last Post: 15th May 2013, 22:04
  2. How to disable mouse click over a QSplashScreen
    By graciano in forum Qt Programming
    Replies: 2
    Last Post: 8th November 2009, 16:02
  3. Replies: 3
    Last Post: 25th August 2009, 22:35
  4. QDockWidget: disable double click on title bar
    By ElectroQt in forum Qt Programming
    Replies: 2
    Last Post: 9th October 2008, 22:22
  5. Replies: 4
    Last Post: 31st August 2006, 12:11

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.