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. Display of QML image ignoring pixel alpha
Forum Updated to NodeBB v4.3 + New Features

Display of QML image ignoring pixel alpha

Scheduled Pinned Locked Moved QML and Qt Quick
image displayalpha
2 Posts 1 Posters 2.0k 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.
  • B Offline
    B Offline
    bradg
    wrote on 15 Sept 2015, 23:10 last edited by
    #1

    Hi. Fairly new to QT, but I've noticed that when I display an image where the source is a png file, the alpha for each pixel is ignored. Just where is displayed.

    From c++, I'm using QQuickView to load the source and display.

    Is there a setting somewhere to make this work?

    	Image
    	{
    		source: "image.png"
    	}
    
    1 Reply Last reply
    0
    • B Offline
      B Offline
      bradg
      wrote on 16 Sept 2015, 14:31 last edited by
      #2

      I've figured this out. The problem wasn't in fact due to image files pixel alpha. That works just fine. It had to do with the QQuickView not being transparent. What I am doing is displaying a QQuickView as a borderless window to be used as a popup dialog and I want to see through to the background, where there are no objects in the qml file. (Think of a pop up dialog with rounded corners).

      Here's what I'm doing:

      	QQuickView view;
      
      	// don't display an icon in the task bar
      	// no border on the window
          view.setFlags(Qt::SubWindow | Qt::FramelessWindowHint);
      	
      	// make the view transparent so that the edges of the window,
      	// where there is no image, show through to the background
          QSurfaceFormat surfaceFormat;
          surfaceFormat.setAlphaBufferSize(8);
      
          view.setFormat(surfaceFormat);
          view.setClearBeforeRendering(true);
          view.setColor(QColor(Qt::transparent));
      
      	// load qml file and display
      	view.setSource(file.qml);
      	view.show();
      
      1 Reply Last reply
      0

      2/2

      16 Sept 2015, 14:31

      • Login

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