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. How to access MainWindow statusBar from a OpenGL glWidget mouse event?
QtWS25 Last Chance

How to access MainWindow statusBar from a OpenGL glWidget mouse event?

Scheduled Pinned Locked Moved General and Desktop
2 Posts 2 Posters 1.3k 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.
  • P Offline
    P Offline
    pmaynard
    wrote on last edited by
    #1

    Inside my "class glwidget : public QGLWidget, protected QGLFunctions" I want to call the MainWindow method "statusBar()->showMessage( cursor location)" as the cursor moves over an image in my mouseMoveEvent() method.

    I've tried passing the MainWindow instance down into the glwidget, but there are circular include problems - MainWindow.h includes glwidget.h, so I can't include mainwindow.h inside glwidget.h. I've tried playing with the Ui namespace, and after 3 hours I'm giving up.

    Is there an easy way to do this? I'll even try the difficult way ...

    Thanks

    1 Reply Last reply
    0
    • Chris KawaC Online
      Chris KawaC Online
      Chris Kawa
      Lifetime Qt Champion
      wrote on last edited by
      #2

      In your glwidget create a signal eg. signalMessage(QString msg) and emit it in the mouseMoveEvent().
      In your main window create a slot eg. showMessage(QString msg) that will output something in the status bar.
      Connect those two in your main window. That way you don't need to include anything in the glwidget.

      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