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 Button
Forum Updated to NodeBB v4.3 + New Features

Qt Button

Scheduled Pinned Locked Moved Unsolved General and Desktop
15 Posts 3 Posters 655 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.
  • R Rkutun

    Thank you for your response.

    The code I am using is as follows:

    QPixmap pixmap(":/new/prefix1/icons/a.png");
    if (pixmap.isNull()) {
    qDebug() << "Pixmap failed to load!";
    return;
    }

    QBitmap bitmap = pixmap.createMaskFromColor(Qt::white, Qt::MaskInColor);
    if (bitmap.isNull()) {
       qDebug() << "Could not create mask!";
       return;
    }
    
    QBitmap scaledBitmap = QBitmap::fromPixmap(bitmap.scaled(ui->nozzleLeft10mmBtn->size(), Qt::KeepAspectRatio, Qt::SmoothTransformation));
    

    ui->LeftBtn->setMask(scaledBitmap);
    ui->LeftBtn->update();

    jsulmJ Offline
    jsulmJ Offline
    jsulm
    Lifetime Qt Champion
    wrote on last edited by
    #6

    @Rkutun It is not clear where you're executing this code. It is also not clear what you're doing when one of the buttons is clicked.
    Please format your code correctly.

    https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • R Offline
      R Offline
      Rkutun
      wrote on last edited by
      #7

      Thank you for your response.

      I have not added any specific functionality to the button. It only lags when the button is in the pressed state.

      Additionally, I have another button next to it where I rotate an image, and it works smoothly. However, when I press the button with the pixmap, the image freezes.

      Could you provide any suggestions to resolve this issue?

      jsulmJ 1 Reply Last reply
      0
      • R Rkutun

        Thank you for your response.

        I have not added any specific functionality to the button. It only lags when the button is in the pressed state.

        Additionally, I have another button next to it where I rotate an image, and it works smoothly. However, when I press the button with the pixmap, the image freezes.

        Could you provide any suggestions to resolve this issue?

        jsulmJ Offline
        jsulmJ Offline
        jsulm
        Lifetime Qt Champion
        wrote on last edited by
        #8

        @Rkutun "It is not clear where you're executing this code." - you did not answer this...

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • R Offline
          R Offline
          Rkutun
          wrote on last edited by
          #9

          Thank you for your response.

          Could you please clarify what exactly you are asking about? Are you referring to the context in which the code is executed, such as whether it's within a specific function, event handler, or somewhere else? I want to make sure I provide the exact information you need.

          jsulmJ 1 Reply Last reply
          0
          • R Rkutun

            Thank you for your response.

            Could you please clarify what exactly you are asking about? Are you referring to the context in which the code is executed, such as whether it's within a specific function, event handler, or somewhere else? I want to make sure I provide the exact information you need.

            jsulmJ Offline
            jsulmJ Offline
            jsulm
            Lifetime Qt Champion
            wrote on last edited by
            #10

            @Rkutun said in Qt Button:

            Are you referring to the context in which the code is executed

            Yes.

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            0
            • R Offline
              R Offline
              Rkutun
              wrote on last edited by
              #11

              Thank you for your response.

              The code is not triggered by any specific event or function. It is not part of any separate function or event handler. I am directly running it within the MainWindow class during its initialization.

              1 Reply Last reply
              0
              • R Offline
                R Offline
                Rkutun
                wrote on last edited by
                #12

                Help please!!!

                jsulmJ 1 Reply Last reply
                0
                • R Rkutun

                  Help please!!!

                  jsulmJ Offline
                  jsulmJ Offline
                  jsulm
                  Lifetime Qt Champion
                  wrote on last edited by
                  #13

                  @Rkutun Try to profile your app on the device to see where it spends most time when the button lags.

                  https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • R Offline
                    R Offline
                    Rkutun
                    wrote on last edited by
                    #14

                    Thank you for your suggestion.

                    Could you guide me on how to profile the application to analyze where the lag occurs? I would appreciate any tools or steps you recommend to perform this process effectively.

                    jsulmJ 1 Reply Last reply
                    0
                    • R Rkutun

                      Thank you for your suggestion.

                      Could you guide me on how to profile the application to analyze where the lag occurs? I would appreciate any tools or steps you recommend to perform this process effectively.

                      jsulmJ Offline
                      jsulmJ Offline
                      jsulm
                      Lifetime Qt Champion
                      wrote on last edited by
                      #15

                      @Rkutun Take a look at https://ftp.gnu.org/old-gnu/Manuals/gprof-2.9.1/html_mono/gprof.html

                      https://forum.qt.io/topic/113070/qt-code-of-conduct

                      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