Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 1

Qt-interest Archive, May 2008
Re: Get Program Name


Message 1 in thread

Hi, Gerhard.

I'm not certain exactly what you're trying to do, but I would suggest
moving your "global statics" out of actual global scope and use a more
portable means to initialize and access them.

Since typically in a Qt app, the QApplication object is the first one
created, it seems logical to me to subclass that, add these "global
statics" as data members initialized in the QApplication subclass
constructor, and allow access to them from static functions of the
subclassed QApplication object.

This is just a suggestion and may not work for what you're trying to do.
 As I said, I'm not entirely clear -why- you have to accomplish what
you're attempting, so if I'm way off base, I apologize. ;)

Cheers,
Darrik

Gerhard Wenzl wrote:
> Hi,
> 
> I'm currently using Qt 4.3.3 and I want to get the name of my own binary
> under linux.
> Using main's argv[0] is not an option, because I need access to the
> program's name during the initialization of some (global) static objects
> and they will be created before main() is called.
> 
> Any ideas ?
> Gerhard
> 
> -- 
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
> 
> 

-- 
 [ signature omitted ]