找回密码
 立即注册
收起左侧

qt 中这样的语句是什么意思?

2
回复
6300
查看
[复制链接]
累计签到:13 天
连续签到:1 天
来源: 2017-2-16 10:40:05 显示全部楼层 |阅读模式
1Qter豆
QHostInfo hostInfo = QHostInfo::formName(localHostName)
QHostInfo 的静态函数给它的一个对象赋值?没有先把hostInfo初始化吗?

回复

使用道具 举报

累计签到:14 天
连续签到:1 天
2017-2-16 13:42:16 显示全部楼层
就是一个静态函数而已,通过你传localHostName进去就实现初始化了.
回复

使用道具 举报

累计签到:25 天
连续签到:1 天
2017-2-16 14:57:24 显示全部楼层
QHostInfo QHostInfo::fromName ( const QString & name ) [static]
Looks up the IP address(es) for the given host name. The function blocks during the lookup which means that execution of the program is suspended until the results of the lookup are ready. Returns the result of the lookup in a QHostInfo object.
If you pass a literal IP address to name instead of a host name, QHostInfo will search for the domain name for the IP (i.e., QHostInfo will perform a reverse lookup). On success, the returned QHostInfo will contain both the resolved domain name and IP addresses for the host name.

意思就是你指定一个ip给QHostInfo检查,完了把查到的信息给你。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

公告
可以关注我们的微信公众号yafeilinux_friends获取最新动态,或者加入QQ会员群进行交流:190741849、186601429(已满) 我知道了