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. QQuickItem::clipRect clips QSGNode in QQuickItem::updatePaintNode()
Forum Updated to NodeBB v4.3 + New Features

QQuickItem::clipRect clips QSGNode in QQuickItem::updatePaintNode()

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
5 Posts 2 Posters 432 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.
  • P Offline
    P Offline
    posix
    wrote on last edited by
    #1

    I made a QML component based on QQuickItem. I redefined the QQuickItem::clipRect() method in it in order to clip nested components (childrens) along a certain border, which is smaller than the size of the component itself. In the QQuickItem::updatePaintNode() method I paint a custom QSGNode based on QSGGeometryNode/QSGGeometry/QSGFlatColorMaterial. The problem is that when I need the geometry in QQuickItem::clipRect() and clip: true on the component, the rendered QSGNode is clipped along the boundary specified in QQuickItem::clipRect(). What needs to be done to get the QSGNode to be drawn outside of QQuickItem::clipRect()?

    sierdzioS 1 Reply Last reply
    0
    • P posix

      I made a QML component based on QQuickItem. I redefined the QQuickItem::clipRect() method in it in order to clip nested components (childrens) along a certain border, which is smaller than the size of the component itself. In the QQuickItem::updatePaintNode() method I paint a custom QSGNode based on QSGGeometryNode/QSGGeometry/QSGFlatColorMaterial. The problem is that when I need the geometry in QQuickItem::clipRect() and clip: true on the component, the rendered QSGNode is clipped along the boundary specified in QQuickItem::clipRect(). What needs to be done to get the QSGNode to be drawn outside of QQuickItem::clipRect()?

      sierdzioS Offline
      sierdzioS Offline
      sierdzio
      Moderators
      wrote on last edited by
      #2

      @posix said in QQuickItem::clipRect clips QSGNode in QQuickItem::updatePaintNode():

      What needs to be done to get the QSGNode to be drawn outside of QQuickItem::clipRect()?

      clip: false

      (Z(:^

      P 1 Reply Last reply
      0
      • sierdzioS sierdzio

        @posix said in QQuickItem::clipRect clips QSGNode in QQuickItem::updatePaintNode():

        What needs to be done to get the QSGNode to be drawn outside of QQuickItem::clipRect()?

        clip: false

        P Offline
        P Offline
        posix
        wrote on last edited by
        #3

        @sierdzio I need to draw a border and cut off the center, something like this:

        +---------------+ QSGNode drawed border
        | +-----------+ |
        | |  Clipped  | |
        | | childs at | |
        | |  center   | |
        | |           | |
        | +-----------+ |
        +---------------+
        

        Is this impossible to do?

        sierdzioS 1 Reply Last reply
        0
        • P posix

          @sierdzio I need to draw a border and cut off the center, something like this:

          +---------------+ QSGNode drawed border
          | +-----------+ |
          | |  Clipped  | |
          | | childs at | |
          | |  center   | |
          | |           | |
          | +-----------+ |
          +---------------+
          

          Is this impossible to do?

          sierdzioS Offline
          sierdzioS Offline
          sierdzio
          Moderators
          wrote on last edited by
          #4

          @posix definitely possible but I don't know how without some research. The only idea that comes to my head is to use 2 items for this.

          (Z(:^

          P 1 Reply Last reply
          0
          • sierdzioS sierdzio

            @posix definitely possible but I don't know how without some research. The only idea that comes to my head is to use 2 items for this.

            P Offline
            P Offline
            posix
            wrote on last edited by
            #5

            @sierdzio yes, I also thought that it would be possible to do this in QML using nested components, but I need to do it in C++.

            The problem is that QSGNode, when clip: true, calculates its outer bounds from QQuickItem::clipRect(), and not from QQuickItem::boundingRect(). If there was a way to change this, the problem would be solved.

            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