First solution
You can add the following flag to the flags of your window to prevent the window from being resized by the user:
setWindowFlags(this->windowFlags() |= Qt::FramelessWindowHint);
Here is some more information about Window Flags.
Second (ugly) experiment solution
This is kind of a dirty work-around... I'm fully aware of the fact, that this is not clean.
I just wrote this little main window that changes the cursor manually when the main window's area is left.
Note: You have to consider side effects. Maybe there is another cursor shape needed for a child widget, but this overrides the cursor for the complete application.
This can be used as a starting point for further development and for simple applications.
Header:
class CMainWindow :
public QMainWindow
{
public:
CMainWindow(QWidget* parent = nullptr);
virtual ~CMainWindow(void);
protected:
virtual void leaveEvent( QEvent *event );
virtual void enterEvent( QEvent *event );
};
cpp:
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);
}