title: Qt - error: invalid use of member function (did you forget the '()' ?)
body: <p>Hello I'm new on Qt developing,</p>
  
  <p>I just want to porting some c++ code to Qt. On c++ it can succesful build, but when i try to port code to Qt it show </p>
  
  <p><strong>error: invalid use of member function (did you forget the '()' ?)</strong></p>
  
  <p>This is my line of code that was error : </p>
  
  <p><code>capture_loop(pdev, packets, (pcap_handler)parse_packet);</code></p>
  
  <p>And this is my function :</p>
  
  <pre><code>void MainWindow::capture_loop(pcap_t* pdev, int packets, pcap_handler func){
  int linktype;
  
  // Determine the datalink layer type.
  if ((linktype = pcap_datalink(pdev)) &lt; 0)
  {
      printf("pcap_datalink(): %s\n", pcap_geterr(pdev));
      return;
  }
  
  // Set the datalink layer header size.
  switch (linktype)
  {
  case DLT_NULL:
          linkhdrlen = 4;
      break;
  
  case DLT_EN10MB:
      linkhdrlen = 14;
      break;
  
  case DLT_SLIP:
  case DLT_PPP:
      linkhdrlen = 24;
      break;
  
  default:
      printf("Unsupported datalink (%d)\n", linktype);
      return;
  }
  
  // Start capturing packets.
  if (pcap_loop(pdev, packets, func, 0) &lt; 0)
      printf("pcap_loop failed: %s\n", pcap_geterr(pdev));}
  void MainWindow::parse_packet(u_char *user, struct pcap_pkthdr *packethdr,u_char *packetptr){
  struct ip* iphdr;
  struct icmphdr* icmphdr;
  struct tcphdr* tcphdr;
  struct udphdr* udphdr;
  char iphdrInfo[256], srcip[256], dstip[256];
  unsigned short id, seq;
  
  // Skip the datalink layer header and get the IP header fields.
  packetptr += linkhdrlen;
  iphdr = (struct ip*)packetptr;
  strcpy(srcip, inet_ntoa(iphdr-&gt;ip_src));
  strcpy(dstip, inet_ntoa(iphdr-&gt;ip_dst));
  sprintf(iphdrInfo, "ID:%d TOS:0x%x, TTL:%d IpLen:%d DgLen:%d",ntohs(iphdr-&gt;ip_id), iphdr-&gt;ip_tos, iphdr-&gt;ip_ttl,4*iphdr-&gt;ip_hl, ntohs(iphdr-&gt;ip_len));
  
  // Advance to the transport layer header then parse and display
  // the fields based on the type of hearder: tcp, udp or icmp.
  packetptr += 4*iphdr-&gt;ip_hl;
  switch (iphdr-&gt;ip_p)
  {
  case IPPROTO_TCP:
      tcphdr = (struct tcphdr*)packetptr;
      printf("TCP  %s:%d -&gt; %s:%d\n", srcip, ntohs(tcphdr-&gt;source),dstip, ntohs(tcphdr-&gt;dest));
      printf("%s\n", iphdrInfo);
      printf("%c%c%c%c%c%c Seq: 0x%x Ack: 0x%x Win: 0x%x TcpLen: %d\n",
             (tcphdr-&gt;urg ? 'U' : '*'),
             (tcphdr-&gt;ack ? 'A' : '*'),
             (tcphdr-&gt;psh ? 'P' : '*'),
             (tcphdr-&gt;rst ? 'R' : '*'),
             (tcphdr-&gt;syn ? 'S' : '*'),
             (tcphdr-&gt;fin ? 'F' : '*'),
             ntohl(tcphdr-&gt;seq), ntohl(tcphdr-&gt;ack_seq),
             ntohs(tcphdr-&gt;window), 4*tcphdr-&gt;doff);
      break;
  
  case IPPROTO_UDP:
      udphdr = (struct udphdr*)packetptr;
      printf("UDP  %s:%d -&gt; %s:%d\n", srcip, ntohs(udphdr-&gt;source),
             dstip, ntohs(udphdr-&gt;dest));
      printf("%s\n", iphdrInfo);
      break;
  
  case IPPROTO_ICMP:
      icmphdr = (struct icmphdr*)packetptr;
      printf("ICMP %s -&gt; %s\n", srcip, dstip);
      printf("%s\n", iphdrInfo);
      memcpy(&amp;id, (u_char*)icmphdr+4, 2);
      memcpy(&amp;seq, (u_char*)icmphdr+6, 2);
      printf("Type:%d Code:%d ID:%d Seq:%d\n", icmphdr-&gt;type, icmphdr-&gt;code,
             ntohs(id), ntohs(seq));
      break;
  }
  printf("=============================================================\n\n");}
  </code></pre>