Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to make a custom QWidget partially transparent?
QtWS25 Last Chance

How to make a custom QWidget partially transparent?

Scheduled Pinned Locked Moved Unsolved General and Desktop
qwidgettransparentcustom qwidget
4 Posts 3 Posters 1.0k Views
  • 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
    Adit
    wrote on last edited by Adit
    #1

    Hi ,I have a custom Qwidget.If its (X-coordinate + Width ) value is greater than a particular value;say Z,then I want the QWidget to be visible till the coordinate Z and invisible or transparent after Z.Does Qt provide any attribute specifically ? Could someone give me a hint of how it can be approached.

    raven-worxR 1 Reply Last reply
    0
    • A Adit

      Hi ,I have a custom Qwidget.If its (X-coordinate + Width ) value is greater than a particular value;say Z,then I want the QWidget to be visible till the coordinate Z and invisible or transparent after Z.Does Qt provide any attribute specifically ? Could someone give me a hint of how it can be approached.

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @Adit
      Is this widget inside a window/layout or is it a top-level widget?
      The shape needs to be rectangular or an arbitrary shape?

      see QWidget::setMask()

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

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

        Thanks for the reply raven.The structure is

        Window
        |-> GroupBox->QLabel->CustomQWidget

        So , I have simulated like as if my CustomQWidget is inside the QLabel Box.When I give some input which is greater than my
        CustomQWidget's X() + CustomQWidget's Width() , I want to make the rest of the CustomQWidget transparent and irresponsive.

        1 Reply Last reply
        0
        • mrjjM Offline
          mrjjM Offline
          mrjj
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Hi
          Does the custom CustomQWidget do its own drawing with QPainter ?

          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