Author Topic: [QT] Desktop Derp  (Read 9434 times)

0 Members and 3 Guests are viewing this topic.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [QT] Desktop Derp
« Reply #15 on: June 09, 2013, 03:08:07 pm »
just make sure to move the gifs to your build directory, otherwise it won't work. It will compile+run without the gifs but there just won't be a derpy then.

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Streetwalrus

  • LV12 Extreme Poster (Next: 5000)
  • ************
  • Posts: 3821
  • Rating: +80/-8
    • View Profile
Re: [QT] Desktop Derp
« Reply #16 on: June 09, 2013, 03:14:27 pm »
Ok it works. BTW to compile you just do qmake then make.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [QT] Desktop Derp
« Reply #17 on: June 09, 2013, 03:18:12 pm »
really, that is awesome, i just looked at what qt creator sais it does, all that i need to do to compile is hit ctrl+r :P
And glad that you could compile it :D

EDIT: so Vogtinator, your fix doesn't work, it still stops running the new gifs after some time/some amount of gifs played, idk which one it is.
« Last Edit: June 09, 2013, 03:35:32 pm by Sorunome »

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: [QT] Desktop Derp
« Reply #18 on: June 09, 2013, 03:55:58 pm »
Quote
It will compile+run without the gifs but there just won't be a derpy then.
You can embed the .gifs as resource (e.g. /gifs/<name>.gif) and load them with ":/gifs/<name>.gif" as filename.

Quote
Ok it works. BTW to compile you just do qmake then make.
Better practice is to mkdir build, cd build, qmake .. and then make, so the source directory will be kept clean.
It's easier to exclude build in .gitignore than Makefile, *.o and the other output files.

Quote
, i just looked at what qt creator sais it does, all that i need to do to compile is hit ctrl+r
ctrl+b = build and F5 = debug.
BTW: If you use qDebug() << "asdf" instead of std::cout << "asdf", debug output will only be printed in debug build.

Quote
so Vogtinator, your fix doesn't work, it still stops running the new gifs after some time/some amount of gifs played, idk which one it is.
F5 will help you ;)

Edit: Some more advice:
- Don't allocate a QMovie everytime you change the animation. Set the filename by using QMovie::setFileName instead.
- To get the screen size use
Code: [Select]
QRect screen = qApp()->desktop()->screenGeometry()- You can use the << operator instead of .append
Code: [Select]
possibleMoveActions.append("fly");
possibleMoveActions.append("flyupsidedown");
//Is the same as
possibleMoveActions << "fly" << "flyupsidedown";
-Use initialization lists:
Code: [Select]
//The contructor
derp() {
posx=500;
posy=500;
}
//does (almost) the same as
derp() : posx(500), posy(500)
{}
-You don't have to use an .ui file, you can add a QLabel as property of your MainWindow and add it using setCentralWidget(label)
« Last Edit: June 09, 2013, 04:12:05 pm by Vogtinator »

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [QT] Desktop Derp
« Reply #19 on: June 09, 2013, 11:34:20 pm »
thanks for all the tips! so what is the difference with
Code: [Select]
//The contructor
derp() {
posx=500;
posy=500;
}
//does (almost) the same as
derp() : posx(500), posy(500)
{}
as almost is not all the way :P

and that was how i append the lists, i didn't know how to use qlists :P

and a somehow wanne use a ui file, but this project is actually too simple to use one so i should step away from it, just lemme code a bit, maybe magically the bug with derpy vanishing will disappear :D

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!

Offline Vogtinator

  • LV9 Veteran (Next: 1337)
  • *********
  • Posts: 1193
  • Rating: +108/-5
  • Instruction counter
    • View Profile
Re: [QT] Desktop Derp
« Reply #20 on: June 10, 2013, 08:52:35 am »
thanks for all the tips! so what is the difference with
Code: [Select]
//The contructor
derp() {
posx=500;
posy=500;
}
//does (almost) the same as
derp() : posx(500), posy(500)
{}
as almost is not all the way :P
With initialization lists you can call the constructor of your parent classes and initialize const members.
http://www.cprogramming.com/tutorial/initialization-lists-c++.html
Actually, what happens in
Code: [Select]
class Foo {
private: int i;
public: Foo()
{
i = 1;
}
};
Is that i will be initialized to 0 first (default constructor) and later its value will be set.
Quote
and a somehow wanne use a ui file, but this project is actually too simple to use one so i should step away from it, just lemme code a bit, maybe magically the bug with derpy vanishing will disappear :D
That bug hasn't occured to me at all, but I noticed it's still invisible without .gifs.

Offline Sorunome

  • Fox Fox Fox Fox Fox Fox Fox!
  • Support Staff
  • LV13 Extreme Addict (Next: 9001)
  • *************
  • Posts: 7920
  • Rating: +374/-13
  • Derpy Hooves
    • View Profile
    • My website! (You might lose the game)
Re: [QT] Desktop Derp
« Reply #21 on: June 13, 2013, 03:46:01 am »
I guess it is somehow filling up it's ram, i think that I fixed it, i'm testing it atm, i'll just run her for houres ^^

EDIT: All that I got around changing so far is
Quote
- Don't allocate a QMovie everytime you change the animation. Set the filename by using QMovie::setFileName instead.
and the bug seem to be fixed, i'll still do the other suggestions though :D
« Last Edit: June 13, 2013, 07:50:18 am by Sorunome »

THE GAME
Also, check out my website
If OmnomIRC is screwed up, blame me!
Click here to give me an internet!