Results 1 to 1 of 1

Thread: QML: How to disable a standard ok button in MessageDialog on a conditional statement

  1. #1
    Join Date
    May 2011
    Posts
    3
    Qt products
    Qt4
    Platforms
    Windows

    Default QML: How to disable a standard ok button in MessageDialog on a conditional statement

    Below is code snippet I have written in main.qml file.
    Basically I have a MessageDialog. Here, when disableOkBtn boolean is true, then I want to set standard ok button to disabled state
    ****************
    MessageDialog {
    id: mainDialog
    ..
    ..
    }
    function showMessageBox(bool disableOkBtn) {
    if(disableOkBtn) {
    mainDialog.standardButtons = StandardButton.Ok | StandardButton.Cancel;
    mainDialog.standardButtons(StandardButton.Ok).enab led = false; //this line does not work , Basically here I want to set standard ok button to disabled state
    }
    }
    ************************
    Please guide me what should be the correct way instead of below line.
    mainDialog.standardButtons(StandardButton.Ok).enab led = false;
    Last edited by sheetal_awaji; 11th August 2018 at 11:07.

Similar Threads

  1. Standard Exit button usage
    By prophet23 in forum Qt Programming
    Replies: 1
    Last Post: 9th November 2011, 12:17
  2. Replies: 11
    Last Post: 20th November 2010, 09:27
  3. How to disable a button in a QFileDialog?
    By TeresaML in forum Qt Programming
    Replies: 2
    Last Post: 18th June 2010, 19:41
  4. how to disable the maximize button?
    By zabeehkhan in forum Qt Programming
    Replies: 4
    Last Post: 14th April 2010, 08:26
  5. stylesheet standard button names
    By h123 in forum Qt Programming
    Replies: 0
    Last Post: 14th April 2009, 13:42

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.