Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6994515
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T19:54:09+00:00 2026-05-27T19:54:09+00:00

I hope my question isn’t always the same question. I have a QGraphicsScene. Its

  • 0

I hope my question isn’t always the same question.
I have a QGraphicsScene.
Its items are some QGraphicsPixmaps.
I move them with a timer that every second does SetX +10.
I set +10 cause the window is large 100.
With this solution my animations aren’t smooth. I thought I could make them smoother by setting instead of +10 a +1…+10. But it didn’t work.

Can you suggest me a way to do that please?
Thanks a lot.

void GameGui::updateScene()
{

for (int y = 0; y < game->getHeight(); ++y) {
    for (int x = 0; x < game->getWidth(); ++x) {
        Actor* a = game->get(y, x);

        if (sceneItems[a] != 0) {
        sceneItems[a]->setX(x*SIZE);
        sceneItems[a]->setY(y*SIZE);
        }
    }
}
}

Each actor is my game character (in his functions, such as moving ecc) in my core part of the progamm. sceneItems is a map where I associate each actor to his pixmap. x, y are the positions in the abstract scene and x*SIZE is the position in the graphicscene. The positions are updating in the abstract scene and i represent them in the graphicscene.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T19:54:10+00:00Added an answer on May 27, 2026 at 7:54 pm

    I animated my QGraphicItems with this approach:

    “The QGraphicsItemAnimation class provides simple animation support for QGraphicsItem.”
    http://doc.qt.io/qt-4.8/qgraphicsitemanimation.html

    Example from the linked site:

     QGraphicsItem *ball = new QGraphicsEllipseItem(0, 0, 20, 20);
    
     QTimeLine *timer = new QTimeLine(5000);
     timer->setFrameRange(0, 100);
    
     QGraphicsItemAnimation *animation = new QGraphicsItemAnimation;
     animation->setItem(ball);
     animation->setTimeLine(timer);
    
     for (int i = 0; i < 200; ++i)
         animation->setPosAt(i / 200.0, QPointF(i, i));
    
     QGraphicsScene *scene = new QGraphicsScene();
     scene->setSceneRect(0, 0, 250, 250);
     scene->addItem(ball);
    
     QGraphicsView *view = new QGraphicsView(scene);
     view->show();
    
     timer->start();
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question about Excel! I hope that isn't too unconventional for this
I hope this question isn't too open ended, but a nudge in the right
I'm relatively new to web application programming so I hope this question isn't too
Alright, I hope this isn't too broad a question but my curiosity got the
Hey guys, hope this isn't too much of a n00b question I'm mainly a
I hope the question isn't too vague but I was wondering if running 'Refresh'
I hope this question isn't too simple, I tried to go through the postgresql
Sorry, still reasonably new to Javascript here, so hope this question isn't too embarrassingly
I'm still a newcomer to python, so I hope this question isn't inane. The
I'm new to Windows Phone 7 App Programming, so I hope this question isn't

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.