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. Getting width and height of QLabel object in realtime
Forum Updated to NodeBB v4.3 + New Features

Getting width and height of QLabel object in realtime

Scheduled Pinned Locked Moved Solved General and Desktop
5 Posts 2 Posters 1.8k 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.
  • KiraK Offline
    KiraK Offline
    Kira
    wrote on last edited by aha_1980
    #1

    Hello All,
    I am inheriting a QLabel class in a class called LabelAnnotation and promoting it to the QLabel in the form of MainWindow.
    I have a function called MapLabel, in which I need to get dynamic coordinates of the LabelAnnotation class.
    How can we achieve the following?

    Code Sample:

    class LabelAnnotation : public QLabel
    {
        -----
        QList<ROI> MapLabelPointstoImage(QList<ROI>);
        -----
    }
    

    In the above function i need to get the width and height of the LabelAnnotation which can be resized dynamically.

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

      What's wrong with QWidget::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
      1
      • KiraK Offline
        KiraK Offline
        Kira
        wrote on last edited by
        #3

        @Christian-Ehrlicher : Thanks for the reply.

        I want to resize my label to size of Qpixmap how can it be done

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

          @Kira said in Getting width and height of QLable object in realtime:

          I want to resize my label to size of Qpixmap how can it be done

          Read my link, you will find a function to resize the widget there...

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

          KiraK 1 Reply Last reply
          3
          • Christian EhrlicherC Christian Ehrlicher

            @Kira said in Getting width and height of QLable object in realtime:

            I want to resize my label to size of Qpixmap how can it be done

            Read my link, you will find a function to resize the widget there...

            KiraK Offline
            KiraK Offline
            Kira
            wrote on last edited by
            #5

            @Christian-Ehrlicher :ok thanks

            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