Results 1 to 2 of 2

Thread: QPushButton::setEnabled( true ) not working

  1. #1

    Default QPushButton::setEnabled( true ) not working

    Hallo,

    on a MainForm, I stacked a few widgets (in designer, partially overlapping, some visible by default, some not).
    I have a QWidget ontop of some other things, which has three buttons on it, and a QLineEdit above them.

    Those buttons are already set disabled (enabled not checked) by QtCreator designer once in a while, even if I set them to enabled again.
    The widget is invisible normally, only sometimes I make it visible to show the buttons & lineedit.
    Now, in the code, before using the buttons, I set everything enabled explcitly, to make sure.
    But it doesn't work, and the assert at the end fails:

    Qt Code:
    1. ui->widgetPanel->setEnabled( true );
    2.  
    3. ui->btnNo->setEnabled( true );
    4. ui->btnYes->setEnabled( true );
    5.  
    6. ui->widgetPanel->show();
    7.  
    8.  
    9. Q_ASSERT( ui->btnNo->isEnabled() );
    To copy to clipboard, switch view to plain text mode 

    What could be the cause of this? Does Qt have problems with layers of widgets, even if some are invisible?
    It was working for a while, though, and I was changing sizes and moving widgets around, then it stopped.
    (and I did check in the "widget tree" that everything is correct in the hierarchy)

  2. #2
    Join Date
    Nov 2006
    Location
    indonesia
    Posts
    55
    Thanked 11 Times in 11 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: QPushButton::setEnabled( true ) not working

    Hi,
    Qt dont have a problem about layering.
    I think you call "enabled button" at the wrong position. So, the enable button not changed.
    Can you share your complete code, so we can check that.

    Best regards,

    myta

Similar Threads

  1. QAction::setEnabled() Not Working as Expected
    By pmwalk in forum Qt Programming
    Replies: 6
    Last Post: 24th March 2012, 06:20
  2. Replies: 9
    Last Post: 22nd July 2010, 08:40
  3. Replies: 7
    Last Post: 26th August 2009, 07:21
  4. Replies: 27
    Last Post: 13th September 2007, 09:01
  5. How setEnabled() works on QFrames.
    By Doug Broadwell in forum Newbie
    Replies: 4
    Last Post: 18th October 2006, 19:55

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.