Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QDockWidget problem with focus when undocked
QtWS25 Last Chance

QDockWidget problem with focus when undocked

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 1.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • gde23G Offline
    gde23G Offline
    gde23
    wrote on last edited by gde23
    #1

    Hi,

    I have a QDockWidget with some other QWidgets inside (QTreeView with Delegates)

    Now when I undock it and than try to edit a entry of the QTreeView by clicking a cell, the cursor appears in the cell, however than the focus of the window jumps to the MainWindow (Title bar gets highlighted as if it is in the front) and i cannot edit the entry.

    This only happens sometimes (docking and undocking allows turning the problem on and off) and I have no clue on how to debug it.

    Any ideas what the reason could be??

    Qt Version is 5.11 on Debian Strech

    EDIT: I just found out that the focus also jumps back to the MainWindow when I do not try to edit anything, but just click the titlebar or anywhere else on the QDockWidget.

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      HI,

      How did you install Qt ?
      Do you have the same behaviour with the distribution provided Qt ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • gde23G Offline
        gde23G Offline
        gde23
        wrote on last edited by gde23
        #3

        I've installed it over the Qt-Installer / Maintenance Tool.
        When I use the Qt version shipped with the distribution (5.7.1) i get the same behavior.

        EDIT: I have set up a new Project just with the Qt-Designer

        • New Qt Widget Application
        • Add a Dock Widgets (with Designer or by code)
        • Run
          -> Same problem there

        This the mainwindwo.cpp

        #include "mainwindow.h"
        #include "ui_mainwindow.h"
        #include <QDockWidget>
        
        MainWindow::MainWindow(QWidget *parent) :
            QMainWindow(parent),
            ui(new Ui::MainWindow)
        {
            ui->setupUi(this);
        
            QDockWidget *dock = new QDockWidget(tr("Test"), this);
            dock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
            QWidget *wi = new QWidget(this);
            dock->setWidget(wi);
            addDockWidget(Qt::RightDockWidgetArea, dock);
        
        }
        
        MainWindow::~MainWindow()
        {
            delete ui;
        }
        
        

        Or this is the second thing i tried with the Designer. Same problem
        This is the Qt-Designer ui file

        <?xml version="1.0" encoding="UTF-8"?>
        <ui version="4.0">
         <class>MainWindow</class>
         <widget class="QMainWindow" name="MainWindow">
          <property name="geometry">
           <rect>
            <x>0</x>
            <y>0</y>
            <width>400</width>
            <height>300</height>
           </rect>
          </property>
          <property name="windowTitle">
           <string>MainWindow</string>
          </property>
          <widget class="QWidget" name="centralWidget"/>
          <widget class="QMenuBar" name="menuBar">
           <property name="geometry">
            <rect>
             <x>0</x>
             <y>0</y>
             <width>400</width>
             <height>19</height>
            </rect>
           </property>
          </widget>
          <widget class="QToolBar" name="mainToolBar">
           <attribute name="toolBarArea">
            <enum>TopToolBarArea</enum>
           </attribute>
           <attribute name="toolBarBreak">
            <bool>false</bool>
           </attribute>
          </widget>
          <widget class="QStatusBar" name="statusBar"/>
          <widget class="QDockWidget" name="dockWidget_3">
           <attribute name="dockWidgetArea">
            <number>1</number>
           </attribute>
           <widget class="QWidget" name="dockWidgetContents_3"/>
          </widget>
         </widget>
         <layoutdefault spacing="6" margin="11"/>
         <resources/>
         <connections/>
        </ui>
        
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          What desktop environment are you using ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • gde23G Offline
            gde23G Offline
            gde23
            wrote on last edited by
            #5

            The desktop environment is KDE (under Debian)
            I've tested it on Windows 7 today, there the problem does not occur.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              What version of Qt for Windows ?

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0
              • gde23G Offline
                gde23G Offline
                gde23
                wrote on last edited by
                #7

                On Widows it's also Qt 5.11 which is the same as on the Debian machine (also installed over the Qt-Installer)

                1 Reply Last reply
                0
                • Pl45m4P Pl45m4 referenced this topic on

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved