Force widget painting on contentsRect instead of rect - windows

I'm setting contentsMargins for widget and want widget to be painted on contentsRect() instead of rect(). I can do so at paintEvent by setting viewPort and clipRegion, but I don't want to implement paintEvent for every type of widget.
Is it possible to force widget painting on contentsRect instead of rect?
I'm writing analog of mimic creator and want to draw border over each visual component. Just like it's done in Qt creator - when I pick widget at design window, there is a border with resizing points over each widget and I want such border.

Solved. I just created sibling border class for each visual component, implemented moved and resized slots for it so that border resized along with widget, and called stackUnder for each widget so that border painted over each widget. Thanks for collaboration.

Related

UWP - Custom non-rectangular hit area on button. Either image or shape

I would like to define a non-rectangular clickable "hit area" for a button. I am happy to define this custom shape using a UWP XAML path, or by using a PNG with transparent areas.
The following question explains how to use an XAML path for a button's appearance, but the result still seems to use a rectangular bounding box hit area. XAML UWP Button with a polygonal shape
There are also posts explaining how to override the Image class, intercepting the 'click' event, and determining the opacity of the pixels under the mouse cursor. This would solve my problem, but this solution only applies to WPF.
Does anyone know of a solution for UWP?
It looks like I can just use the raw < path > element, and use its pointer events directly.

Draw red rectangle around entire screen on mac

Is there a way to draw a red "border" around the entire screen somehow? I don't want to draw inside my application's window. And I want to be able to use other programs while this red border is shown.
I want to really signal to the user that the computer is in a special mode.
Windows need not be opaque and can be set to ignore mouse events, using this it is quite easy to do what you wish. In outline:
a) Create a NSView subclass with a drawRect: method which draws a semi-transparent (< 1 alpha value) red border inside its frame.
b) Create an NSWindow subclass. Use NSBorderlessWindowMask as the style. Set backgroundColor to clearColor, opaque to NO, level to something that suits you - say NSScreenSaverWindowLevel, ignoreMouseEvents to YES, canHide to NO, etc. Set the window size/location to (one of your) screen(s). Set its contentView to your view from (a).
You now have a "window" which is a just a outlined semi-transparent red rectangle, create one and your screen is outlined as you wish.

Make portion of OpenGL rendering transparent when using Qt's widget

I have just started to learn OpenGl. I am using OpenGL to paint onto a Qt Widget. I cannot use QGLWidget because there is a lot of old code that I cannot modify.
I have root widget to which I add two child widgets. One is the widget to which I render directly using OpenGL. The other is a QWebview that shows a simple web page. I have resized the webview such that it is positioned in the center(and below) of the openGL widget. Now, I have added a stencil to the OpenGL rendering to allow a triangle portion to remain vacant. The webview widget sits right below this portion. However, I am unable to make the stenciled area transparent to allow the webview to be visible. It just remains black. See picture.
Is it even possible to make an area of this widget transparent? If yes, how do I go about doing this?

changing the color of the button in selectfield/datepicker/timepicker in Sencha

Is it possible to change the color of the button (the little triangle button) shown in the right side of selectfield/datepicker/timepicker?
those little triangles are constructed using images as background so you need to change those images to change color of those triangles
for datepicker image is "resources/themes/images/default/form/date-trigger.gif" in css class .x-form-date-trigger
for timepicker/selectfield image is "resources/themes/images/default/form/trigger.gif" in css class .x-form-trigger

How to draw PNG over dialog controls

I need to make some thing like a SEMI-transparent glass layer over dialog's controls. The context is when my application wait for a long process to finish all other controls need to be disabled, and an animation is shown on glass layer as waiting-animation.
I am going to draw a semi-transparent PNG image with size of client area, overlapping all other controls. I do the drawing in OnPaint() but image is drawn as background of the dialog.
So my question is how can i draw png image overlap dialog's control??
LRs
You can try with fiddling the WS_CLIPCHILDREN and WS_CLIPSIBLINGS styles, but I'm not sure that will work. I think you will need to draw a custom control on top of all other controls (at the top of the z-order stack) and draw your bitmap on that one (that's the approach I would take - the dialog is supposed to be behind the controls always, so your approach of drawing on the dialog is fighting the system, as it were).
So basically you would draw on the custom control that would cover all other controls, but you don't even need to draw it transparently; you can use the WS_EX_TRANSPARENT and/or WS_EX_LAYERED window style and SetLayeredWindowAttributes() method, as long as you don't need to support operating systems older than win2k.

Resources