QTextEdit focus problem



  • I'm building a small programming environment with a widget that inherits QTextEdit for editing code, and a widget that inherits QTreeWidget for displaying parse issues.
    When I double-click on an issue (an item in the tree widget) it (among other things) calls setFocus() on the edit widget which makes the cursor visible, but it doesn't receive the keyboard input (I can't type anything) until I actually click on the edit widget.
    Debugger definitely shows that setFocus() is called.

    I'm using Qt 5.0.1 on Ubuntu 13.04



  • The same code works perfectly with Qt 4.8.0 on Ubuntu 12.04


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    This sounds like a regression, can you test your application with Qt 4 on your Ubuntu 13.04 ? Just to exclude an OS problem.

    You can also check the "bug report":http://bugreports.qt-project.org/issues/ system to see if this is a known problem



  • Thanks for the reply, SGaist

    I'll try it as soon as possible, I'm also not quite sure if it is an OS or Qt problem, but there seems to be a decoupling of when focus is displayed on the widget and when the widget actually receives keyboard input.
    Sometimes the opposite happens: i can select and edit the text, but the selection looks as if the widget lost focus (is light gray instead of orange on ubuntu).



  • Small update: I know it's not a proper test, but I tried the same code with Qt 5.1.0 on Windows, and it worked fine.

    Regarding testing with Qt 4 on Ubuntu 13.04, can I install it now the 5.0.1 is already installed without causing conflicts between versions?


  • Lifetime Qt Champion

    Yes you can, the official bundles installs Qt 5 in you home directory and building it from scratch will install it in it's own folder, so you don't have to worry about that.

    The only thing you have to think about is if you use some external/system libraries linked to Qt. They will use the system's Qt which would the 4 series and your application will crash in strange sorts of ways otherwise, no problem.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.