Results 1 to 4 of 4

Thread: Prevent docking on doubleclick

  1. #1
    Join Date
    Oct 2007
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Question Prevent docking on doubleclick

    Hello,
    Could somebody tell me how I can prevent docking action on mouse doubleclick on title bar. I create my dockable widget as follow:

    Qt Code:
    1. QDockWidget* d = new QDockWidget(tr("myDockWidget"), this);
    2. d->setAllowedAreas(Qt::NoDockWidgetArea);
    3. d->setFeatures ( QDockWidget::DockWidgetFloatable|QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetClosable );
    4. myView = new SplitCombineFiles( d );
    5. d->setWidget(myView );
    6. d->setFloating ( true );
    To copy to clipboard, switch view to plain text mode 
    i would think that i set all flags possible to prevent docking, but no, it still docks on double click.
    Thanks in advance.
    Last edited by marcel; 24th June 2008 at 19:57. Reason: missing [code] tags

  2. #2
    Join Date
    Feb 2006
    Location
    Romania
    Posts
    2,744
    Thanks
    8
    Thanked 541 Times in 521 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Prevent docking on doubleclick

    You can install an event filter on the dock's title bar widget (available with QDockWidget::titleBarWidget) and ignore any two consecutive mouse press events that appear within QApplication::doubleClickInterval.

    See QObject::installEventFilter.
    Last edited by marcel; 24th June 2008 at 20:38.

  3. #3
    Join Date
    Oct 2007
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Prevent docking on doubleclick

    What do you mean by "install". I would appreciate sample code.

  4. #4
    Join Date
    Oct 2007
    Posts
    16
    Thanks
    3
    Qt products
    Qt4
    Platforms
    MacOS X Windows

    Default Re: Prevent docking on doubleclick

    Never mind, I found sample code. Thanks a lot. Good suggestion.

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.