Skip to content
  • 0 Votes
    6 Posts
    265 Views
    Axel SpoerlA
    If the requirement is to implement it with a keyboard, I recommend appropriate documentation: The application works only if autorepeat is turned off in the underlying window manager. By design, Qt can't control or override the window manager. One alternative is to use the mouse instead. Another alternative is to toggle recording with a click. That's essentially what all the recording and DAW applications that I know/use do: Audacity, Ardour, ...
  • 0 Votes
    9 Posts
    8k Views
    F
    well i was able to solve it on my own thanks for the help guys turns out after passing the connect statement through lambda, a different issue arrised instead of self.animation.endValue(widthExtend) i had to write self.animation.setEndValue(widthExtend)
  • 0 Votes
    5 Posts
    3k Views
    S
    @JoeCFD said in mouseMoveEvent not being called: do you have the following line in the constructor of class MouseTrackingFrame? installEventFilter( this ); No, the install_filter(...) function being called from MouseTrackingFrame::postSetup() does that. But I'm not sure if it has any effect - I saw a post somewhere which said Qt ignores when the widget itself is passed to installEventFilter(...)
  • Owning the game loop

    Unsolved Game Development game event loop event-handling loop
    3
    0 Votes
    3 Posts
    2k Views
    F
    @SGaist Thanks for answering. Basically, I am separating rendering and updating to have fixed-timestep updating (for physics etc) as well as as-fast-as-possible rendering with time interpolation. (Heavily heavily inspired from Gaffer on Games article) My code looks as follows (only slightly simplified): ... within my OpenGLContext void GLWindow::gameLoop() { const double delta = 1.0 / fixedUpdatesPerSecond; auto time = QDateTime::currentMSecsSinceEpoch(); double accumulated = 0.0; while (! this->terminate) { auto newTime = QDateTime::currentMSecsSinceEpoch(); double frameExecution = tdiff(time, newTime); time = newTime; accumulated += frameExecution; while (accumulated >= delta) { // Handle user input / system polling //However, since Qt has event driven polling, let's just call processEvents and then handle any input events by putting their results into a map. QCoreApplication::processEvents(); // Update our states this->updateState(delta); accumulated -= delta; } this->render(accumulated / delta); } } In the same class, I have updateState and render: void MyGL::updateState(float delta) { //... Bunch of commented-out code to make sure base loop works first if(myKeys.at(Qt::Key_W)) { cam->translateAlongForward(delta * 3.0); cam->update(); } } void MyGL::render(float aheadAlphaPercent) { this->update(); } void MyGL::paintGL() { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); lambertShader->setViewProj(cam->matrix()); // a lot of other drawing stuff } I know that my rendering code itself works because I initially tested it by just using a QTimer. Instead, I now do the following: ...in main... QApplication a(argc, argv); QSurfaceFormat::setDefaultFormat(format); MainWindow w; w.show(); w.start(); //return a.exec(); // ^Dont^want^to^uncomment^this^ ... MainWindow::start (MainWindow is QMainWindow subclass)... uiElements->glWindow->gameLoop(); //glWindow is subclass of OpenGLContext As you can see, I tried to avoid calling Qt's blocking event loop in QApplication::exec, but am still polling events. However, this doesn't work properly, as described in my first post.
  • 0 Votes
    2 Posts
    893 Views
    SGaistS
    Hi and welcome to devnet, What version of Qt ? What platform ? Are you receiving that event at all ? Did you re-implement anything of Qt 5 ?
  • 0 Votes
    19 Posts
    25k Views
    Pl45m4P
    @illud Do you think after 6 years, he's still looking for a solution? ;-) The topic is marked "solved" anyway :-)
  • 0 Votes
    4 Posts
    2k Views
    A
    @Stefan-Monov76 Have you found the answer?