Results 1 to 4 of 4

Thread: Focus in QDockWidget disappears

  1. #1
    Join Date
    Jul 2008
    Posts
    16
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11

    Default Focus in QDockWidget disappears

    Hi,
    I’m on OS X with Qt 4.5.

    In my application I use several QDockWindowswith QSpinBoxs. The problem is that when these are floating and I click inside a dockwindow, the whole dock window does not recieve any focus unless I click its title bar. So, it is not possible to directly select a spin box, as the cursor won’t show up in there. Clicking the up and down arrows of the spin box works, though.

    The problem can also be seen with the dockwidgets example from Qt documentation.
    When for example I set the paragraphs widget to floating, then click one of the customers, and then click inside the paragraphs widget, the selected line is greyed out, meaning that actually the dockwidget has no focus. After clicking the title bar, however, the line turns blue, which I think should be the default behaviour.

    Anyone else having this problem or knows a fix to it?

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Maui, Hawaii
    Posts
    120
    Thanks
    65
    Thanked 4 Times in 4 Posts
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Focus in QDockWidget disappears

    I'm having the same problem!

  3. #3
    Join Date
    Mar 2011
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Focus in QDockWidget disappears

    Quote Originally Posted by mhoover View Post
    I'm having the same problem!
    I had the same issue when using QDockWidget. Whenever the dock widget was shown for the first time, its contents wouldn't have focus. Moving the window manually, however, would fix the issue.

    Some initial experimentation found that calling activateWindow() on the dock widget would temporarily fix the problem. However, if another window got focus, the same issue would reoccur.

    In my particular case, I set the dock widget to initially be floating. That is, I had the floating property checked in Qt Designer in the dock widget properties. To resolve the focus issue, I unchecked this property and then called setFloating(true) after the dock widget was constructed. This seems to fix the issue in my situation.
    Last edited by Krishna; 28th March 2011 at 22:35. Reason: updated contents

  4. #4
    Join Date
    Mar 2011
    Posts
    2
    Qt products
    Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Focus in QDockWidget disappears

    Upon further experimentation, I realized that if you have a custom title bar, you must set the floating property on the QDockWidget after setting the title bar. That did the trick.

Similar Threads

  1. Window focus issues (How to force focus to a window?)
    By montylee in forum Qt Programming
    Replies: 3
    Last Post: 25th April 2009, 01:00
  2. Focus rect not drawing
    By draftpunk in forum Qt Programming
    Replies: 3
    Last Post: 11th November 2008, 15:21
  3. QTableView focus issue
    By gemidjy in forum Qt Programming
    Replies: 4
    Last Post: 19th February 2008, 15:51
  4. Force focus to a QTabWidget page's widget
    By thomaspu in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2008, 06:54
  5. Tab/Enter focus problem
    By b1 in forum Qt Programming
    Replies: 4
    Last Post: 23rd October 2006, 23:34

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.