mirror of
https://gitlab.com/eql/lqml.git
synced 2025-12-10 04:20:17 -08:00
revision
This commit is contained in:
parent
129d32ae85
commit
d57c4654b7
1 changed files with 8 additions and 2 deletions
|
|
@ -26,7 +26,7 @@ QObject* ini() {
|
|||
if (qt == nullptr) {
|
||||
qt = new QT;
|
||||
#ifdef PLUGIN
|
||||
ini_lisp();
|
||||
ini_lisp(); // see 'ecl_fun_plugin.h'
|
||||
#endif
|
||||
}
|
||||
return qt;
|
||||
|
|
@ -316,16 +316,22 @@ QVariant QT::localIp() {
|
|||
// 172.16.*.*
|
||||
// 192.168.*.*
|
||||
QList<QHostAddress> addresses = QNetworkInterface::allAddresses();
|
||||
QStringList ips;
|
||||
for (QHostAddress adr : qAsConst(addresses)) {
|
||||
if (adr.protocol() == QAbstractSocket::IPv4Protocol) {
|
||||
QString ip(adr.toString());
|
||||
if (ip.startsWith("10.") ||
|
||||
ip.startsWith("172.16.") ||
|
||||
ip.startsWith("192.168.")) {
|
||||
return ip;
|
||||
ips << ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!ips.isEmpty()) {
|
||||
// hack for rare, ambiguous cases
|
||||
ips.sort();
|
||||
return ips.first();
|
||||
}
|
||||
return QVariant();
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue