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. QT widget load time on first click

QT widget load time on first click

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 3 Posters 567 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.
  • D Offline
    D Offline
    DevM
    wrote on last edited by
    #1

    Hey,

    Is there a reason why a widget would take time to load on the first click? Like shown here: https://streamable.com/7lba5

    I have made sure that the object gets created when the app opens but it didn't help, It's something that is not that important since it's only the first time but it still bothers me somewhat.

    Here is the relevant code:

    MainWindow::MainWindow(QWidget *parent)
        : QMainWindow(parent)
        , ui(new Ui::MainWindow)
        , state(Nothing)
    {
        ui->setupUi(this);
    
    // . . .
    
        abtApp =new AboutApplication(this);
        abtApp->hide();
    
    
    }
    
    void MainWindow::on_actionAbout_triggered()
    {
        if(state != windowState::About){
            this->centralWidget()->layout()->addWidget(abtApp);
            ui->UAIcon->hide();
            abtApp->show();
    
            state = windowState::About;
        }
        else if(state == windowState::About){
            this->centralWidget()->layout()->removeWidget(abtApp);
            abtApp->hide();
            ui->UAIcon->show();
    
            state = windowState::Nothing;
        }
    
    }
    
    
    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      What version of Qt ?
      On what platform ?
      Do you do anything special in your main function ?

      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
      • D Offline
        D Offline
        DevM
        wrote on last edited by
        #3

        Just loads a background Image that's it and its QT 5.14.1

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

          @DevM said in QT widget load time on first click:

          Just loads a background Image

          What size?

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

            1920x1080 , it loads when the application starts thought not when clicking the new window which is where the slow down is

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

              Then try to not display the image to see if it helps. If so try to create a small reproducer or check it by yourself with valgrind (callgrind) to see where the cpu time is spent.

              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

              • Login

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