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. How to create meshGradient (2-dimensional gradient)?

How to create meshGradient (2-dimensional gradient)?

Scheduled Pinned Locked Moved Unsolved General and Desktop
gradientqt5backgroundscene
1 Posts 1 Posters 1.1k 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.
  • F Offline
    F Offline
    flart
    wrote on last edited by flart
    #1

    Some linearGradient code (1-dim) , but meshes (2-dim, example below) are needed.

        QLinearGradient linearGrad(screen.topLeft(), screen.bottomRight());
     
        QColor c1 = QColor::fromHsvF(0.3, 1, 0.3);
        QColor c2 = QColor::fromHsvF(0.4, 1, 0.5);
        QColor c3 = QColor::fromHsvF(0.5, 1, 0.3);
    
        linearGrad.setColorAt(0.1, c1);
        linearGrad.setColorAt(0.5, c2);
        linearGrad.setColorAt(0.9, c3);
    
        myscene->setBackgroundBrush(QBrush(linearGrad));
    

    mesh examples:

    image1

    image2

    How to create mesh-gradient-background for scene?

    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