Learn what Felgo offers to help your business succeed. Start your free evaluation today! Felgo for Your Business


OverviewFelgo 3 Support (Qt 5) › Clipping issue on an Android device


Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
  • #8440


    Hey, I ran into an issue on a certain Android device, where clipping of items do not work under certain conditions. I’ve got an android tablet, where the following code only clips on Rotation angles 0 degrees, 90 degrees, 180 degrees & 270 degrees. Other platforms work fine and also another android device works fine. Seems to be a Qt bug, as it also happens in a standard Qt app. Here’s the code:

    		Rectangle {
    			id: clipTurn
    			anchors.centerIn: parent
    			width: 20
    			height: 100
    			clip: true
    			property real angle: 0
    				repeat: true
    				interval: 400
    			Rectangle {
    				anchors.horizontalCenter: parent.horizontalCenter
    				width: 10
    				height: 130
    				color: "yellow"
    			transform: Rotation { origin.x: clipTurn.width/2; origin.y: clipTurn.width/2; angle: clipTurn.angle}

    Does anyone at least have a workaround for that?



    An educated guess would be, that some conversion from polar- to carthesian coordinate system goes wrong…

    Btw: The affected device is a Motorola Xoom with Android 4.0.4 installed



    Ok, seems like I’ve found the reason for my issue:


    Let me cite the description for clipping: “If the item is rotated by a non-90-degree angle, the OpenGL’s stencil buffer is used.

    In my ouptut from the Android device I can see the following:

    W/Qt ( 1125): scenegraph/qsgcontext.cpp:434 (virtual void QSGRenderContext::initialize(QOpenGLContext*)): QSGContext::initialize: stencil buffer support missing, expect rendering errors

    So thats the root cause; but does anyone know what to do? I really need that feature šŸ™




    Felgo Team


    a workaround would be to use an Image for clipping and use an OpacityMask component, like we did for clipping the contents of a Facebook Profile image. You can see a source codes example in this related forum thread. You could also ask in the Qt Project support forums if others have another workaround for the stencil buffer issue.

    Cheers, Chris



    Good point, thanks.

    I got it to work in a different way. I was able to separate my sprite into a stretchableĀ and a non stretchableĀ part. That way I don’t need clipping, which seems to be beneficial in regards of UI performance.


    Felgo Team

    Yes absolutely, clipping has a performance penalty so any approach that prevents it at all is a good one. šŸ™‚

    Can you maybe share the piece of code you used for splitting the sprite, as it may be interesting for other developers too?

    Cheers, Chris

Viewing 6 posts - 1 through 6 (of 6 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Qt_Technology_Partner_RGB_475 Qt_Service_Partner_RGB_475_padded