Results 1 to 3 of 3

Thread: [SOLVED] QDockWidget::setVisible() doesn't work

  1. #1
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Question [SOLVED] QDockWidget::setVisible() doesn't work

    Hi all. I have a problem with hiding/showing QDockWidget.
    So, I have a QDockWidget
    Qt Code:
    1. QDockWidget *DiskInfoWidget = new QDockWidget ( tr ( "Disk Information" ), this );
    2. DiskInfoWidget->setFeatures ( QDockWidget::NoDockWidgetFeatures );
    3. DiskInfoWidget->setContextMenuPolicy ( Qt::PreventContextMenu );
    4. addDockWidget ( Qt::TopDockWidgetArea, DiskInfoWidget );
    5. DiskInfoWidget->hide();
    To copy to clipboard, switch view to plain text mode 
    a QAction to control it
    Qt Code:
    1. DiskInfoAction = new QAction ( QIcon ( ":/toolbar/information" ), tr ( "Disk Information" ), this );
    2. DiskInfoAction->setCheckable ( true );
    3. DiskInfoAction->connect ( DiskInfoAction, SIGNAL ( triggered ( bool ) ), this, SLOT ( showDiskInfoWidget ( bool ) ) );
    To copy to clipboard, switch view to plain text mode 
    and here is a slot for triggered()
    Qt Code:
    1. void cwFMWindow::showDiskInfoWidget ( bool checked )
    2. {
    3. DiskInfoWidget->setVisible ( checked );
    4. }
    To copy to clipboard, switch view to plain text mode 
    And all this code does absolutely nothing. I can't guess why... It seems that I miss some stupid reason.
    Thanks for help
    Last edited by Oleg; 4th January 2008 at 20:28. Reason: reformatted to look better
    Oleg Shparber

  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: QDockWidget::setVisible() doesn't work

    A wild guess - missing Q_OBJECT macro or showDiskInfoWidget not declared as a slot? Check if Qt gives you any warnings in the console.

  3. #3
    Join Date
    Oct 2007
    Location
    Lake Forest, CA, USA
    Posts
    132
    Thanks
    10
    Thanked 27 Times in 22 Posts
    Qt products
    Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android

    Default Re: QDockWidget::setVisible() doesn't work

    OMG. It was a really stupid bug. It seems I'm too tired. There were two different QDockObject *DiskInfoWidget in class and in the function. Sorry for posting. Unfortunately I couldn't find a way to delete my thread.
    Oleg Shparber

Similar Threads

  1. QWidget -> updateGeometry dont work.
    By patrik08 in forum Qt Programming
    Replies: 7
    Last Post: 22nd May 2013, 15:55
  2. QActions don't work with menubar hidden
    By Pepe in forum Qt Programming
    Replies: 1
    Last Post: 16th August 2007, 01:04
  3. Change work area OS
    By pakulo in forum Qt Programming
    Replies: 15
    Last Post: 15th May 2007, 07:20
  4. QTextEdit Justify align making work
    By dec0ding in forum Qt Programming
    Replies: 2
    Last Post: 13th January 2006, 12:02

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.