How to change computer name using QT
-
wrote on 30 Jul 2018, 05:12 last edited by novell86
Hi all!
I am starting in qt programming, and want to know how to change computer name with using of this framework. I have tried to execute QHostInfo::setHostName, but it does not take some effect... -
Hi all!
I am starting in qt programming, and want to know how to change computer name with using of this framework. I have tried to execute QHostInfo::setHostName, but it does not take some effect... -
wrote on 30 Jul 2018, 05:50 last edited by
@novell86 said in How to change computer name using QT:
QHostInfo::setHostName
I'm not sure that does what you think, I haven't really played there, I just use addresses.
I'm pretty sure that HostInfo is more for querying the connection endpoint and not an api to change the netbios name or anything.http://doc.qt.io/qt-5/qhostinfo.html#localHostName
http://doc.qt.io/qt-5/qsysinfo.html#machineHostNameTo do that you could maybe implement OS calls:
https://linux.die.net/man/2/sethostname
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724931(v=vs.85).aspxSomeone else may come along with something more solid... that's where I'd be looking, maybe search Qt code for api calls like that? Dunno. Pretty sure this isn't the class you are looking for this though.
-
Hi,
@6thC is correct, QHostInfo is used for host name lookups.
Modifying your machine host name is outside of Qt's scope and you will have to use his suggestions.
-
Hi all!
I am starting in qt programming, and want to know how to change computer name with using of this framework. I have tried to execute QHostInfo::setHostName, but it does not take some effect...wrote on 30 Jul 2018, 06:45 last edited byThis post is deleted! -
wrote on 30 Jul 2018, 08:18 last edited by
Thank you, guys.
I think the 6thC'th decision will help me.
Solved.
1/7