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. Scan for a color of a QLabel
Forum Updated to NodeBB v4.3 + New Features

Scan for a color of a QLabel

Scheduled Pinned Locked Moved Solved General and Desktop
6 Posts 4 Posters 460 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.
  • Q Offline
    Q Offline
    Qt-User0307
    wrote on last edited by
    #1

    Hello, I wanted to create a car-racing game, where the player should only be allowed to drive on the road, so I came up with the idea of scanning the beneath QLabel for a certain color.
    I searched up in the internet and found no solution, I also looked at every QLabel functions but i cant find such a function.
    So I am asking, is it possible to do this or should I try finding another solution?

    Also the Car is another QLabel which moves on the road-QLabel (the road is almost like a background).

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

      What does 'color of a QLabel' means - the background color? The text color, the frame color?

      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
      • Q Offline
        Q Offline
        Qt-User0307
        wrote on last edited by
        #3

        I assigned a Pixmap to the Label and i want to check certain pixels for a certain color.

        Christian EhrlicherC JustSoleSoleJ 2 Replies Last reply
        0
        • Q Qt-User0307

          I assigned a Pixmap to the Label and i want to check certain pixels for a certain color.

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Then get the pixmap from the label and check it's pixels.

          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
          • Q Qt-User0307

            Hello, I wanted to create a car-racing game, where the player should only be allowed to drive on the road, so I came up with the idea of scanning the beneath QLabel for a certain color.
            I searched up in the internet and found no solution, I also looked at every QLabel functions but i cant find such a function.
            So I am asking, is it possible to do this or should I try finding another solution?

            Also the Car is another QLabel which moves on the road-QLabel (the road is almost like a background).

            JonBJ Online
            JonBJ Online
            JonB
            wrote on last edited by
            #5

            @Qt-User0307
            A QLabel is a QWidget. Widget applications are usually oriented towards applications which present text and input boxes to a user. Although you can put a pixmap in a label, for a "car-racing game" it would not be an obvious choice to me. Depending on your intentions, you might want to consider Qt's Graphics View Framework instead.

            1 Reply Last reply
            1
            • Q Qt-User0307

              I assigned a Pixmap to the Label and i want to check certain pixels for a certain color.

              JustSoleSoleJ Offline
              JustSoleSoleJ Offline
              JustSoleSole
              wrote on last edited by
              #6

              @Qt-User0307 How do you get this PIXMAP?Where does this PIXMAP`s source data come from and what kind of data is it?

              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