Results 1 to 4 of 4

Thread: Show the name of my pc with QT

  1. #1
    Join Date
    Sep 2016
    Posts
    78
    Thanked 1 Time in 1 Post
    Qt products
    Qt5

    Default Show the name of my pc with QT

    Hi i want to show the name of my pc in one application i did for myself only. I can show my user with QDir::homepath() But i can't show my for example name of pc. Thx in advance.

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Show the name of my pc with QT

    I don't think there is any API in Qt for retrieving the hostname, you will have to consult your operating system's API documentation for that.

    Cheers,
    _

  3. #3
    Join Date
    Dec 2009
    Location
    New Orleans, Louisiana
    Posts
    791
    Thanks
    13
    Thanked 153 Times in 150 Posts
    Qt products
    Qt5
    Platforms
    MacOS X

    Default Re: Show the name of my pc with QT

    You can try QHostInfo::localHostName() or QSysInfo::machineHostName() and see if those return what you're looking for.
    I write the best type of code possible, code that I want to write, not code that someone tells me to write!

  4. The following user says thank you to jefftee for this useful post:

    anda_skoa (18th October 2016)

  5. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Show the name of my pc with QT

    Oh, the latter looks interesting, nevery seen it before

    Cheers,
    _

Similar Threads

  1. show() vs showFullScreen()
    By antweb in forum Qt Programming
    Replies: 1
    Last Post: 24th October 2015, 17:12
  2. Qt.inputMethod.show () doesn't show any keyboard
    By TheIndependentAquarius in forum Qt Quick
    Replies: 0
    Last Post: 23rd February 2015, 11:45
  3. Replies: 4
    Last Post: 18th October 2013, 18:15
  4. Replies: 3
    Last Post: 12th July 2010, 14:12
  5. How to show the widget?
    By kommu in forum Qt Programming
    Replies: 1
    Last Post: 21st October 2008, 09:43

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.