Qt widget blurred semitransparent background on Linux - c++

Working with widgets, c++ and Linux
need something kind of:
this
but no borders and custom title.
Search for a few days, but nothing.
For now, there is a widget with setWindowFlags(Qt::FramelessWindowHint); and a peace of qss for semitransparent background. How can I blur it? Is is possible at all?

I do not think this can be done with Qt. Blurring can be done using https://doc.qt.io/qt-5/qgraphicsblureffect.html but it is only limited to the widgets painted by Qt. Which the underlying background is not, even if you manage to make your widgets transparent or semitransparent. Painting the background is always the business of the operating system (or window manager) and not the business of your application Qt.
You can certainly try to do some extreme hacking like grabbing the active screen before your window is displayed (see How to capture the current screen image using Qt?) then getting certain rectangle content of the image, which corresponds to the background of your window, then paint it blurred to the background of your application and then update it everytime you move or resize your window... But anyway, even if you manage this, this background will be static and not dynamic.
I recommend that you abandon the idea of blurry background and leave this function to the window manager and the operating system.

Related

Qt window layout spans beyond window borders when QOpenGLWidget is present

There is a Qt window, which hosts many widgets, among them is one QOpenGLWidget widget to plot waveform. This works well on almost all machines, but there is one strange case with a machine having an Intel OpenGL graphics version 3.3.0 - Build 21.20.164678.
This is the good behavior on almost all machines:
And this is the strange case, wherein title text goes beyond top border of the window, and to click a button, we have to offset mouse pointer above the rendered position of that button. Text is also a little bit blurry. This problem does not happen if I replace the OpenGL widget with another non-OpenGL widget:
Any suggestions to fix the issue?

How to create a borderless window with titlebar in windows c++

I am trying to create a Direct3D app that is operating in windowed mode with a title bar and minimize/quit button. However, I'd really like to be able to axe the border around the window.
I am looking to do this because it looks pretty cheesy on dual monitors when the app is filling the primary monitor horizontally (with room to move the app vertically), but its window border overflows onto the secondary screen. I've tried a bunch of combinations of setwindowlong with GWL_STYLE and GWL_EXSTYLE, but can't seem to make headway unless I disable the title bar.
I've seen a bunch of apps that are borderless however they seem to emulate the title bar rather than using the built in one provided by Microsoft.
Thanks for any suggestions.
You can't remove the border and keep the titlebar AFAIK.
You can reimplement the titlebar by using WM_NCHITTEST but you still need to draw it yourself which would not be a bad idea if you want your D3D app to look its best.
Visual Studio, last time I checked, achieves its border with transparent layered windows standing behind the primary one. They are the shadows you see.

Drawing a wxBitmapButton over a wxStaticBitmap

I create the bitmap first, and then the button and call button->Raise().
The button doesn't show up until I hover over it, and even though I'm supplying it with a transparent png as an image, the transparency is screwed up as can be seen here:
As Raise() documentation says, this function only works for the top level windows. Overlapping child windows are not supported by wxWidgets and won't work correctly under all platforms.
The closest you can do to what you want is to use a custom background on your parent window, which will, indeed, show behind your bitmap button.

Black highlight bar with GDI

I got some nice splitter code for my GUI but I can't get the pen/brush/whatever it is I need to do proper highlighting. You know how in visual studio 10, the splitter bars can be dragged and there's a beautiful black transparent bar letting you know where the split will happen when you lift up your mouse button. Here's a picture: http://www.freeimgshost.com/fullsize/efmcxyyu1wbyb1r7mz0.png
How can I achieve that black highlight bar using solely GDI and c++?
The Visual Studio UI is implemented in WPF, so I'd guess that the splitter bar is just a semi-transparent filled rectangle.
However, GDI has fairly poor support for transparency.
You could get the same effect using a semi-transparent, always-on-top, layered window. This is a simple solution because you don't have to worry about repainting anything. You just move the window about.
This answer to another question has some code that creates such a window (for a different purpose).
This is probably one of the correct uses for LockWindowUpdate().
On Mousedown, lock the window, and start drawing the drag bar directly. As the mouse is still captured, the drag bar will still receive mouse notification. On mouseup, unlock the window, resize and let the drawing carry on as normal.

Windows regions and transparency

I have a CDHTMLDialog in a BHO that I want to be partially transparent, in the sense that the transparent area changes according to the logic of the dialog. I got it to become transparent visually (using SetLayeredWindowAttributes), but it is critical to make this region truly transparent, because otherwise when I click on the transparent region my clicks do not reach the IE window which is below the transparent part of my dialog. I temporarily fix this by constantly resizing my dialog according to the size of the active part of the dialog, but I can't keep up with this forever...
I think the solution has something to do with what windows calls "regions" (http://msdn.microsoft.com/en-us/library/dd162915%28VS.85%29.aspx) but I'm not exactly sure how to work with them. Can anyone point me in the right direction?
I don't think you want to make parts of your window transparent, what you want to do is (I think) set the window region (like you mention). Read the MSDN on SetWindowRgn() - basically you define a GDI object of type HRGN (if you're using MFC, CRgn) which described a surface of a certain shape, and eventually with parts cut out. Windows then considers only the 'region' that you set on a window as the part of the window to use. Basically it's how you make non-rectangular windows. A 'region' isn't a 'transparent' part of a window, it's a way to discard areas of a window, in a way.
I found the way to make an entire window transparent and click-through here:
http://www.codeproject.com/KB/wtl/transparent.aspx
But it's not useful for my case where I only want the transparent part of my window (transparent by HTML/CSS definitions) to be click-through...
Update: Apparently, the clicks are supposed to go through the transparent parts (see http://jalaj.net/2007/02/05/form-with-a-hole/), but in my CDHTMLDialog they don't. My best guess is that a sub-window of the BHO catches my clicks, but I don't really think that makes much sense...