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. Is there an API in QML similar to setMask() API of Qt?
Forum Updated to NodeBB v4.3 + New Features

Is there an API in QML similar to setMask() API of Qt?

Scheduled Pinned Locked Moved QML and Qt Quick
6 Posts 3 Posters 3.9k 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.
  • A Offline
    A Offline
    at_pradeep
    wrote on last edited by
    #1

    We want to make a particular region of a QML rectangle transparent.

    In case of -QT- Qt, to do the same thing, we have used the setMask API of QWidget.

    Is there any API in QML which does the same.

    What I feel is that we can use the pass the QML rectangle to the -QT- Qt cpp file and use setMask() API on the rectangle, but will this be possible?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      lgeyer
      wrote on last edited by
      #2

      Well, QDeclarativeView is a QWidget after all - so you just might give it a try.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        at_pradeep
        wrote on last edited by
        #3

        QDeclarativeView is derived from QObject and setMask property is of QWidget so we can not use setMask for QDeclarativeView. can any one please suggest some way of masking in QML.

        1 Reply Last reply
        0
        • L Offline
          L Offline
          lgeyer
          wrote on last edited by
          #4

          QDeclarativeView is a QGraphicsView is a QAbstractScrollArea is a QFrame is a QWidget (is a QObject).

          1 Reply Last reply
          0
          • A Offline
            A Offline
            at_pradeep
            wrote on last edited by
            #5

            Oh!!! that's right, so i have to pass the base Rectangle from QML application to QT CPP application and then Type cast it to QWidget and then call setMask on it, is it the right way?

            1 Reply Last reply
            0
            • J Offline
              J Offline
              Jens
              wrote on last edited by
              #6

              It is worth pointing out that meego has this feature built in:

              http://harmattan-dev.nokia.com/docs/library/html/qt-components/qt-components-meego-maskeditem.html

              And even if you are on a different platform, you can just grab the source code from here:
              http://qt.gitorious.org/qt-components/qt-components/blobs/master/src/meego/mdeclarativemaskeditem.h (.cpp)

              In Qt Quick 2, you could use a shader to achieve the same thing.

              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