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. Widget jumps/flickers when hide another widget
Forum Updated to NodeBB v4.3 + New Features

Widget jumps/flickers when hide another widget

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 4 Posters 869 Views 2 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.
  • A Offline
    A Offline
    Andeksan
    wrote on last edited by Andeksan
    #1

    Hi,
    I have unpleasant behavior for my application which i do not know how to eliminate. My application is huge and has a lot of UI components. I prepared sandbox where it also possible to reproduce. The test app more less has the same widget structure as the main app. The main problem is, when "main area" is hiding the "Hide" button jumps for a moment below and back to correct place. The fastest way to reproduce is quick clicking on the button)

    Qt5.12.5, Win 10
    mainwindow.h

    #ifndef MAINWINDOW_H
    #define MAINWINDOW_H
    
    #include <QMainWindow>
    
    QT_BEGIN_NAMESPACE
    namespace Ui { class MainWindow; }
    QT_END_NAMESPACE
    
    class MainWindow : public QMainWindow
    {
        Q_OBJECT
    
    public:
        MainWindow(QWidget *parent = nullptr);
        ~MainWindow();
    
    private:
        Ui::MainWindow *ui;
    };
    #endif // MAINWINDOW_H
    
    

    mainwindow.cpp

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    #include <QPushButton>
    #include <QListView>
    #include <QDebug>
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    
        connect(ui->pushButton, &QPushButton::clicked, [this](bool checked) {
            ui->listWidget->setHidden(checked);
        });
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    

    mainwindow.ui

    <?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>1000</width>
        <height>751</height>
       </rect>
      </property>
      <property name="sizePolicy">
       <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
        <horstretch>0</horstretch>
        <verstretch>0</verstretch>
       </sizepolicy>
      </property>
      <property name="minimumSize">
       <size>
        <width>500</width>
        <height>500</height>
       </size>
      </property>
      <property name="maximumSize">
       <size>
        <width>1000</width>
        <height>800</height>
       </size>
      </property>
      <property name="windowTitle">
       <string>MainWindow</string>
      </property>
      <widget class="QWidget" name="centralwidget">
       <layout class="QVBoxLayout" name="verticalLayout">
        <item>
         <widget class="QWidget" name="keyboard_search" native="true">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
            <horstretch>0</horstretch>
            <verstretch>0</verstretch>
           </sizepolicy>
          </property>
          <property name="minimumSize">
           <size>
            <width>0</width>
            <height>0</height>
           </size>
          </property>
          <property name="styleSheet">
           <string notr="true">border-radius: 2px; 
    border: 1px solid red;</string>
          </property>
          <layout class="QHBoxLayout" name="horizontalLayout">
           <property name="spacing">
            <number>0</number>
           </property>
           <property name="leftMargin">
            <number>0</number>
           </property>
           <property name="topMargin">
            <number>0</number>
           </property>
           <property name="rightMargin">
            <number>0</number>
           </property>
           <property name="bottomMargin">
            <number>0</number>
           </property>
           <item>
            <spacer name="horizontalSpacer">
             <property name="orientation">
              <enum>Qt::Horizontal</enum>
             </property>
             <property name="sizeHint" stdset="0">
              <size>
               <width>40</width>
               <height>20</height>
              </size>
             </property>
            </spacer>
           </item>
           <item>
            <widget class="QWidget" name="keyboard" native="true">
             <property name="sizePolicy">
              <sizepolicy hsizetype="Preferred" vsizetype="Minimum">
               <horstretch>0</horstretch>
               <verstretch>0</verstretch>
              </sizepolicy>
             </property>
             <property name="minimumSize">
              <size>
               <width>700</width>
               <height>0</height>
              </size>
             </property>
             <property name="maximumSize">
              <size>
               <width>700</width>
               <height>16777215</height>
              </size>
             </property>
             <layout class="QVBoxLayout" name="verticalLayout_2">
              <property name="leftMargin">
               <number>0</number>
              </property>
              <property name="topMargin">
               <number>0</number>
              </property>
              <property name="rightMargin">
               <number>0</number>
              </property>
              <property name="bottomMargin">
               <number>0</number>
              </property>
              <item>
               <widget class="QPushButton" name="pushButton">
                <property name="sizePolicy">
                 <sizepolicy hsizetype="Preferred" vsizetype="Fixed">
                  <horstretch>0</horstretch>
                  <verstretch>0</verstretch>
                 </sizepolicy>
                </property>
                <property name="minimumSize">
                 <size>
                  <width>0</width>
                  <height>70</height>
                 </size>
                </property>
                <property name="maximumSize">
                 <size>
                  <width>16777215</width>
                  <height>70</height>
                 </size>
                </property>
                <property name="text">
                 <string>Hide</string>
                </property>
                <property name="checkable">
                 <bool>true</bool>
                </property>
               </widget>
              </item>
              <item>
               <widget class="QListWidget" name="listWidget">
                <property name="sizePolicy">
                 <sizepolicy hsizetype="Preferred" vsizetype="Preferred">
                  <horstretch>0</horstretch>
                  <verstretch>0</verstretch>
                 </sizepolicy>
                </property>
               </widget>
              </item>
             </layout>
            </widget>
           </item>
           <item>
            <spacer name="horizontalSpacer_2">
             <property name="orientation">
              <enum>Qt::Horizontal</enum>
             </property>
             <property name="sizeHint" stdset="0">
              <size>
               <width>40</width>
               <height>20</height>
              </size>
             </property>
            </spacer>
           </item>
          </layout>
         </widget>
        </item>
        <item>
         <widget class="QWidget" name="widget_2" native="true">
          <property name="sizePolicy">
           <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
            <horstretch>0</horstretch>
            <verstretch>0</verstretch>
           </sizepolicy>
          </property>
          <property name="styleSheet">
           <string notr="true">border-radius: 2px; 
    border: 1px solid blue;</string>
          </property>
          <layout class="QVBoxLayout" name="verticalLayout_3">
           <property name="spacing">
            <number>0</number>
           </property>
           <property name="leftMargin">
            <number>0</number>
           </property>
           <property name="topMargin">
            <number>0</number>
           </property>
           <property name="rightMargin">
            <number>0</number>
           </property>
           <property name="bottomMargin">
            <number>0</number>
           </property>
           <item>
            <widget class="QWidget" name="mainArea" native="true">
             <property name="sizePolicy">
              <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
               <horstretch>0</horstretch>
               <verstretch>0</verstretch>
              </sizepolicy>
             </property>
            </widget>
           </item>
          </layout>
         </widget>
        </item>
       </layout>
      </widget>
     </widget>
     <resources/>
     <connections/>
    </ui>
    

    jump.png
    ezgif.com-gif-maker.gif
    I am very appreciate for the help.

    1 Reply Last reply
    0
    • Christian EhrlicherC Offline
      Christian EhrlicherC Offline
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Works fine for me with Qt5.15 on Windows and Linux.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      1 Reply Last reply
      1
      • A Offline
        A Offline
        Andeksan
        wrote on last edited by
        #3

        I have also checked on different hardware, OS and qt versions. this behavior also present.

        SGaistS 1 Reply Last reply
        0
        • A Andeksan

          I have also checked on different hardware, OS and qt versions. this behavior also present.

          SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi,

          @Andeksan said in Widget jumps/flickers when hide another widget:

          I have also checked on different hardware, OS and qt versions. this behavior also present.

          Which Qt versions ?
          Which OSs ?

          Did you stay in the 5.12 series or did you try more recent as well ?
          Did you check your graphics card drivers ?

          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
          • A Offline
            A Offline
            Andeksan
            wrote on last edited by
            #5

            Qt versions : 5.3.2, 5.4.1, 5.7.0, 5.12.5.
            OSs: win 10, KDE(20.04).
            Hardware: Latitude 7400, ROG GL552.

            For Latitude 7400 video driver is up to date. For ROG is old.

            1 Reply Last reply
            0
            • Christian EhrlicherC Offline
              Christian EhrlicherC Offline
              Christian Ehrlicher
              Lifetime Qt Champion
              wrote on last edited by
              #6

              Why do you expect that it works with an older version (except it would be a regression). Update to 5.15 and check again.

              Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
              Visit the Qt Academy at https://academy.qt.io/catalog

              A 1 Reply Last reply
              0
              • Christian EhrlicherC Christian Ehrlicher

                Why do you expect that it works with an older version (except it would be a regression). Update to 5.15 and check again.

                A Offline
                A Offline
                Andeksan
                wrote on last edited by
                #7

                @Christian-Ehrlicher does not make sense to try because project uses Qt5.12.5.

                1 Reply Last reply
                0
                • Christian EhrlicherC Offline
                  Christian EhrlicherC Offline
                  Christian Ehrlicher
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  Then you have to live with it. Neither 5.12.5 will be fixed nor looks it like a problem in your code.

                  Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
                  Visit the Qt Academy at https://academy.qt.io/catalog

                  1 Reply Last reply
                  0
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #9

                    Hi
                    I tried with Qt 5.9.1 in linux and i cant get it to do it.
                    alt text

                    A 1 Reply Last reply
                    1
                    • mrjjM mrjj

                      Hi
                      I tried with Qt 5.9.1 in linux and i cant get it to do it.
                      alt text

                      A Offline
                      A Offline
                      Andeksan
                      wrote on last edited by
                      #10

                      @mrjj, @Christian-Ehrlicher thanks for checking. i see that is not reproducible on your side.
                      I did more checks: with qt 5.15.2 and 6.0.1 and on my side this bug is still presented. Also i tried on VM with KDE qt 5.12.8 only there it works normally.

                      mrjjM 1 Reply Last reply
                      0
                      • A Andeksan

                        @mrjj, @Christian-Ehrlicher thanks for checking. i see that is not reproducible on your side.
                        I did more checks: with qt 5.15.2 and 6.0.1 and on my side this bug is still presented. Also i tried on VM with KDE qt 5.12.8 only there it works normally.

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #11

                        @Andeksan

                        So even with 5.15.2 you see this on your systems?

                        Also, the Latitude 7400 is not very old, is it ?

                        A 1 Reply Last reply
                        0
                        • mrjjM mrjj

                          @Andeksan

                          So even with 5.15.2 you see this on your systems?

                          Also, the Latitude 7400 is not very old, is it ?

                          A Offline
                          A Offline
                          Andeksan
                          wrote on last edited by
                          #12

                          @mrjj yes i see this effect on 5.15.2 and 6.0.1. I would say Latitude 7400 is fresh.

                          mrjjM 1 Reply Last reply
                          0
                          • A Andeksan

                            @mrjj yes i see this effect on 5.15.2 and 6.0.1. I would say Latitude 7400 is fresh.

                            mrjjM Offline
                            mrjjM Offline
                            mrjj
                            Lifetime Qt Champion
                            wrote on last edited by
                            #13

                            @Andeksan

                            Do they have anything in common gfx wise ?
                            Like both using intel driver or similar ?

                            It cant really be the app as its as basic as possible so i think it some sort
                            of gfx glitch but I also tried on old laptop that has 3d issues but
                            not even there i could get it to do it.

                            Looking at the video , it seems it has an extra redraw while the layout adjusts.

                            Im not really sure how we can work around it as not sure why we can see it in the video.

                            A 1 Reply Last reply
                            0
                            • mrjjM mrjj

                              @Andeksan

                              Do they have anything in common gfx wise ?
                              Like both using intel driver or similar ?

                              It cant really be the app as its as basic as possible so i think it some sort
                              of gfx glitch but I also tried on old laptop that has 3d issues but
                              not even there i could get it to do it.

                              Looking at the video , it seems it has an extra redraw while the layout adjusts.

                              Im not really sure how we can work around it as not sure why we can see it in the video.

                              A Offline
                              A Offline
                              Andeksan
                              wrote on last edited by
                              #14

                              @mrjj yes both laptops use Intel UHD Graphics. it can be cause of this behavior. Before this post i tried to find similar discussions in the internet and there are of few of them. Seems to me this issue is kind of single cases and hardware/driver depended. I think, if i have spare time i will investigate it deeper.

                              mrjjM 1 Reply Last reply
                              0
                              • A Andeksan

                                @mrjj yes both laptops use Intel UHD Graphics. it can be cause of this behavior. Before this post i tried to find similar discussions in the internet and there are of few of them. Seems to me this issue is kind of single cases and hardware/driver depended. I think, if i have spare time i will investigate it deeper.

                                mrjjM Offline
                                mrjjM Offline
                                mrjj
                                Lifetime Qt Champion
                                wrote on last edited by
                                #15

                                @Andeksan

                                well, it could be something like that.
                                It might not happen that often either.
                                At least, I could not get the demo code to show even trying around
                                different hardware.

                                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