Show main windows after the Splash Screen in C++ - QT












0















I have an application with a Splash Screen. I need to show the splash screen to appear before the main window appears and wait 3.5 seconds. Once it finished now I need to show the main window.



Here is the code what I have tried,



#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QTimer>
#include "game.h"
#include "player.h"
#include <QSplashScreen>
#include <QObject>


Game *game;

int main(int argc, char *argv)

{
//Splash screen
QApplication a(argc, argv);
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/images/Images/1.JPG"));
splash->show();

//main window
game = new Game();

QTimer::singleShot(3500, splash, SLOT(close()));

QTimer::singleShot(3500, game, SLOT(show()));

game->displayHome();
return a.exec();
}


Game Class



Game::Game(QWidget *parent)
{

scene = new QGraphicsScene();
scene->setSceneRect(0,0,800,600);
setBackgroundBrush(QBrush(QImage("img.png")));

setScene(scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFixedSize(800,600);

show();
qDebug() << "yoyoyoy";

score = new Score();
health = new Health();


connect(this->health,SIGNAL(crash()),this,SLOT(gameover3()));
}

void Game::displayHome()
{
logo = new Logo();
scene->addItem(logo);

playButton = new Menubuttons(QString("Play"));
int bxPos = this->width()/2 - playButton->boundingRect().width()/2;
int byPos = 275;
playButton->setPos(bxPos,byPos);
connect(playButton,SIGNAL(clicked()),this,SLOT(startGame()));
scene->addItem(playButton);

instructions = new Menubuttons(QString("Instructions"));
int axPos = this->width()/2 - instructions->boundingRect().width()/2;
int ayPos = 350;
instructions->setPos(axPos,ayPos);
connect(instructions,SIGNAL(clicked()),this,SLOT(instruct()));
scene->addItem(instructions);

quitButton = new Menubuttons(QString("Quit"));
int qxPos = this->width()/2 - quitButton->boundingRect().width()/2;
int qyPos = 425;
quitButton->setPos(qxPos,qyPos);
connect(quitButton,SIGNAL(clicked()),this,SLOT(close()));
scene->addItem(quitButton);

scene->removeItem(inst);
}


But it appears both at the same time. How can I fix that?










share|improve this question

























  • @eyllanesc Oh, I am sorry sir. I still didn't check. I will check and let you know sir. Thanks for your answer sir

    – Tech Guy
    Jan 1 at 9:21













  • @eyllanesc It is not working sir. diaplayHome() is a method in Game class. It initializes UI that need to open in the window. I am making a Game sir

    – Tech Guy
    Jan 2 at 4:48








  • 1





    then provide a Minimal, Complete, and Verifiable example, show your Game class.

    – eyllanesc
    Jan 2 at 4:50













  • @eyllanesc I have added game class. can you check that sir?

    – Tech Guy
    Jan 3 at 2:53
















0















I have an application with a Splash Screen. I need to show the splash screen to appear before the main window appears and wait 3.5 seconds. Once it finished now I need to show the main window.



Here is the code what I have tried,



#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QTimer>
#include "game.h"
#include "player.h"
#include <QSplashScreen>
#include <QObject>


Game *game;

int main(int argc, char *argv)

{
//Splash screen
QApplication a(argc, argv);
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/images/Images/1.JPG"));
splash->show();

//main window
game = new Game();

QTimer::singleShot(3500, splash, SLOT(close()));

QTimer::singleShot(3500, game, SLOT(show()));

game->displayHome();
return a.exec();
}


Game Class



Game::Game(QWidget *parent)
{

scene = new QGraphicsScene();
scene->setSceneRect(0,0,800,600);
setBackgroundBrush(QBrush(QImage("img.png")));

setScene(scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFixedSize(800,600);

show();
qDebug() << "yoyoyoy";

score = new Score();
health = new Health();


connect(this->health,SIGNAL(crash()),this,SLOT(gameover3()));
}

void Game::displayHome()
{
logo = new Logo();
scene->addItem(logo);

playButton = new Menubuttons(QString("Play"));
int bxPos = this->width()/2 - playButton->boundingRect().width()/2;
int byPos = 275;
playButton->setPos(bxPos,byPos);
connect(playButton,SIGNAL(clicked()),this,SLOT(startGame()));
scene->addItem(playButton);

instructions = new Menubuttons(QString("Instructions"));
int axPos = this->width()/2 - instructions->boundingRect().width()/2;
int ayPos = 350;
instructions->setPos(axPos,ayPos);
connect(instructions,SIGNAL(clicked()),this,SLOT(instruct()));
scene->addItem(instructions);

quitButton = new Menubuttons(QString("Quit"));
int qxPos = this->width()/2 - quitButton->boundingRect().width()/2;
int qyPos = 425;
quitButton->setPos(qxPos,qyPos);
connect(quitButton,SIGNAL(clicked()),this,SLOT(close()));
scene->addItem(quitButton);

scene->removeItem(inst);
}


But it appears both at the same time. How can I fix that?










share|improve this question

























  • @eyllanesc Oh, I am sorry sir. I still didn't check. I will check and let you know sir. Thanks for your answer sir

    – Tech Guy
    Jan 1 at 9:21













  • @eyllanesc It is not working sir. diaplayHome() is a method in Game class. It initializes UI that need to open in the window. I am making a Game sir

    – Tech Guy
    Jan 2 at 4:48








  • 1





    then provide a Minimal, Complete, and Verifiable example, show your Game class.

    – eyllanesc
    Jan 2 at 4:50













  • @eyllanesc I have added game class. can you check that sir?

    – Tech Guy
    Jan 3 at 2:53














0












0








0








I have an application with a Splash Screen. I need to show the splash screen to appear before the main window appears and wait 3.5 seconds. Once it finished now I need to show the main window.



Here is the code what I have tried,



#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QTimer>
#include "game.h"
#include "player.h"
#include <QSplashScreen>
#include <QObject>


Game *game;

int main(int argc, char *argv)

{
//Splash screen
QApplication a(argc, argv);
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/images/Images/1.JPG"));
splash->show();

//main window
game = new Game();

QTimer::singleShot(3500, splash, SLOT(close()));

QTimer::singleShot(3500, game, SLOT(show()));

game->displayHome();
return a.exec();
}


Game Class



Game::Game(QWidget *parent)
{

scene = new QGraphicsScene();
scene->setSceneRect(0,0,800,600);
setBackgroundBrush(QBrush(QImage("img.png")));

setScene(scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFixedSize(800,600);

show();
qDebug() << "yoyoyoy";

score = new Score();
health = new Health();


connect(this->health,SIGNAL(crash()),this,SLOT(gameover3()));
}

void Game::displayHome()
{
logo = new Logo();
scene->addItem(logo);

playButton = new Menubuttons(QString("Play"));
int bxPos = this->width()/2 - playButton->boundingRect().width()/2;
int byPos = 275;
playButton->setPos(bxPos,byPos);
connect(playButton,SIGNAL(clicked()),this,SLOT(startGame()));
scene->addItem(playButton);

instructions = new Menubuttons(QString("Instructions"));
int axPos = this->width()/2 - instructions->boundingRect().width()/2;
int ayPos = 350;
instructions->setPos(axPos,ayPos);
connect(instructions,SIGNAL(clicked()),this,SLOT(instruct()));
scene->addItem(instructions);

quitButton = new Menubuttons(QString("Quit"));
int qxPos = this->width()/2 - quitButton->boundingRect().width()/2;
int qyPos = 425;
quitButton->setPos(qxPos,qyPos);
connect(quitButton,SIGNAL(clicked()),this,SLOT(close()));
scene->addItem(quitButton);

scene->removeItem(inst);
}


But it appears both at the same time. How can I fix that?










share|improve this question
















I have an application with a Splash Screen. I need to show the splash screen to appear before the main window appears and wait 3.5 seconds. Once it finished now I need to show the main window.



Here is the code what I have tried,



#include <QApplication>
#include <QGraphicsScene>
#include <QGraphicsView>
#include <QTimer>
#include "game.h"
#include "player.h"
#include <QSplashScreen>
#include <QObject>


Game *game;

int main(int argc, char *argv)

{
//Splash screen
QApplication a(argc, argv);
QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/images/Images/1.JPG"));
splash->show();

//main window
game = new Game();

QTimer::singleShot(3500, splash, SLOT(close()));

QTimer::singleShot(3500, game, SLOT(show()));

game->displayHome();
return a.exec();
}


Game Class



Game::Game(QWidget *parent)
{

scene = new QGraphicsScene();
scene->setSceneRect(0,0,800,600);
setBackgroundBrush(QBrush(QImage("img.png")));

setScene(scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFixedSize(800,600);

show();
qDebug() << "yoyoyoy";

score = new Score();
health = new Health();


connect(this->health,SIGNAL(crash()),this,SLOT(gameover3()));
}

void Game::displayHome()
{
logo = new Logo();
scene->addItem(logo);

playButton = new Menubuttons(QString("Play"));
int bxPos = this->width()/2 - playButton->boundingRect().width()/2;
int byPos = 275;
playButton->setPos(bxPos,byPos);
connect(playButton,SIGNAL(clicked()),this,SLOT(startGame()));
scene->addItem(playButton);

instructions = new Menubuttons(QString("Instructions"));
int axPos = this->width()/2 - instructions->boundingRect().width()/2;
int ayPos = 350;
instructions->setPos(axPos,ayPos);
connect(instructions,SIGNAL(clicked()),this,SLOT(instruct()));
scene->addItem(instructions);

quitButton = new Menubuttons(QString("Quit"));
int qxPos = this->width()/2 - quitButton->boundingRect().width()/2;
int qyPos = 425;
quitButton->setPos(qxPos,qyPos);
connect(quitButton,SIGNAL(clicked()),this,SLOT(close()));
scene->addItem(quitButton);

scene->removeItem(inst);
}


But it appears both at the same time. How can I fix that?







c++ qt






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 8 at 12:02









piet.t

10.1k73245




10.1k73245










asked Jan 1 at 6:42









Tech GuyTech Guy

7810




7810













  • @eyllanesc Oh, I am sorry sir. I still didn't check. I will check and let you know sir. Thanks for your answer sir

    – Tech Guy
    Jan 1 at 9:21













  • @eyllanesc It is not working sir. diaplayHome() is a method in Game class. It initializes UI that need to open in the window. I am making a Game sir

    – Tech Guy
    Jan 2 at 4:48








  • 1





    then provide a Minimal, Complete, and Verifiable example, show your Game class.

    – eyllanesc
    Jan 2 at 4:50













  • @eyllanesc I have added game class. can you check that sir?

    – Tech Guy
    Jan 3 at 2:53



















  • @eyllanesc Oh, I am sorry sir. I still didn't check. I will check and let you know sir. Thanks for your answer sir

    – Tech Guy
    Jan 1 at 9:21













  • @eyllanesc It is not working sir. diaplayHome() is a method in Game class. It initializes UI that need to open in the window. I am making a Game sir

    – Tech Guy
    Jan 2 at 4:48








  • 1





    then provide a Minimal, Complete, and Verifiable example, show your Game class.

    – eyllanesc
    Jan 2 at 4:50













  • @eyllanesc I have added game class. can you check that sir?

    – Tech Guy
    Jan 3 at 2:53

















@eyllanesc Oh, I am sorry sir. I still didn't check. I will check and let you know sir. Thanks for your answer sir

– Tech Guy
Jan 1 at 9:21







@eyllanesc Oh, I am sorry sir. I still didn't check. I will check and let you know sir. Thanks for your answer sir

– Tech Guy
Jan 1 at 9:21















@eyllanesc It is not working sir. diaplayHome() is a method in Game class. It initializes UI that need to open in the window. I am making a Game sir

– Tech Guy
Jan 2 at 4:48







@eyllanesc It is not working sir. diaplayHome() is a method in Game class. It initializes UI that need to open in the window. I am making a Game sir

– Tech Guy
Jan 2 at 4:48






1




1





then provide a Minimal, Complete, and Verifiable example, show your Game class.

– eyllanesc
Jan 2 at 4:50







then provide a Minimal, Complete, and Verifiable example, show your Game class.

– eyllanesc
Jan 2 at 4:50















@eyllanesc I have added game class. can you check that sir?

– Tech Guy
Jan 3 at 2:53





@eyllanesc I have added game class. can you check that sir?

– Tech Guy
Jan 3 at 2:53












1 Answer
1






active

oldest

votes


















1














The behavior you describe is not reproduced by the complete example below



#include <QtWidgets/QApplication>
#include <qmainwindow.h>
#include <qwidget.h>
#include <qtimer.h>
#include <qsplashscreen.h>

QMainWindow* game;

int main(int argc, char *argv)
{
QApplication a(argc, argv);

QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/StackOverflow/SplashScreen"));
splash->show();

game = new QMainWindow();

QTimer::singleShot(3500, splash, SLOT(close()));
QTimer::singleShot(3500, game, SLOT(show()));

return a.exec();
}


Running this displays a splash screen for 3.5 seconds followed by the main window. The issue may be your implementation for the Game class or the member function displayHome().



Edit



After your edit with the Game class definition and implementation it is clear the problem is calling show() at the end of the Game::Game() constructor. This causes game to display immediately upon construction, the subsequent call to show() in QTimer::singleShot(3500, game, SLOT(show())) is redundant upon the already visible object. To fix this simply remove show() from the Game constructor, i.e. it should be



Game::Game(QWidget *parent)
{
scene = new QGraphicsScene();
scene->setSceneRect(0, 0, 800, 600);
setBackgroundBrush(QBrush(QImage("img.png")));

setScene(scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFixedSize(800, 600);
}





share|improve this answer


























  • I have added that splash screen code. Previously It is Game *game = new Game(); to start the game only. I will check this and let you know sir. Thank you for your answer sir.

    – Tech Guy
    Jan 1 at 9:09











  • I checked this. But it is not working.

    – Tech Guy
    Jan 2 at 4:49











  • @TechGuy If you can't reproduce the behavior I describe in the answer with the exact code here then you need to look at how you are compiling and executing the program as the problem is not in the code.

    – William Miller
    Jan 2 at 4:54













  • I have updated my question. Can you check sir?

    – Tech Guy
    Jan 3 at 2:53











  • @TechGuy Don't forget to accept if this correctly answers your question (with edits)

    – William Miller
    Jan 9 at 2:17











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993526%2fshow-main-windows-after-the-splash-screen-in-c-qt%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









1














The behavior you describe is not reproduced by the complete example below



#include <QtWidgets/QApplication>
#include <qmainwindow.h>
#include <qwidget.h>
#include <qtimer.h>
#include <qsplashscreen.h>

QMainWindow* game;

int main(int argc, char *argv)
{
QApplication a(argc, argv);

QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/StackOverflow/SplashScreen"));
splash->show();

game = new QMainWindow();

QTimer::singleShot(3500, splash, SLOT(close()));
QTimer::singleShot(3500, game, SLOT(show()));

return a.exec();
}


Running this displays a splash screen for 3.5 seconds followed by the main window. The issue may be your implementation for the Game class or the member function displayHome().



Edit



After your edit with the Game class definition and implementation it is clear the problem is calling show() at the end of the Game::Game() constructor. This causes game to display immediately upon construction, the subsequent call to show() in QTimer::singleShot(3500, game, SLOT(show())) is redundant upon the already visible object. To fix this simply remove show() from the Game constructor, i.e. it should be



Game::Game(QWidget *parent)
{
scene = new QGraphicsScene();
scene->setSceneRect(0, 0, 800, 600);
setBackgroundBrush(QBrush(QImage("img.png")));

setScene(scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFixedSize(800, 600);
}





share|improve this answer


























  • I have added that splash screen code. Previously It is Game *game = new Game(); to start the game only. I will check this and let you know sir. Thank you for your answer sir.

    – Tech Guy
    Jan 1 at 9:09











  • I checked this. But it is not working.

    – Tech Guy
    Jan 2 at 4:49











  • @TechGuy If you can't reproduce the behavior I describe in the answer with the exact code here then you need to look at how you are compiling and executing the program as the problem is not in the code.

    – William Miller
    Jan 2 at 4:54













  • I have updated my question. Can you check sir?

    – Tech Guy
    Jan 3 at 2:53











  • @TechGuy Don't forget to accept if this correctly answers your question (with edits)

    – William Miller
    Jan 9 at 2:17
















1














The behavior you describe is not reproduced by the complete example below



#include <QtWidgets/QApplication>
#include <qmainwindow.h>
#include <qwidget.h>
#include <qtimer.h>
#include <qsplashscreen.h>

QMainWindow* game;

int main(int argc, char *argv)
{
QApplication a(argc, argv);

QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/StackOverflow/SplashScreen"));
splash->show();

game = new QMainWindow();

QTimer::singleShot(3500, splash, SLOT(close()));
QTimer::singleShot(3500, game, SLOT(show()));

return a.exec();
}


Running this displays a splash screen for 3.5 seconds followed by the main window. The issue may be your implementation for the Game class or the member function displayHome().



Edit



After your edit with the Game class definition and implementation it is clear the problem is calling show() at the end of the Game::Game() constructor. This causes game to display immediately upon construction, the subsequent call to show() in QTimer::singleShot(3500, game, SLOT(show())) is redundant upon the already visible object. To fix this simply remove show() from the Game constructor, i.e. it should be



Game::Game(QWidget *parent)
{
scene = new QGraphicsScene();
scene->setSceneRect(0, 0, 800, 600);
setBackgroundBrush(QBrush(QImage("img.png")));

setScene(scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFixedSize(800, 600);
}





share|improve this answer


























  • I have added that splash screen code. Previously It is Game *game = new Game(); to start the game only. I will check this and let you know sir. Thank you for your answer sir.

    – Tech Guy
    Jan 1 at 9:09











  • I checked this. But it is not working.

    – Tech Guy
    Jan 2 at 4:49











  • @TechGuy If you can't reproduce the behavior I describe in the answer with the exact code here then you need to look at how you are compiling and executing the program as the problem is not in the code.

    – William Miller
    Jan 2 at 4:54













  • I have updated my question. Can you check sir?

    – Tech Guy
    Jan 3 at 2:53











  • @TechGuy Don't forget to accept if this correctly answers your question (with edits)

    – William Miller
    Jan 9 at 2:17














1












1








1







The behavior you describe is not reproduced by the complete example below



#include <QtWidgets/QApplication>
#include <qmainwindow.h>
#include <qwidget.h>
#include <qtimer.h>
#include <qsplashscreen.h>

QMainWindow* game;

int main(int argc, char *argv)
{
QApplication a(argc, argv);

QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/StackOverflow/SplashScreen"));
splash->show();

game = new QMainWindow();

QTimer::singleShot(3500, splash, SLOT(close()));
QTimer::singleShot(3500, game, SLOT(show()));

return a.exec();
}


Running this displays a splash screen for 3.5 seconds followed by the main window. The issue may be your implementation for the Game class or the member function displayHome().



Edit



After your edit with the Game class definition and implementation it is clear the problem is calling show() at the end of the Game::Game() constructor. This causes game to display immediately upon construction, the subsequent call to show() in QTimer::singleShot(3500, game, SLOT(show())) is redundant upon the already visible object. To fix this simply remove show() from the Game constructor, i.e. it should be



Game::Game(QWidget *parent)
{
scene = new QGraphicsScene();
scene->setSceneRect(0, 0, 800, 600);
setBackgroundBrush(QBrush(QImage("img.png")));

setScene(scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFixedSize(800, 600);
}





share|improve this answer















The behavior you describe is not reproduced by the complete example below



#include <QtWidgets/QApplication>
#include <qmainwindow.h>
#include <qwidget.h>
#include <qtimer.h>
#include <qsplashscreen.h>

QMainWindow* game;

int main(int argc, char *argv)
{
QApplication a(argc, argv);

QSplashScreen *splash = new QSplashScreen;
splash->setPixmap(QPixmap(":/StackOverflow/SplashScreen"));
splash->show();

game = new QMainWindow();

QTimer::singleShot(3500, splash, SLOT(close()));
QTimer::singleShot(3500, game, SLOT(show()));

return a.exec();
}


Running this displays a splash screen for 3.5 seconds followed by the main window. The issue may be your implementation for the Game class or the member function displayHome().



Edit



After your edit with the Game class definition and implementation it is clear the problem is calling show() at the end of the Game::Game() constructor. This causes game to display immediately upon construction, the subsequent call to show() in QTimer::singleShot(3500, game, SLOT(show())) is redundant upon the already visible object. To fix this simply remove show() from the Game constructor, i.e. it should be



Game::Game(QWidget *parent)
{
scene = new QGraphicsScene();
scene->setSceneRect(0, 0, 800, 600);
setBackgroundBrush(QBrush(QImage("img.png")));

setScene(scene);
setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
setFixedSize(800, 600);
}






share|improve this answer














share|improve this answer



share|improve this answer








edited Jan 3 at 3:21

























answered Jan 1 at 8:48









William MillerWilliam Miller

1,190216




1,190216













  • I have added that splash screen code. Previously It is Game *game = new Game(); to start the game only. I will check this and let you know sir. Thank you for your answer sir.

    – Tech Guy
    Jan 1 at 9:09











  • I checked this. But it is not working.

    – Tech Guy
    Jan 2 at 4:49











  • @TechGuy If you can't reproduce the behavior I describe in the answer with the exact code here then you need to look at how you are compiling and executing the program as the problem is not in the code.

    – William Miller
    Jan 2 at 4:54













  • I have updated my question. Can you check sir?

    – Tech Guy
    Jan 3 at 2:53











  • @TechGuy Don't forget to accept if this correctly answers your question (with edits)

    – William Miller
    Jan 9 at 2:17



















  • I have added that splash screen code. Previously It is Game *game = new Game(); to start the game only. I will check this and let you know sir. Thank you for your answer sir.

    – Tech Guy
    Jan 1 at 9:09











  • I checked this. But it is not working.

    – Tech Guy
    Jan 2 at 4:49











  • @TechGuy If you can't reproduce the behavior I describe in the answer with the exact code here then you need to look at how you are compiling and executing the program as the problem is not in the code.

    – William Miller
    Jan 2 at 4:54













  • I have updated my question. Can you check sir?

    – Tech Guy
    Jan 3 at 2:53











  • @TechGuy Don't forget to accept if this correctly answers your question (with edits)

    – William Miller
    Jan 9 at 2:17

















I have added that splash screen code. Previously It is Game *game = new Game(); to start the game only. I will check this and let you know sir. Thank you for your answer sir.

– Tech Guy
Jan 1 at 9:09





I have added that splash screen code. Previously It is Game *game = new Game(); to start the game only. I will check this and let you know sir. Thank you for your answer sir.

– Tech Guy
Jan 1 at 9:09













I checked this. But it is not working.

– Tech Guy
Jan 2 at 4:49





I checked this. But it is not working.

– Tech Guy
Jan 2 at 4:49













@TechGuy If you can't reproduce the behavior I describe in the answer with the exact code here then you need to look at how you are compiling and executing the program as the problem is not in the code.

– William Miller
Jan 2 at 4:54







@TechGuy If you can't reproduce the behavior I describe in the answer with the exact code here then you need to look at how you are compiling and executing the program as the problem is not in the code.

– William Miller
Jan 2 at 4:54















I have updated my question. Can you check sir?

– Tech Guy
Jan 3 at 2:53





I have updated my question. Can you check sir?

– Tech Guy
Jan 3 at 2:53













@TechGuy Don't forget to accept if this correctly answers your question (with edits)

– William Miller
Jan 9 at 2:17





@TechGuy Don't forget to accept if this correctly answers your question (with edits)

– William Miller
Jan 9 at 2:17




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53993526%2fshow-main-windows-after-the-splash-screen-in-c-qt%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

Monofisismo

Angular Downloading a file using contenturl with Basic Authentication

Olmecas