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. QtCharts Does not support Alpha?
Forum Updated to NodeBB v4.3 + New Features

QtCharts Does not support Alpha?

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 500 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.
  • A Offline
    A Offline
    antiocles
    wrote on last edited by
    #1

    Does the chart module not support use of alpha in color definitions?

    I was attempting to remove the border of a pie slice. Setting border to 0 does not do it. Nor does setting the border color to transparent. I then discovered that any color definitions seem to just silently ignore alpha channel. I even went so far as to link into some C++ code to manually control the brushes/pens/colors without going through QML and that does not work either.

    I suspected the more limited openGL might be the issue, but pie would not be supported by that. I tried other series types (line, bar, etc) and all behave the same.

    Thoughts?

    1 Reply Last reply
    0
    • fcarneyF Offline
      fcarneyF Offline
      fcarney
      wrote on last edited by
      #2

      Can you make a minimal qml app that reproduces the problem with nothing else in that app? Then share your code so we have something to look at?

      C++ is a perfectly valid school of magic.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        antiocles
        wrote on last edited by
        #3

        Hello,

        As I made my minimal application, I discovered that it does work with alpha in colors as expected BUT turning on animations causes it to ignore the alpha channel for the animated items...

        I opened the qmlchart example, and modify View1.qml:

        /****************************************************************************
        **
        ** Copyright (C) 2016 The Qt Company Ltd.
        ** Contact: https://www.qt.io/licensing/
        **
        ** This file is part of the Qt Charts module of the Qt Toolkit.
        **
        ** $QT_BEGIN_LICENSE:GPL$
        ** Commercial License Usage
        ** Licensees holding valid commercial Qt licenses may use this file in
        ** accordance with the commercial license agreement provided with the
        ** Software or, alternatively, in accordance with the terms contained in
        ** a written agreement between you and The Qt Company. For licensing terms
        ** and conditions see https://www.qt.io/terms-conditions. For further
        ** information use the contact form at https://www.qt.io/contact-us.
        **
        ** GNU General Public License Usage
        ** Alternatively, this file may be used under the terms of the GNU
        ** General Public License version 3 or (at your option) any later version
        ** approved by the KDE Free Qt Foundation. The licenses are as published by
        ** the Free Software Foundation and appearing in the file LICENSE.GPL3
        ** included in the packaging of this file. Please review the following
        ** information to ensure the GNU General Public License requirements will
        ** be met: https://www.gnu.org/licenses/gpl-3.0.html.
        **
        ** $QT_END_LICENSE$
        **
        ****************************************************************************/
        
        //![2]
        import QtQuick 2.0
        //![2]
        import QtCharts 2.0
        
        Item {
            anchors.fill: parent
            property variant othersSlice: 0
        
            //Just to give a background to see transparency easier...
            Image {
                id: image
                anchors.fill: parent
                source: "http://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png"
                fillMode: Image.Stretch
                opacity: 0.3
            }
        
            //![1]
            ChartView {
                id: chart
                title: "Top-5 car brand shares in Finland"
                anchors.fill: parent
                legend.alignment: Qt.AlignBottom
                antialiasing: true
                backgroundColor: "#0100FF00"
                animationOptions: ChartView.AllAnimations //<--kills alpha channel if have animations on
        
                PieSeries {
                    id: pieSeries
                    holeSize: .3
                    PieSlice { label: "Volkswagen"; value: 25; color: "#50FF0000" }
                    PieSlice { label: "Toyota"; value: 10.9;  color: "#3000FF00"}
                    PieSlice { label: "Ford"; value: 8.6; color: "#800000FF" }
                    PieSlice { label: "Skoda"; value: 8.2 }
                    PieSlice { label: "Volvo"; value: 6.8 }
                }
            }
        
            Component.onCompleted: {
                // You can also manipulate slices dynamically, like append a slice or set a slice exploded
                othersSlice = pieSeries.append("Others", 52.0);
                pieSeries.find("Volkswagen").exploded = true;
            }
            //![1]
        }
        
        

        And then the alpha is being ignored. I know working with transparency will be a bit more costly, but I definitely did not anticipate total disabling. Is this intended? Or a bug I should be reporting?

        This is on qt 5.14.2, mac, but seems to do the same other places i have looked at (not 5.15 yet...)

        1 Reply Last reply
        1
        • fcarneyF Offline
          fcarneyF Offline
          fcarney
          wrote on last edited by
          #4

          I played with this a bit. It looks like once animations are enabled you lose transparency. I don't see anything in the docs about this either. So either it is an optimization or a bug. Since you have a simple reproducible example I would submit a bug.

          C++ is a perfectly valid school of magic.

          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