> "This is actually a mistake in your code. You must make the MyUIClass object a child of mainWin, otherwise you get two independent toplevel windows... This way, you get only one window (mainWin). Now do a mainWin->show() and all is good
You're absolutely right, now the app closes properly. Thanks so much!
Also, I got the window to startup big enough by adding the line:
mainWin->setMinimumSize( centralWidget->size() );
I don't know if that's what I supposed to have done, but it works.
What still doesn't work well, is the splash screen. As I said, it looks garbled up, the top left corner showing the bottom right part of the image, etc. As I'm really very new to this (I suppose you noticed), I'm gonna copy the entire main function so you can see if there are any obvious errors. The fact is that the splash started to act funny when I added the KMainWindow to my code, so it's also possible that that's somehow the cause. If anyone has any ideas...
|
Source code
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
|
int main( int argc, char** argv )
{
KAboutData about(
"foo",
I18N_NOOP( "Foo" ),
version,
description,
KAboutData::License_GPL,
"Coded by Newbie",
0,
0,
"newbie@mail.com"
);
about.addAuthor( "newbie", 0, "newbie@mail.com" );
KCmdLineArgs::init( argc, argv, &about );
KCmdLineArgs::addCmdLineOptions( options );
KApplication app;
QPixmap pixmap( "splash.png" );
KSplashScreen *splash = new KSplashScreen( pixmap );
splash->show();
KCmdLineArgs *args = KCmdLineArgs::parsedArgs();
KMainWindow* mainWin = new KMainWindow();
app.setMainWidget( mainWin );
MyUIClass* centralWidget = 0;
centralWidget = new MyUIClass( mainWin );
mainWin->setCentralWidget( centralWidget );
mainWin->setMinimumSize( centralWidget->size() );
mainWin->show();
args->clear();
splash->finish( centralWidget );
delete splash;
return app.exec();
}
|
Thanks for your attention. I'm very impressed about the help I'm receiving here, but I really feel bad to bug professional developpers with stupid newbie questions. If there's any "newbie-forum" about KDE-Qt developmente, feel free to send me there.