Results 1 to 5 of 5

Thread: MDI subWindow activating when switching toolbox page

  1. #1
    Join Date
    Apr 2010
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default MDI subWindow activating when switching toolbox page

    Hi everybody!

    I have a weird bug in my program and I can't find what is causing it. My program is an MDI program with toolbox, which I have subclassed from QToolbox.

    The steps to reproduce the bug are as follows:

    1) I open two sub windows and make sure the second sub window is the active window.

    2) I then click on a page area (or a control on a page) in the toolbox, therefore activating it presumably.

    3) I click on a different page heading in the toolbox to switch pages. When I do this the first sub window becomes active. This shouldn't happen, switching pages in the toolbox should not affect which sub window is active.

    Has anybody else experienced this problem? I pretty sure it is my mistake somewhere, but I just can't find it - but maybe it is a Qt bug (unlikely)?

    I'm not using the QToolbox currentChanged signal, so I do not understand how switching a page in the toolbox can affect the sub windows? Maybe I will have to create a dummy MDI application with toolbox to see if the bug occurs with that.

    Any ideas greatly appreciated. Thanks!

    zenzero-2001

  2. #2
    Join Date
    May 2010
    Posts
    86
    Thanks
    17
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: MDI subWindow activating when switching toolbox page

    Is it always the frist MDI window which is activated? Have you tried to open more than two?
    If it was a bug of Qt, I would store the index of active window and would activate it back later. I know, it is just a workaround.

  3. #3
    Join Date
    Apr 2010
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MDI subWindow activating when switching toolbox page

    It is always the window that was created earliest that is activated.

    Yes, I could do that - it is a hack though.

  4. #4
    Join Date
    Apr 2010
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MDI subWindow activating when switching toolbox page

    I forgot to say that my toolbox is inside a dock widget.

    I have taken the MDI example from the documentation and have added a basic dock widget, toolbox and two blank pages. The result is that this also exhibits the erroneous behaviour. Maybe I have found a bug in Qt?

    I will do some more investigating.


    Added after 7 minutes:


    Ok, this is the code that I added to the standard MDI example.

    First mainwindow.h , just below the #includes:

    Qt Code:
    1. class QToolBox;
    To copy to clipboard, switch view to plain text mode 

    then below private:

    Qt Code:
    1. QToolBox *toolBox;
    To copy to clipboard, switch view to plain text mode 

    At the end of the constructor in mainwindow.cpp :

    Qt Code:
    1. dock = new QDockWidget(this);
    2.  
    3. toolBox = new QToolBox(this);
    4. toolBox->addItem(new QWidget(toolBox), "Widget 1");
    5. toolBox->addItem(new QWidget(toolBox), "Widget 2");
    6.  
    7. dock->setWidget(toolBox);
    8. addDockWidget(Qt::RightDockWidgetArea, dock);
    To copy to clipboard, switch view to plain text mode 

    Can anybody else reproduce this problem or I am doing something wrong?


    Added after 15 minutes:


    The bug also occurs if you click on the dock widget restore button. The bug can therefore also be reproduced with a single toolbox page. The bug does not occur when there are no toolbox pages.
    Last edited by zenzero-2001; 10th April 2011 at 13:43.

  5. #5
    Join Date
    Apr 2010
    Posts
    18
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: MDI subWindow activating when switching toolbox page

    I've discovered that the bug does not occur when the dock widget is floating but only when it is docked.

    I have opened a bug issue on the qt website

Similar Threads

  1. Change Title of toolbox's page. How?
    By hakermania in forum Newbie
    Replies: 10
    Last Post: 27th November 2016, 01:26
  2. Activating Console in VS2008 Qt Integration Gui App
    By sepp in forum Qt Programming
    Replies: 6
    Last Post: 5th December 2010, 13:51
  3. How to implement page switching?
    By kellen851105 in forum Qt Programming
    Replies: 1
    Last Post: 24th February 2010, 05:35
  4. selecting/activating tabify'd DockWidget?
    By iraytrace in forum Qt Programming
    Replies: 2
    Last Post: 19th February 2010, 18:44
  5. Activating multiple windows
    By lixo1 in forum Qt Programming
    Replies: 2
    Last Post: 12th May 2009, 20:54

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
  •  
Qt is a trademark of The Qt Company.