Hello,
I want to create an invisible, frameless, dragable window with two visible buttons.
Frameless an invisible works fine when I use:
setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
setWindowFlags(Qt::FramelessWindowHint);
setAttribute(Qt::WA_TranslucentBackground);
To copy to clipboard, switch view to plain text mode
Added Buttons are visible.
But if I click around the buttons, where the invisible mainWindow should be, the click goes right through to whatever application there behind is.
I reimplemented the mouseMoveEvent and mousePressEvent, to drag the main window. When the window is visible this works great:
{
move(event->globalX()-m_nMouseClick_X_Coordinate,event->globalY()-m_nMouseClick_Y_Coordinate);
}
{
m_nMouseClick_X_Coordinate = event->x();
m_nMouseClick_Y_Coordinate = event->y();
qDebug() << "mouse press event" << endl;
}
void MainWindow::mouseMoveEvent(QMouseEvent *event)
{
move(event->globalX()-m_nMouseClick_X_Coordinate,event->globalY()-m_nMouseClick_Y_Coordinate);
}
void MainWindow::mousePressEvent(QMouseEvent *event)
{
m_nMouseClick_X_Coordinate = event->x();
m_nMouseClick_Y_Coordinate = event->y();
qDebug() << "mouse press event" << endl;
}
To copy to clipboard, switch view to plain text mode
If it is invisible nothing happens.
How can I make the invisible area of the mainwindow clickable, so i can drag it?
Regards
Redar
Edit: This program should run on windows
Bookmarks