[Qt-interest] Get the logged-in user name?

Konrad Rosenbaum konrad at silmor.de
Wed Nov 4 11:56:40 CET 2009


Hi,

On Wednesday 04 November 2009, Robert Caldecott wrote:
> Is there a way I can get the name of the logged-in user in Qt?  Under
> Windows I can use the GetUserName or GetUserNameEx API calls but I
> wondered if Qt exposes this information anywhere.

No, you have to use platform dependent functions. Depending on how serious 
you take this task a simple getenv (X11: "USER", Win: "USERNAME") could be 
enough and is pretty portable (and can also portably be manipulated by the 
user).


	Konrad
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part.
Url : http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091104/e2159659/attachment.bin 


More information about the Qt-interest-old mailing list