Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Create a custom QBrush object from qml for custom chart
Forum Updated to NodeBB v4.3 + New Features

Create a custom QBrush object from qml for custom chart

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
2 Posts 2 Posters 546 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.
  • J Offline
    J Offline
    Joao Goncalves
    wrote on last edited by
    #1

    Hello, I'm currently designing a GUI with QML.
    I'm using ChartView to draw a chart and I want to customize its colors.

    I could change every color except the axis title, that needs the replace of a Brush and I can't create one.

    ValueAxis {               
        id: temp_y_axis       
        min: 0                
        max: 30               
        tickCount: 5          
        gridVisible: false    
        color: "white"        
                              
        titleText: "Temp (ºC)"
        titleBrush:             /* wanted something like QBrush(Qt.white) here */
                              
        labelFormat: "%d"     
        labelsFont.bold: true 
        labelsColor: "white"  
    }                         
    

    I spent the whole day searching for ways to customize this, can anyone help me?

    Thanks in advance

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tomoree
      wrote on last edited by tomoree
      #2

      Although this topic is too old , i will still mention that it's not possible to do this. Since QBrush may be not a subclass of qtobject. I would say that because i try to use qmlRegisterType() to register QBrush to qml engine. But when i create a instance i will get error below

      C:\Qt\5.15.2\mingw81_64\include\QtQml\qqmlprivate.h:71: error: 'staticMetaObject' is not a member of 'QBrush'
      

      You can modify the source code of chartview by adding color or other properties you need...

      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