Results 1 to 2 of 2

Thread: QML: set standard ok button of a MessageDialog to disabled state

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

    Default QML: set standard ok button of a MessageDialog to disabled state

    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
    ..
    ..
    }

    /// Java Script

    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;

    Above line of code doesn't work

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

    Default Re: QML: set standard ok button of a MessageDialog to disabled state

    MessageDialog does not let you access buttons directly. If you need that functionality, you'll have to reimplement the dialog by yourself.
    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.


Similar Threads

  1. Replies: 0
    Last Post: 11th August 2018, 10:50
  2. [QSS] QTreeView item disabled hover state changes
    By CloudCompany in forum Newbie
    Replies: 0
    Last Post: 24th November 2016, 14:30
  3. Replies: 0
    Last Post: 10th June 2014, 14:38
  4. Replies: 2
    Last Post: 3rd August 2012, 13:08
  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.