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. Child widgets inside a QDockWidget not updated when QDockWidget::setFloating(true)
Forum Updated to NodeBB v4.3 + New Features

Child widgets inside a QDockWidget not updated when QDockWidget::setFloating(true)

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 4 Posters 526 Views 3 Watching
  • 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.
  • Ashokraj RamasamyA Offline
    Ashokraj RamasamyA Offline
    Ashokraj Ramasamy
    wrote on last edited by Ashokraj Ramasamy
    #1

    Hello Qt guys,

    I am facing a problem with QDockWidget children updates. Our code setup works fine with Qt5.6.2 and we recently upgraded to Qt5.12.10 and the problem comes up.
    The problem is seen only if the QDockWidget is undocked(Floated). Everything works fine when docked again.
    Some of the problems in child widgets updates like,

    • QCheckBox check state - not updated when we toggled.
    • QScrollArea scrollbar - not updating when we scroll.
    • QTreeView - not updating the expand/collapse the treeview items

    Note: If we click outside the QDockWidget(ex: click on Mainwindow), then all the child widgets updated/refreshed to the correct state. So seems, update()/repaint()/... not happens with children interactions.

    Our code setup:

    1. DockWidget creation with children
    CustomDockWidget *dock = new CustomDockWidget("Test", m_pMainWindow);
    	dock->setWidget(new CustomWidget(m_pMainWindow)); // CustomWidget children are not updated properly when QDockWidget is in floating state
    	m_pMainWindow->addDockWidget(Qt::RightDockWidgetArea, dock);
    	dock->show();
    
    1. DockWidget setup
    CustomDockWidget::CustomDockWidget(const QString &title, QWidget *parent)
    	: QDockWidget(title, parent)
    {
    	setWindowFlags(windowFlags() | Qt::FramelessWindowHint);
    	setAttribute(Qt::WA_TranslucentBackground, true); // suspecting the problem with this attribute
    	setAttribute(Qt::WA_NoSystemBackground, false);
    	setFloating(true);
    	setFeatures(QDockWidget::DockWidgetFloatable);
    	
    	setTitleBarWidget(new CustomTitleBar(this));
    }
    

    If we comment, "setAttribute(Qt::WA_TranslucentBackground, true);" everything works fine in both dock & undocked state. But we should need this, to show the QDockWidget in a transparent state in some scenarios.

    So, anyone please help me out to find the root cause of this problem of updating Qt5.6.2 to Qt5.12.10 with Qt::WA_TranslucentBackground attribute setup.

    Thanks.

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

      Hi and welcome to devnet,

      Can you provide a minimal compilable example that triggers this change of behaviour ?

      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
        #3

        Are the widgets in the dock computational expensive?
        I had similar problems with 3D-plots in docks. The problem in my case could be traced to a timing issue. When the widgets took some time to render then they would not correctly update.
        Solution was to add a QTimer::singleShot() that triggers an update after docking/undocking with some delay.

        Ashokraj RamasamyA 1 Reply Last reply
        0
        • gde23G gde23

          Are the widgets in the dock computational expensive?
          I had similar problems with 3D-plots in docks. The problem in my case could be traced to a timing issue. When the widgets took some time to render then they would not correctly update.
          Solution was to add a QTimer::singleShot() that triggers an update after docking/undocking with some delay.

          Ashokraj RamasamyA Offline
          Ashokraj RamasamyA Offline
          Ashokraj Ramasamy
          wrote on last edited by
          #4

          @gde23
          Hi,
          The widgets do not have any expensive computations and also do not have any render-related widgets. In my case, a simple scroll area with scrollable contents is not updating in the floatable dock widget. In my case, the problem is not during the dock or un dock time. Once the widget is un docked, then if we do any interactions on ui(ex: scroll the content in scroll area) then its not updating the scroll bars position, contents.

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

            I insist, a minimal compilable example would allow us to test your issue.

            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
            • C Offline
              C Offline
              ChrisW67
              wrote on last edited by
              #6

              @Ashokraj-Ramasamy said in Child widgets inside a QDockWidget not updated when QDockWidget::setFloating(true):
              Check whether the CustomWidget correctly uses a layout also.

              1 Reply Last reply
              0

              • Login

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