Results 1 to 6 of 6

Thread: Catching when dialog is disabled?

  1. #1
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Catching when dialog is disabled?

    In one of my programs, I have a dialog which can used to "edit" a series of inputs. However, sometimes when I bring it up, the entire dialog (even the Ok/Cancel buttons along the bottom) are completely disabled! In my code, I do enable/disable certain ELEMENTS of the dialog, but never the entire dialog, especially not the buttons at the bottom. I have no idea what is doing this!

    Anyway, my question is: is there a place I can put a breakpoint to figure out where this is happening? I've placed one in QWidget::setEnabled and it's not in there.

    Thanks for any advice,
    Joey

  2. #2
    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: Catching when dialog is disabled?

    Can we see your code for starting the dialog?
    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.


  3. #3
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Catching when dialog is disabled?

    My code for creating the dialog is pretty simple: _cdfSourceDialog = new CDFSourceDialog (this); I only do the creation once, and just fill in the values every other time I bring it up. When I show it, I just do a _cdfSourceDialog->show (). I do some initialization code between the two so I'm guessing it is somewhere in there that this disabling is happening, but I don't know where I can place a breakpoint.

    Thanks!

  4. #4
    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: Catching when dialog is disabled?

    Qt doesn't disable things if you don't tell it to. One way of disabling a parent window is to make the child modal but this only prevents it from getting events and has no impact on the visual aspect of the widget.
    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.


  5. #5
    Join Date
    Sep 2007
    Posts
    61
    Thanks
    5
    Thanked 4 Times in 4 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Catching when dialog is disabled?

    Ok, so I finally figured this out. I have a custom widget (button with a dropdown menu). This custom widget is derived from QPushButton. Inside this custom widget, I store pointers to my various child dialogs. On my GUI, I have this button which I periodically disable for reasons in the program.

    Now, when I was disabling my custom widget (i.e. I did not want the user to click on my button), it ended up disabling all the child dialogs that the widget stored! I'm not sure why that is. I'm guessing because each dialog pointer was tied to the menu and that menu was disabled as well.

    To fix it, I changed the custom widget to be derived from QWidget, and stored a pointer to a QPushButton which I create in my constructor. It looks the same, but now when I disable the button, it no longer disables the child dialogs.

    I probably should have mentioned some of this in my initial post, but I didn't think it was relevant!

    Thanks for your help tho! When you mentioned, "How are you creating...", I started digging deeper.

    Joey

  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: Catching when dialog is disabled?

    Actually this was probably because you set the button as a parent of all your dialogs which was essentially what you weren't supposed to do.
    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. catching mouseMoveEvent on QwtPlot
    By grantbj74 in forum Qwt
    Replies: 2
    Last Post: 30th July 2012, 07:14
  2. Indicating/catching signals
    By Tomasz in forum Newbie
    Replies: 5
    Last Post: 30th September 2010, 14:24
  3. Catching exceptions with Qt
    By The_Fallen in forum Qt Programming
    Replies: 6
    Last Post: 30th July 2010, 20:39
  4. Qt - catching interrupts
    By rishid in forum Qt Programming
    Replies: 2
    Last Post: 5th February 2008, 15:17
  5. Catching X Events
    By nupul in forum Qt Programming
    Replies: 3
    Last Post: 16th April 2006, 13:43

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.