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. Close a QMainWindow from full screen
Forum Updated to NodeBB v4.3 + New Features

Close a QMainWindow from full screen

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 326 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.
  • blackout69B Offline
    blackout69B Offline
    blackout69
    wrote on last edited by
    #1

    Hello
    I have my own QAxWidget application that I need to embed on a QMainWindow

    WId wid = (WId)FindWindow(L"ScreenClass", nullptr);
    window = QWindow::fromWinId(wid);
    

    For internal application requirements, I am forced and run QMainWindow with the following flag:

    this->setWindowFlags(Qt::WindowDoesNotAcceptFocus);
    

    The application works well, the only problem is that I can't find an event to close the application with Escape key.
    I tried that, but it doesn't work because of the WindowDoesNotAcceptFocus flag.

    void FullScreen::keyPressEvent(QKeyEvent *event)
    {
      if (event->key() == Qt::Key_Escape)
    	{
    		close();
    	}
    }
    

    While with a double click it exits.

    void FullScreen::mouseDoubleClickEvent(QMouseEvent *event)
    {
    	 close();
    }
    

    What I ask, some ideas to close the application with a key on the keyboard.
    Thank you in advance
    blackout69

    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