Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt for Python
  4. Zoom the frame on click

Zoom the frame on click

Scheduled Pinned Locked Moved Unsolved Qt for Python
5 Posts 3 Posters 608 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.
  • A Offline
    A Offline
    Adarshpandey
    wrote on last edited by
    #1

    I have create a UI with the help of qt designer and access the camera on the label widget with python and now i want zoom the camera on the click of label please help.

    jsulmJ 1 Reply Last reply
    0
    • A Adarshpandey

      I have create a UI with the help of qt designer and access the camera on the label widget with python and now i want zoom the camera on the click of label please help.

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

      @Adarshpandey Take a look at the suggestion here: https://forum.qt.io/topic/113473/zoom-in-and-zoom-out-on-qlabel-image/2

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

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

        can you please describe in detailed in python

        jsulmJ 1 Reply Last reply
        0
        • A Adarshpandey

          can you please describe in detailed in python

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

          @Adarshpandey No, I will not translate the code to Python for you. Try to do it by yourself and if something is not clear ask concrete questions...

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

          1 Reply Last reply
          2
          • Ard_FlamingoA Offline
            Ard_FlamingoA Offline
            Ard_Flamingo
            wrote on last edited by Ard_Flamingo
            #5

            To add on to @jsulm 's answer:

            It seems what you're after is:

            void ImageViewer::scaleImage(double factor)
            {
                scaleFactor *= factor;
                imageLabel->resize(scaleFactor * imageLabel->pixmap(Qt::ReturnByValue).size());
            
                adjustScrollBar(scrollArea->horizontalScrollBar(), factor);
                adjustScrollBar(scrollArea->verticalScrollBar(), factor);
            
                zoomInAct->setEnabled(scaleFactor < 3.0);
                zoomOutAct->setEnabled(scaleFactor > 0.333);
            }
            

            (Function copied from https://doc.qt.io/qt-5/qtwidgets-widgets-imageviewer-example.html (the place where @jsulm pointed you to))

            C++ is easy enough to convert to Python, or at least is easy to understand the concept of the function whether you know C++ or not, though I may be a bit biased as I know both languages.

            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