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. Make widget in front of another widget
Forum Updated to NodeBB v4.3 + New Features

Make widget in front of another widget

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.4k Views 1 Watching
  • 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
    stereomatching
    wrote on last edited by
    #1

    "example":http://www.freeimagehosting.net/55kxs

    I want to make the QMainWindow behind of imageViewer(the one showing an image)
    become in front of the imageViewer after the imageViewer show up, I call this slot

    @
    activateWindow();
    raise();
    @

    imageViewer is a data member of QMainWindow, if it is possible, I would like to
    make each other become the "front" widget after I activate them by mouse or keyboard, but raise()
    wouldn't work. Do I choose a wrong function?

    1 Reply Last reply
    0
    • S Offline
      S Offline
      stereomatching
      wrote on last edited by
      #2

      @
      void mainWindow::mousePressEvent(QMouseEvent *)
      {

      ::SetWindowPos(effectiveWinId(), HWND_TOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
      ::SetWindowPos(effectiveWinId(), HWND_NOTOPMOST, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_SHOWWINDOW);
      raise();
      show();
      activateWindow();
      
      
      qDebug() << "mouse click";
      

      }
      @

      Tried another solution, wouldn't work either.

      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