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. Only QPushButton don't call repaint ?
Forum Updated to NodeBB v4.3 + New Features

Only QPushButton don't call repaint ?

Scheduled Pinned Locked Moved Unsolved General and Desktop
8 Posts 3 Posters 628 Views 1 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.
  • T Offline
    T Offline
    Tony123
    wrote on last edited by Tony123
    #1

    Hi guys I have experienced very strange behavior on my mini Qt App?

    I put empty QComboBox to my dialog which is connected to a QPushButton and QRadioButton.
    Both of QPushButton and QRadioButton has connected a func which simply call AddItem func on QComboBox.

    After the QRadioButton has been clicked the Combobox gets a new item and it appears right away.
    If I clicked on QPushButton though, there is a new item as well but only appears if I lost the focus and get back to the dialog. So it looks like there is a repaint issue associated only with a QPushButton.

    PS: In the older version, I not experienced this behavior and my current setup is :

    MacOs: 10.15.4
    Xcode: 11.5.1
    Qt: 5.13.2
    Qt Creator 4.12.1

    Code below:

    #include "mainwindow.h"
    #include "ui_mainwindow.h"
    
    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
    {
        ui->setupUi(this);
    
    }
    
    MainWindow::~MainWindow()
    {
        delete ui;
    }
    
    
    void MainWindow::on_pushButton_clicked()
    {
        ui->comboBox->addItem("insert 1");
    }
    
    void MainWindow::on_radioButton_toggled(bool checked)
    {
        ui->comboBox->addItem("insert 1");
    }
    
    
    B 1 Reply Last reply
    2
    • mrjjM Offline
      mrjjM Offline
      mrjj
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi
      I have seen some bug reports about MacOs and repainting.
      Please try
      void MainWindow::on_pushButton_clicked()
      {
      ui->comboBox->addItem("insert 1");
      ui->comboBox->update();
      }

      and see if it then works every time.

      1 Reply Last reply
      0
      • T Offline
        T Offline
        Tony123
        wrote on last edited by
        #3

        @mrjj said in Only QPushButton don't call repaint ?:

        ui->comboBox->update();

        It not helped at all. Still same behavior.

        mrjjM 1 Reply Last reply
        0
        • T Tony123

          @mrjj said in Only QPushButton don't call repaint ?:

          ui->comboBox->update();

          It not helped at all. Still same behavior.

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

          @Tony123
          Ok
          and the bug i was think of , seems to be fixed in that version.
          https://bugreports.qt.io/browse/QTBUG-68740

          Did you update to Catalina recently ?

          T 1 Reply Last reply
          1
          • mrjjM mrjj

            @Tony123
            Ok
            and the bug i was think of , seems to be fixed in that version.
            https://bugreports.qt.io/browse/QTBUG-68740

            Did you update to Catalina recently ?

            T Offline
            T Offline
            Tony123
            wrote on last edited by
            #5

            @mrjj Currently I using Catalina 10.15.4 but I tested mini-app on 10.15.5 as well and the same issue appears.

            mrjjM 1 Reply Last reply
            0
            • T Tony123

              @mrjj Currently I using Catalina 10.15.4 but I tested mini-app on 10.15.5 as well and the same issue appears.

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

              @Tony123

              Could you test with a newer Qt`?

              Qt 51.5 says
              alt text

              but Qt 5.13
              alt text

              and this issue is really odd so i wonder if its a compatibility issue.

              T 1 Reply Last reply
              0
              • mrjjM mrjj

                @Tony123

                Could you test with a newer Qt`?

                Qt 51.5 says
                alt text

                but Qt 5.13
                alt text

                and this issue is really odd so i wonder if its a compatibility issue.

                T Offline
                T Offline
                Tony123
                wrote on last edited by
                #7

                @mrjj Thanks for this information. I try to go to the newer version (5.14.2, 5.15) of Qt but with no luck on Mac, I also created an issue related to this https://forum.qt.io/topic/114783/can-t-compile-my-project-after-updating-xcode-and-qt which is not resolved yet.

                1 Reply Last reply
                0
                • T Tony123

                  Hi guys I have experienced very strange behavior on my mini Qt App?

                  I put empty QComboBox to my dialog which is connected to a QPushButton and QRadioButton.
                  Both of QPushButton and QRadioButton has connected a func which simply call AddItem func on QComboBox.

                  After the QRadioButton has been clicked the Combobox gets a new item and it appears right away.
                  If I clicked on QPushButton though, there is a new item as well but only appears if I lost the focus and get back to the dialog. So it looks like there is a repaint issue associated only with a QPushButton.

                  PS: In the older version, I not experienced this behavior and my current setup is :

                  MacOs: 10.15.4
                  Xcode: 11.5.1
                  Qt: 5.13.2
                  Qt Creator 4.12.1

                  Code below:

                  #include "mainwindow.h"
                  #include "ui_mainwindow.h"
                  
                  MainWindow::MainWindow(QWidget *parent)
                      : QMainWindow(parent)
                      , ui(new Ui::MainWindow)
                  {
                      ui->setupUi(this);
                  
                  }
                  
                  MainWindow::~MainWindow()
                  {
                      delete ui;
                  }
                  
                  
                  void MainWindow::on_pushButton_clicked()
                  {
                      ui->comboBox->addItem("insert 1");
                  }
                  
                  void MainWindow::on_radioButton_toggled(bool checked)
                  {
                      ui->comboBox->addItem("insert 1");
                  }
                  
                  
                  B Offline
                  B Offline
                  barnyqwe
                  wrote on last edited by
                  #8
                  This post is deleted!
                  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