Bug report #17845

Setting Raster Transparency using "Add values from display" doesn't work

Added by Michel Stuyts almost 7 years ago. Updated almost 7 years ago.

Status:Closed
Priority:High
Assignee:Alessandro Pasotti
Category:Rasters
Affected QGIS version:master Regression?:Yes
Operating System:Windows 10 & Ubuntu Linux 16.04 LTS Easy fix?:No
Pull Request or Patch supplied:Yes Resolution:fixed/implemented
Crashes QGIS or corrupts data:Yes Copied to github as #:25740

Description

If I try to set the Transparent Pixels using "Add values from display" it gives no result. If I close the Layer Properties window after using "Add values from display" using OK or Cancel, QGIS becomes unresponsive on Windows and closes without a warning on Ubuntu.

Also the Layer Properties window remains minimized after clicking in the map window when trying to use "Add values from display".

Associated revisions

Revision 75e613c3
Added by Alessandro Pasotti almost 7 years ago

[bugfix] Transfer focus to canvas when selecting transparency

This is an attempt to fix #17845 Setting Raster Transparency
using "Add values from display" doesn't work

Fixes #17845

Revision e435d79d
Added by Alessandro Pasotti almost 7 years ago

Fixes #17845 tested on Linux KDE and Win 10

History

#1 Updated by Alessandro Pasotti almost 7 years ago

  • Status changed from Open to Feedback

Can you please add step-by-step procedure to reproduce the issue and if possible a minimal project with a small dataset?

#2 Updated by Michel Stuyts almost 7 years ago

I tested it with multiple raster-files (TIF and PNG). One of those files can be downloaded from: https://downloadagiv.blob.core.windows.net/winterbedkaart/Winterbedkaart+(Watertoets).zip

  1. Start a new project in QGIS 2.99
  2. Add the downloaded tiff-file (Wtrbed.tif)
  3. Open the layer Properties Window
  4. Go to the "Transparency" tab
  5. Click on the "add values from display" button (now the Properties Window remains the same size on Ubuntu Linux and minimizes on Windows)
  6. Click somewhere on the white (or another color) part in the Map Window (now the Properties Window remains minimized on Windows)
  7. On Windows double click on the minimized topbar of the Properties Window on the bottom left of the screen to maximize it. (now no color values are added to the "Transparent pixel list" on both Windows and Ubuntu Linux)
  8. Click on the OK or Cancel button
After these steps the effect is different on Windows and Ubuntu Linux:
  • On an Windows 10 machine: the Properties window closes, but clicking anywhere in the main window has no effect. QGIS can only be closed by using Windows Task Manager and killing the process
  • On an Ubuntu Linux machine: QGIS closes without a warning.

#3 Updated by Michel Stuyts almost 7 years ago

In the Layer Styling Panel, the "Add values from display" button in the Transparency Tab works as it should.

#4 Updated by Alessandro Pasotti almost 7 years ago

  • Assignee set to Alessandro Pasotti

Thanks for adding the information, looking at this bug now ...

#5 Updated by Alessandro Pasotti almost 7 years ago

  • Priority changed from Normal to High
  • Regression? changed from No to Yes

#6 Updated by Alessandro Pasotti almost 7 years ago

  • Status changed from Feedback to In Progress
  • Pull Request or Patch supplied changed from No to Yes

PR: https://github.com/qgis/QGIS/pull/6068
Tested on xenial, needs to be tested on windows/mac.

#7 Updated by Anonymous almost 7 years ago

  • Status changed from In Progress to Closed
  • % Done changed from 0 to 100

#8 Updated by Michel Stuyts almost 7 years ago

  • Status changed from Closed to Reopened

The main part of this issue (QGIS crashing or blocking) is solved, but a minor part of it still isn't ok. The issue is different on Ubuntu and Windows.

On Ubuntu Linux:
  1. Start a new project in QGIS 2.99
  2. Add the downloaded tiff-file (Wtrbed.tif)
  3. Open the layer Properties Window
  4. Go to the "Transparency" tab
  5. Click on the "add values from display" button
  6. Now the Properties Window disappears (I think it's closed) and the cursor changes to a cross
  7. Now click somewhere in the map and the cursor changes back to an arrow, but after that nothing happens anymore. There is nothing added to the transparent pixel list when the Properties Window is reopened.
On Windows 10:
  1. Start a new project in QGIS 2.99
  2. Add the downloaded tiff-file (Wtrbed.tif)
  3. Open the layer Properties Window
  4. Go to the "Transparency" tab
  5. Click on the "add values from display" button
  6. Now the Properties Window minimizes and the cursor changes to a cross
  7. Now click somewhere in the map and the cursor changes back to an arrow, but the Properties Window remains minimized
  8. Now double click on the minimized title bar of the Properties Window to enlarge it again.
  9. The clicked on color value is added to the transparent pixel list.
  10. The desired color is transparent.
If in Windows steps 3 to 7 are repeated, there are two minimized Properties Windows. By double clicking on their title bars, both can be enlarged and can exist next to each other:
  1. Start a new project in QGIS 2.99
  2. Add the downloaded tiff-file (Wtrbed.tif)
  3. Open the layer Properties Window
  4. Go to the "Transparency" tab
  5. Click on the "add values from display" button
  6. Now the Properties Window minimizes and the cursor changes to a cross
  7. Now click somewhere in the map and the cursor changes back to an arrow, but the Properties Window remains minimized
  8. Open the layer Properties Window
  9. Go to the "Transparency" tab
  10. Click on the "add values from display" button
  11. Now the Properties Window minimizes and the cursor changes to a cross
  12. Now click somewhere in the map and the cursor changes back to an arrow, but the Properties Window remains minimized
  13. Now double click on the first minimized title bar of the Properties Window to enlarge it again.
  14. Now double click on the second minimized title bar of the Properties Window to enlarge it again.
  15. The clicked on color value is added once to each transparent pixel list.
  16. The desired color is transparent.

#9 Updated by Alessandro Pasotti almost 7 years ago

I see: apparently the showMinimized function behaves differently on Linux and Windows (and nobody knows about Mac)

I'm testing (on Linux) and I observe a different behavior on KDE than what you've reported.

Btw, I see a possible solution in completely hiding the dialog instead of trying to minimize it.

I'll make a new PR with this new approach, I'd really appreciate if you could test it when ready.

#10 Updated by Alessandro Pasotti almost 7 years ago

New PR https://github.com/qgis/QGIS/pull/6294

Works fine on Win 10 and Kubuntu Xenial.

#11 Updated by Anonymous almost 7 years ago

  • Status changed from Reopened to Closed

#12 Updated by Alessandro Pasotti almost 7 years ago

  • Resolution set to fixed/implemented

Please test this new patch

#13 Updated by Michel Stuyts almost 7 years ago

Problem solved! It works in Ubuntu 16.04 and Windows 10. Thank you very much.

#14 Updated by Alessandro Pasotti almost 7 years ago

You are welcome! Thank you for the feed-back and thanks to all QGIS sponsors and donors that made this happen!

Also available in: Atom PDF