First decision
You can add the following flag to the flags of your window so that the user does not resize the window:
setWindowFlags(this->windowFlags() |= Qt::FramelessWindowHint);
Here is more information about Flags windows .
The second (ugly) experiment solution
This is a kind of dirty work ... I am fully aware of the fact that it is not clean.
I just wrote this small main window, which changes the cursor manually when the main window area remains.
Note. You should consider side effects. The child widget may need a different cursor shape, but this overrides the cursor for the entire application.
This can be used as a starting point for further development and for simple applications.
Title:
class CMainWindow : public QMainWindow { public: CMainWindow(QWidget* parent = nullptr); virtual ~CMainWindow(void); protected: virtual void leaveEvent( QEvent *event ); virtual void enterEvent( QEvent *event ); };
castes:
CMainWindow::CMainWindow(QWidget* parent) : QMainWindow(parent) { setMouseTracking(true); } CMainWindow::~CMainWindow(void) { } void CMainWindow::leaveEvent( QEvent *event ) { qApp->setOverrideCursor(QCursor(Qt::ArrowCursor)); QMainWindow::leaveEvent(event); } void CMainWindow::enterEvent( QEvent *event ) { qApp->restoreOverrideCursor(); QMainWindow::enterEvent(event); }
source share