Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Game Development
  4. QWidget in memory. problem with events.

QWidget in memory. problem with events.

Scheduled Pinned Locked Moved Game Development
7 Posts 3 Posters 4.1k 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.
  • A Offline
    A Offline
    abrakadobr
    wrote on last edited by
    #1

    I'm creating 3d game, using Ogre3d.
    I’m trying to use Qt libs if it's possible and don’t want to add any other dependencies, so i don’t wanna use GUI libs (like CEGUI), but I whant to use Qt GUI.
    So i’m implementing “TextureWidget” – this is plane in 3d space with texture of any QWidget based object.
    to get “image of widget” for texture i use QWidget::render(QImage); every 100ms (QTimer), after i push this QImage to Ogre3D::Materal/texture/whatever =)
    1st problem i've got: any QWidget, created in memory is disabled by default. to enable it – need to call show() method. But I don’t need to show my widget – i want to have it in memory only.
    my solution: i put my widget to QGraphicsScene, cuz method QGraphicsScene::addWidget(QWidget * wgt); automaticaly call wgt->show(); and widget becomes enabled.
    next: so i'm getting texture, but it's on the plane 3d space, making coordinates recalculation for this plane-widget, so i have x/y coords for widget like in usual QMouseEvent->pos().x()/y()
    2nd problem: now i have a problem to translate Mouse/KeyEvents to “memory-widget”. i try to postEvent directly to widget – no result. try postEvent to QGraphicsScene – no result.
    any suggestions?

    1 Reply Last reply
    0
    • EddyE Offline
      EddyE Offline
      Eddy
      wrote on last edited by
      #2

      Moved to the game development subforum where all the gaming experts like to hang out ;)

      Qt Certified Specialist
      www.edalsolutions.be

      1 Reply Last reply
      0
      • A Offline
        A Offline
        abrakadobr
        wrote on last edited by
        #3

        Thanks =)
        But i'm not shure - this is gamedev question (how to translate/generate events)

        1 Reply Last reply
        0
        • EddyE Offline
          EddyE Offline
          Eddy
          wrote on last edited by
          #4

          By moving it, there is still a topic in the other subforum that opens this one when clicking on it.

          Maybe more response if you show us more of your code?

          Qt Certified Specialist
          www.edalsolutions.be

          1 Reply Last reply
          0
          • A Offline
            A Offline
            abrakadobr
            wrote on last edited by
            #5

            @
            QMouseEvent * e = new QMouseEvent(QEvent::MouseMove,mTranslatedWidget->property("pt").toPoint(),Qt::NoButton,Qt::NoButton,Qt::NoModifier);
            // qApp->sendEvent(mTranslatedWidget,e);
            qApp->postEvent(mTranslatedWidget,e);
            @
            property("pt") contains QPoint with x/y coords like it's 2d widget on screen in (0,0) position
            mTranslatedWidget is QWidget* (existing in memory, and in QGraphicsScene)

            1 Reply Last reply
            0
            • A Offline
              A Offline
              abrakadobr
              wrote on last edited by
              #6

              so nobody has any ideas?
              may be it is other way to grab texture and keep widget in memory with events system?
              or where possible to read about difference in widget states "in memory"/"on screen"?

              1 Reply Last reply
              0
              • G Offline
                G Offline
                giesbert
                wrote on last edited by
                #7

                System events (what mouse and keyboard are typically) are send in a different way:

                sendSpontanousEvent, which is an internal Qt method.

                I'm not 100% sure, if that can be achieved the way you try to do it...

                Nokia Certified Qt Specialist.
                Programming Is Like Sex: One mistake and you have to support it for the rest of your life. (Michael Sinz)

                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