Unsolved QWidget loses focus after calling my fuction.
-
Dear Friends,
I have QWidget(primary screen suppose) that have a lots of QPushbuttons and many things. on pressing one of the buttons.it opens another QWidget(second screen) which has a button name clicked.On pressing the click button it takes the screenshot and saves it.My problem is it looses the focus after taking the screen shots.The focus is on the primary screen(background).i am able to click on primary screen although the second screen(Front ) is open,.After calling the below function the problem starts .```
// void Clicked(QWidget *wid)
{
QPixmap pixmap;
QScreen *screen = QGuiApplication::primaryScreen();
pixmap = screen->grabWindow(widget->winId());
return pixmap;
}For solving the problem. I tried like ``` // widget->raise(); widget->activateWindow(); widget->setWindowFlags(Qt::Tool | Qt::WindowStaysOnBottomHint); widget->setFocusPolicy(Qt::StrongFocus);
so.Please give you suggestions what i am doing wrong ?
Why the screen is open and i am able to click on background widgets buttons.every thing is working normal but when i call clicked() functions then what changes is happening that my upper widget is loosing focus ?