Unsolved Frameless but resizable QMainwindow
-
Hi All,
A quick question about pyqt5.9.
Is there any way to create a frameless QMainwindow with resizable functionality on Windows environment?Many thanks in advance.
Sat -
Yes, but you have to implement the resizing capability yourself (probably by reimplementing some mouse events).
-
@sierdzio thank you very much for an update!
Do you know if there’s any sample code to share?Sat
-
@ShinSat said in Frameless but resizable QMainwindow:
Do you know if there’s any sample code to share?
Nope, sorry.
-
@ShinSat
Have a look at https://stackoverflow.com/a/11783130/489865 ?Although it is resizing a widget, does the code show you the events for resizing the main window itself instead?
-
@JNBarchan Thanks for your help.
What if I want to move the widget with resizing capability in mouseMoveEvent?Sat
-
@ShinSat said in Frameless but resizable QMainwindow:
What if I want to move the widget with resizing capability in mouseMoveEvent?
I'd suggest this:
- on mouse press, save the information about where the press originated (left, right, bottom, top margin of the window, or maybe the centre?)
- on mouse move, either resize or move the window based on the point of origin and move delta
-
@sierdzio Thanks for your help, I just completed a prototype version. I'll continue to brush up this.
Thanks again for your support!Sat
-
@ShinSat Sorry, again.
Is there a way to handle the mouse cursor shape with resizing function when the mouse cursor is on the widget's edge?
I'm trying to implement resize function where the cursor shape changes on QMainWindow's edge(eg. SplitHCursor).
It works but not 100%. I found mouseMoveEvent is not fired when its on some widgets inheriting scrollarea such as QPlainText. Without receiving mouseMoveEvent, I can't control the cursor shape on QPlainText, for example.
I know creating a subclass from QPlainText works but this is not an option as every child can be anonymous. I want to package every basic behavior in one basic custom class.Any ideas?
Sat