The QGIS raster calculator seems limited, but you can achieve a lot once you know a couple of tricks
These hold true for both SAGA and QGIS raster calculators
true = 1
false = 0
You can use addition to simulate boolean logic
X or Y : x+y > 0
X and y : x+y = 2
I've modified Joseph's answer to use these, and get around the lack of boolean logic in SAGA's grid calculator
This i've tested, the example below shows my two images. The first is a land cover classification, the second is a gradient based on latitude (generated in saga using
ypos()). The final image, I've taken two of the classified values and replaced them with the gradient value.
Be careful doing this in SAGA itself, it's all to easy to overwrite
your original raster. Probably safer to call from Processing, as Joseph suggested.
In QGIS the same would be as follows. I've assumed your rasters are a (first) and b (second), and you're only using band1 (
"a@1" + ((((("a@1"=30)+("a@1"=34) >=1) + ("b@1">0)) =2) *("b@1"-"a@1"))
Just realised I'm copying over all data pixels from the second image, including zeros. This slightly more complex expression should do the job...