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. [SOLVED] How to cache .gif files using QLabel & QMovie ?
Forum Updated to NodeBB v4.3 + New Features

[SOLVED] How to cache .gif files using QLabel & QMovie ?

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

    Hi, I am working on some sort of Tower Defense Game
    It's working great except minors things.

    Image:
    http://s1.directupload.net/images/121227/7ehj2iwu.jpg
    http://img4.imageshack.us/img4/9991/gameinfox.jpg

    Now I try to increase the monster spawning amount.

    But already with a number of 40 it starts to lag too much.
    So I need to cache the one monster.gif

    I am using simply a QLabel and a QMovie to display them

    @ //MONSTER
    QLabel *monster[400];
    QMovie *monster_movie[400];@

    @ for (int i=0; i<3; i++) {

    // Monster [X]
    

    monster[i]= new QLabel(widget_map_background);
    monster[i]->setStyleSheet("background-image: url( )" );

    monster_movie[i] = new QMovie("monsters/SlugGunner_walk.gif");
    monster[i]->setMovie(monster_movie[i]);
    monster[i]->resize(60,60);
    monster[i]->setScaledContents(true);
    monster_movie[i]->start();
    }@

    How can I do this?
    thanks for any help!

    1 Reply Last reply
    0
    • M Offline
      M Offline
      MrNoway
      wrote on last edited by
      #2

      LOOOOOOOOOOOOOOOOOOL

      Okay guys, you will never guess what caused the big performance issue.

      somewhere I placed accidentally the code

      @repaint();@

      and that caused so big performance issues O.O
      so no need for cache anything.

      holy pussycat^^

      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