Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QWidget loses focus after calling my fuction.

QWidget loses focus after calling my fuction.

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 483 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    Sebastian
    wrote on last edited by
    #1

    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 ?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved