[Qt-interest] Global variables "the Qt way"

Scott Aron Bloom Scott.Bloom at onshorecs.com
Wed Jun 16 17:39:31 CEST 2010


What I have done, create a singleton pattern based object.  Whos Qt
parent is the qApp

Scott

-----Original Message-----
From: qt-interest-bounces at trolltech.com
[mailto:qt-interest-bounces at trolltech.com] On Behalf Of Sensei
Sent: Wednesday, June 16, 2010 8:18 AM
To: qt-interest at trolltech.com
Subject: [Qt-interest] Global variables "the Qt way"

Hi! I am in starting a new project, and I have a simple question about
"global" variables, obviously not a C++ question! :)

What is the "Qt way" of handling global variable? 

I'll explain with an example. My application has a QApplication "global"
variabel qApp, always accessible. What do you recommend I do for, let's
say, a settings instance? This should be accessed by all (many) other
classes, but I find that simply having a header defining variables with
external storage, a little ugly.

I hope you can give me some hints!

Cheers!
_______________________________________________
Qt-interest mailing list
Qt-interest at trolltech.com
http://lists.trolltech.com/mailman/listinfo/qt-interest




More information about the Qt-interest-old mailing list