Results 1 to 7 of 7

Thread: Add docks and make them visible

  1. #1
    Join Date
    Aug 2009
    Posts
    4
    Qt products
    Qt Jambi
    Platforms
    Unix/X11

    Question Add docks and make them visible

    Hi, I'm a new Qt4 user and I have my project where I want to open a dock after
    the user clicked on a button. I'm using Qt Jambi, but I guess it's the same.

    So I add the new dock to the window:
    (parent is a QMainWindow and dock is my QDockWidget)

    parent.addDockWidget(Qt.DockWidgetArea.RightDockWi dgetArea, dock)
    parent.tabifyDockWidget(dock, uiMainWindow.addonDock)

    That code will add the dock in the right area and 'tabify' it. But now it is
    in the background, i.e. the user need to click on the dock's tab to open it.
    In the forderground is still the other dock. You can see the screenshot:
    http://gallery2.deventm.org/main.php?g2_itemId=484

    What is the method to make the new dock-tab to put in the forderground?

    Thank you, Devent.

  2. #2
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Add docks and make them visible


  3. #3
    Join Date
    Aug 2009
    Posts
    4
    Qt products
    Qt Jambi
    Platforms
    Unix/X11

    Default Re: Add docks and make them visible

    Quote Originally Posted by franz View Post
    Thank you, but I think you misunderstood me. I try to explain better.

    In my window I have a dock that is visible from the start of the application. Now I like to open another dock in the same location if the user clicks a button. But the problem is that the dock opens in the background of the dock-tab. The user need to click on the 'Units Ov...' tab to open the dock as you can see in the screenshot.

    Now my question is: How do I put this new dock automaticly in the forderground?

    I tried dock.show(), dock.setFocus() but nothing works.

  4. #4
    Join Date
    Jul 2009
    Location
    Enschede, Netherlands
    Posts
    462
    Thanked 69 Times in 67 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Add docks and make them visible

    I didn't misinterpret your question, I misinterpreted the documentation for the function. I expected a way to influence the behavior of the QTabBar but couldn't find any either.

  5. #5
    Join Date
    Aug 2009
    Posts
    4
    Qt products
    Qt Jambi
    Platforms
    Unix/X11

    Default Re: Add docks and make them visible

    Quote Originally Posted by franz View Post
    I didn't misinterpret your question, I misinterpreted the documentation for the function. I expected a way to influence the behavior of the QTabBar but couldn't find any either.
    I couldn't find anything either so I asked here. But thank you anyway, I 'solved' this by rearranging the docks in my GUI.

  6. #6
    Join Date
    Sep 2009
    Posts
    15
    Thanks
    1
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Add docks and make them visible

    I'm struggling with this as well in 4.5.2. I've added a second QDockWidget to the main window and successfully tabbed it as I desire using QMainWindow::tabifyDockWidget. However, the last dock widget added is NEVER selected. In my application the new dock widget represents the last open file so I always want that one to be active. I have tried using raise(), activateWindow(), and show(). Nothing has worked. I also tried reversing the order that the dock widgets are listed in my call to QMainWindow::tabifyDockWidget. I've tried calling raise() before tabifying the dock widget. Nothing is allowing me to programatically select a specific tabbed dock widget.

    Has anyone found a solution or workaround for this problem? It's going to be a major annoyance to my users for them to have to select that tab in order to see the last file they opened.

    Thanks

  7. #7

    Default Re: Add docks and make them visible

    I've found a solution. If you want to put created dock widget in a foreground tab, you should do this:

    main_window->tabifyDockWidget(old_dock_widget, new_dock_widget);
    QApplication::processEvents();
    new_dock_widget->raise();

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.