davidm71
26th April 2017, 13:48
I'm sure this is probably related to how events are handled but what is going on is I have a custom titlebar and class that reacts to double clicks allowing the qmainwindow to maximize when double click message is picked up and then go to a normal state when double clicked again. That works as intended. The problem is when I move or reposition the window by dragging via mouse the first double click is ignored. It takes another double click event to set the window back to a normal state. Here is some code:
void myApp::tmaxout()
{
qDebug() << "Getting the size message";
qDebug("%i",windowState());
setWindowState(windowState() ^ Qt::WindowMaximized);
if (windowState() == 0)
{
ui->centralWidget->setStyleSheet("QWidget#centralWidget { border: 12px solid black; border-radius:24px;}");
}
else
{
ui->centralWidget->setStyleSheet("QWidget#centralWidget {border: 12px solid black;}");
// setAttribute(Qt::WA_NativeWindow);
};
My tmaxout method is a private slot that gets called by my custom titlebar class by emiting a custom signal that I have verified in QDebug after the doubleclick is sent out. So no problem passing messages.
Thanks
void myApp::tmaxout()
{
qDebug() << "Getting the size message";
qDebug("%i",windowState());
setWindowState(windowState() ^ Qt::WindowMaximized);
if (windowState() == 0)
{
ui->centralWidget->setStyleSheet("QWidget#centralWidget { border: 12px solid black; border-radius:24px;}");
}
else
{
ui->centralWidget->setStyleSheet("QWidget#centralWidget {border: 12px solid black;}");
// setAttribute(Qt::WA_NativeWindow);
};
My tmaxout method is a private slot that gets called by my custom titlebar class by emiting a custom signal that I have verified in QDebug after the doubleclick is sent out. So no problem passing messages.
Thanks