Results 1 to 5 of 5

Thread: HIde WIdget from another Widget

  1. #1
    Join Date
    Sep 2011
    Posts
    51
    Thanks
    2
    Qt products
    Qt4

    Default HIde WIdget from another Widget

    Good mornig,
    i've a widget with a button that opens another widget:

    when i click to the button i set the property Childwidget->show() and all works well; (the child widget is shown)

    when i click the button again (it is a qpushbutton checkable) i want the widget to be hidden so i set Childwidget->hide() but the widget doesent disappear...

    Whith the debug i see the code is executed correctly...

    Qt Code:
    1. if(mybutton->isChecked()) {
    2.  
    3. ChildWidget->show();
    4. }
    5. else {
    6.  
    7. ChildWidget->close(); /// i try also ChildWidget->Hide()
    8. }
    To copy to clipboard, switch view to plain text mode 

    but the widget using hide or close doesent disappear..at all...

    What is the problem ?
    Thanks !!!
    Last edited by wysota; 13th September 2011 at 09:09. Reason: missing [code] tags

  2. #2
    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: HIde WIdget from another Widget

    Does the ChildWidget class have custom implementation for closeEvent ( or close() | hide() | event() | event filters installed etc ) ?

  3. #3
    Join Date
    Sep 2011
    Posts
    51
    Thanks
    2
    Qt products
    Qt4

    Default Re: HIde WIdget from another Widget

    What do you mean ?
    No i've not implemented any custom method....
    Please can you explain what you mean ?
    i do not understand...
    Thanks Gabriele

  4. #4
    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: HIde WIdget from another Widget

    What exactly is a ChildWidget ? (I mean what class)
    What I meant is:
    1) does this class use custom implementations of "close()", "hide()", "closeEvent()" ?
    2) do you have any event filters installed on the ChildWidget object (or qApp object) ?
    I'm asking because you have used a method ChildWidget->Hide(), which I think is something you have implemented.
    Whith the debug i see the code is executed correctly...
    So you can see those messages correctly ?
    Qt Code:
    1. if(mybutton->isChecked()) {
    2. ChildWidget->show();
    3. qDebug() << "show()";
    4. }
    5. else {
    6. ChildWidget->close(); /// i try also ChildWidget->Hide()
    7. qDebug() << "close()";
    8. }
    To copy to clipboard, switch view to plain text mode 

  5. #5
    Join Date
    May 2011
    Posts
    9
    Thanks
    1
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: HIde WIdget from another Widget

    Try: ChildWidget->setVisible (false). Though it's better to post more code since it's not normal that hide() or close() don't work.

Similar Threads

  1. hide tab within a tabified dock widget
    By navid in forum Qt Programming
    Replies: 9
    Last Post: 7th July 2010, 17:12
  2. Hide titlebar and let widget be resizeable
    By munna in forum Qt Programming
    Replies: 1
    Last Post: 6th February 2009, 14:25
  3. Hide widget, but not change layout
    By dimaz in forum Qt Programming
    Replies: 3
    Last Post: 21st November 2008, 14:32
  4. hide the row heading of Table Widget
    By sabeesh in forum Qt Programming
    Replies: 1
    Last Post: 24th July 2007, 11:31
  5. Replies: 3
    Last Post: 21st March 2006, 16:48

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.