Results 1 to 1 of 1

Thread: Confusion on how a dockable widgets decide where they can go

  1. #1
    Join Date
    Jan 2014
    Posts
    36
    Qt products
    Qt4 Qt5
    Platforms
    MacOS X Unix/X11 Windows

    Default Confusion on how a dockable widgets decide where they can go

    I'm encountering a weird oddity with QDockWidgets, and can't figure out what's causing the behavior... I've attached a small demo that should replicate the problem.

    I want a QMainWindow with two types of dock based widgets. In my demo, they're QLineEdits and QTextEdits, in my real app the QTextEdits will be replaced with QwtPlots, but that doesn't seem to be the root of the problem. When the app starts, I want all the QLineEdits in a column on the left side, and all the QTextEdits on the right as shown:
    start.jpg

    So far so good, then the user decides that they would like to put Text Edit 0 up on top, spanning the two columns like so:
    textedit0.jpg
    So the user grabs the title bar for Text Edit 0, drags it up towards the top until he gets the indicator that it will span both columns and drops it. This works great - when there's 12 QLineEdits and 3 QTextEdits.

    But then if I go into my code, in mainwindow.cpp, line 106 and simply change the number of QLineEdits from 12 to 13, the functionality breaks
    Qt Code:
    1. for (int i=0; i < 13; i++)
    To copy to clipboard, switch view to plain text mode 
    In this version, the QTextEdits only want to dock in the same column they're already at the start. If the user moves a QLineEdit around first before they can move Text Edit 0, up to the top. But I can't seem to get the behavior to be consistent... The best I can do is this: where Text Edit 0 is on top, but Line Edit 0 now has to be in the right column.
    textedit0_1.jpg
    And the steps I took to get there was to move Line Edit 0 to the top, spanning both columns, then Text Edit 0 up next to it, then moved Line Edit 0 down to the right column (it refused to go back into the left column. And all it took for this behavior to change is by adding one more QLineEdit...
    Attached Files Attached Files

Similar Threads

  1. Dockable widgets: drag by body, not by header
    By BigSmartFastAndrey in forum Qt Programming
    Replies: 3
    Last Post: 28th March 2012, 08:43
  2. How to decide whether to make a separate class for widgets of a window?
    By TheIndependentAquarius in forum Qt Programming
    Replies: 4
    Last Post: 15th February 2012, 07:51
  3. How to decide which SIGNAL to emit?
    By TheIndependentAquarius in forum Qt Programming
    Replies: 2
    Last Post: 22nd November 2011, 15:09
  4. Replies: 2
    Last Post: 31st July 2009, 09:18
  5. 'Alt+Tab' Operation for QT Apps containg dockable widgets
    By nileshsince1980 in forum Qt Programming
    Replies: 1
    Last Post: 20th May 2009, 09:05

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.