You are not logged in.

#1 2010-08-09 12:26:36

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

Qt Project Loads up Initially with Many Windows

I have been developing a Qt-based multimedia flash card simulator for some time which is available at http://yellowcot.org. However, I have always had one weird issue. Namely, when first loading the programme, a bunch of little windows always show up for a moment and then disappear. It's hard to explain so I have recorded the phenomenon at,

http://reformedtube.org/yellowcot.ogv (will play in Firefox 3.5+ or VLC)

Does anyone have any idea what is causing this? If you're interested in poking around the code, it is available at http://yellowcot.org - the video is of the latest release, Yellowcot 1.1.13.

Offline

#2 2010-08-09 13:26:19

Wittfella
Member
From: Australia
Registered: 2008-05-27
Posts: 462

Re: Qt Project Loads up Initially with Many Windows

Hello,  I ran it and I don't see the extra windows, it starts up as normal for me.  I can't quite see in the video, but what is the title of those little windows, it might give you a clue where to look. ie are they the menu items, or maybe the tabBar items.

Incidently why not include the 'pro' file with the source.  I had to generate the pro file but it wouldn't compile because you have to add the QtSvg dependency.  Also there is no yellowcot icon included.

Sorry I couldn't be more helpfull,
Wittfella

Last edited by Wittfella (2010-08-09 13:27:39)

Offline

#3 2010-08-09 16:11:47

tony5429
Member
Registered: 2006-03-28
Posts: 1,017

Re: Qt Project Loads up Initially with Many Windows

I am so glad you responded! (I had a different post somewhere else on the forums to which no one responded for the whole last week)

So this is very interesting to me as I have run this on two different machines and always have the multiple windows issue. However both machines are running KDE. Are you on GNOME or something else?

Each of the little windows comes up with the title of the whole programme, "yellowcot." Since I only have two tabs (compared to the six little windows) I don't think they could be tabs. Maybe some menu items somewhere? If that's the case, how would that work and how could I stop it?

Hrm; I wrote this app in a text editor so I would have to create the pro file manually. What does the pro file do that the Makefile can't do? Thanks for pointing that out about QtSVG! I had been using a QtSVG object before but that is no longer needed so I cleaned up the Makefile in today's release of version 1.1.14 so that it does not require QtSVG. I still don't see though the purpose of the PRO file. Right now to install, all you need to do is run "make" (as non-root) and then "make install" (as root).

The yellowcot icon is included as a scalable SVG. It works fine on KDE; are you on KDE or a different desktop environment?

No need to apologise; thanks for your help!!

Offline

#4 2010-08-15 04:00:07

user_none
Member
Registered: 2010-03-25
Posts: 10

Re: Qt Project Loads up Initially with Many Windows

tony5429 wrote:

when first loading the programme, a bunch of little windows always show up for a moment and then disappear.

yellowcot.cpp: In YCQuiz::YCQuiz() on line 76 you call updateVisibleWidgets(). This is why you have all those little windows showing up. The following illustrates what is happening.

int main()
MainWindow mainWindow;
ycQuiz = new YCQuiz;
updateVisibleWidgets()
setCentralWidget()
mainWindow.show()

updateVisibleWidgets calls show on a number of widgets. These widgets have not been put into anything at this point. setCentralWidget happens after updateVisibleWidgets. So all of the widgets are getting shown but because they are not placed in a container they show all get shown as top level windows. Comment out the updateVisibleWidgets line to see yourself.

tony5429 wrote:

Hrm; I wrote this app in a text editor so I would have to create the pro file manually. What does the pro file do that the Makefile can't do?

pro files are stupid simple to write. Much easier than your own Makefile. Using a pro file will allow you to generate cross platform Makefiles. It gives you additional commands such as clean. It handles running moc on files that need it.

Have a look at Qt Creator. It is a very nice IDE specially designed for Qt. You can use it just as a text editor but it gives you some nice benefits like easy access to the API docs.

Also, you really shouldn't be putting all of your code in the h files. slots can be declared in the h file just like any other function. E.G. void resizeEvent(QResizeEvent *event); Then implemented in the cpp file. E.G. void YCQuiz::resizeEvent(QResizeEvent *event) {

Offline

Board footer

Powered by FluxBB