Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    Update: Forum Guidelines & Code of Conduct


    Qt World Summit: Early-Bird Tickets

    [SOLVED] Color Gradient for QBrush customization (Qwt Plot Background)

    General and Desktop
    2
    3
    3602
    Loading More Posts
    • 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.
    • V
      vezprog last edited by

      So what I am trying to accomplish right now is making a Color Gradient for a QwtPlot canvas background color through code because the colors are going to change dynamically.

      So for example: The plot scale for the x axis goes from 0 - 2000
      red background from 0 - 500
      yellow background from 501 - 750
      green background from 750 - 1250
      yellow background from 751 - 1500
      red background from 1501 - 2000

      The only way I can think of doing this would be to use a custom QBush using a gradient that does the above. I would like to be able to set the limits of each color though... I looked at the spectrogram example and found some cool color meshing techniques but unfortunately they are unavailable using a straight QwtPlot.

      i.e. function
      setCanvasBackground(const QBrush &);

      Any ideas?

      1 Reply Last reply Reply Quote 0
      • M
        mlong last edited by

        Have you looked at "QLinearGradient?":http://qt-project.org/doc/qt-4.8/qlineargradient.html

        Software Engineer
        My views and opinions do not necessarily reflect those of anyone -- living or dead, real or fictional -- in this universe or any other similar multiverse node. Void where prohibited. Your mileage may vary. Caveat emptor.

        1 Reply Last reply Reply Quote 0
        • V
          vezprog last edited by

          exactly what i was looking for, even lets you do multiple colors! and unfortunately google was of no help with pointing me to this gold mine.

          Thanks!

          1 Reply Last reply Reply Quote 0
          • First post
            Last post