Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Qt 6
  4. Generating random Color as RGB value.
Forum Updated to NodeBB v4.3 + New Features

Generating random Color as RGB value.

Scheduled Pinned Locked Moved Unsolved Qt 6
2 Posts 2 Posters 1.6k 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.
  • eefesafakE Offline
    eefesafakE Offline
    eefesafak
    wrote on last edited by
    #1

    How can I generate random color as RGB value in a QThread. Also, this value will be assigned into next pixel. This QImage object will go to the interface with a signal from the thread.
    My goal is to obtain an image of 300x300 pixels, each pixel of which consists of random RGB values.

    jsulmJ 1 Reply Last reply
    0
    • eefesafakE eefesafak

      How can I generate random color as RGB value in a QThread. Also, this value will be assigned into next pixel. This QImage object will go to the interface with a signal from the thread.
      My goal is to obtain an image of 300x300 pixels, each pixel of which consists of random RGB values.

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

      @eefesafak said in Generating random Color as RGB value.:

      How can I generate random color as RGB value in a QThread

      In a RGB image each pixel consists of 3 numbers, so simply generate 3 random numbers and construct a pixel from those 3 numbers.
      https://doc.qt.io/qt-5/qrandomgenerator.html
      https://doc.qt.io/qt-5/qimage.html#setPixel-1

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

      1 Reply Last reply
      4

      • Login

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