Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. error qdnslookup
Forum Updated to NodeBB v4.3 + New Features

error qdnslookup

Scheduled Pinned Locked Moved Unsolved General and Desktop
4 Posts 2 Posters 969 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • RIVOPICOR Offline
    RIVOPICOR Offline
    RIVOPICO
    wrote on last edited by
    #1

    Hi i use this code:
    void MainWindow::lookupServers()
    {
    // Create a DNS lookup.
    QDnsLookup dns = new QDnsLookup(this);
    connect(dns, SIGNAL(finished()),
    this, SLOT(handleServers()));

    // Find the XMPP servers for gmail.com
    dns->setType(QDnsLookup::SRV);
    dns->setName("_xmpp-client._tcp.gmail.com");
    dns->lookup();
    }

    Errors:
    error: conversion from 'QDnsLookup*' to non-scalar type 'QDnsLookup' requested
    QDnsLookup dns = new QDnsLookup(this);
    error: no matching function for call to 'MainWindow::connect(QDnsLookup&, const char*, MainWindow* const, const char*)'
    this, SLOT(handleServers()));
    C:\Qt\Qt5.2.0\Tools\QtCreator\bin\qdnslookup\mainw indow.cpp:30: error: base operand of '->' has non-pointer type 'QDnsLookup'
    dns->setType(QDnsLookup::SRV);
    ^

    I am only trying to do one minimal application with this class, some suggestions???

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Here: QDnsLookup dns = new QDnsLookup(this); you are missing a * before dns.

      Not that doing like this you are going to leak memory since you don't delete it anywhere.

      Or if you are following the example code from QDnsLookup, you are shadowing a member variable.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • RIVOPICOR Offline
        RIVOPICOR Offline
        RIVOPICO
        wrote on last edited by
        #3

        Lol now works fine with *dns so i included this pointer becquse if not i leak the memory
        is it right?
        But i have one question about this: I want to show the servers detected since GUI application with signal and slots, What do you think? Some suggestion? Thx a lot for your help Sir

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Take a look at the example code here for the handling.

          Sure you can. You have to process the answer you got from your lookup and build e.g. a QStringList with information you want to show and then emit a signal with it e.g. void dnsInformationChanged(const QStringList& dnsInformation);.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved