Q:

QT4 / C++ : no such signals problem

I have a small program to show devices and capture any packets, with GUI.I use QT Designer and Netbeans 6.9 to draw the GUI,but the problem comes when i try to implement a signal/slot. Basically when a combo box is selected, a QlineEdit would show a MAC address of the selected device. 
The error:
 Object::connect: No such signal QComboBox::selectedDev(int) in MainGUI.cpp:21
Object::connect:  (sender name:   'comboBox')
Object::connect:  (receiver name: 'MYMACBOX')

MainGUI.h
#ifndef _MAINGUI_H
#define    _MAINGUI_H

#include "ui_MainGUI.h"

class MainGUI : public QDialog {
    Q_OBJECT
public:
    MainGUI();
    virtual ~MainGUI();
    void displayDevices();
    void selectedValue();
public slots:
    void showmac(int);

    signals:
    void selectedDev(int);
private:
    Ui::MainGUI widget;
};

MainGUI.cpp
#include "MainGUI.h"
#include "pcapCapture.h"
#include <pcap.h>
#include <iostream>
MainGUI::MainGUI() // constructor
{
    widget.setupUi(this);
    //show devices here    
  QObject::connect(widget.comboBox,SIGNAL(selectedDev(int)),widget. MYMACBOX,SLOT(showmac(int)));
}
void MainGUI::showmac(int value)
{
   //show MAC address here
}

I don't know whts the problem here, i tried different ways to get around this problem, but they won't work. Apologies for any obvious mistakes here, i am still new to QT4( and libpcap). 

A:

QComboBox does not have a selectedDev(int) signal.  The documentation provides a handy list of signals and slots for every Qt class: QComboBox documentation
You have defined the selectedDev(int) signal in your MainGUI class so your call to connect should be like this: (the arguments to connect are: signal source, signal, slot or signal source, slot or signal.) 
QObject::connect(this,SIGNAL(selectedDev(int)),widget. MYMACBOX,SLOT(showmac(int)));

But this won't have any effect as there's nothing firing the selectedDev(int) signal.  
Perhaps you could try to connect the combo box's currentIndexChanged(int) to your selectedDev(int) signal, like this:
QObject::connect(widget.comboBox,SIGNAL(currentIndexChanged(int)),this ,SIGNAL(selectedDev(int)));

What I'm doing here is firing the selectedDev(int) signal of your MainGUI when the combo box index changes. 
If you simply want to execute showmac(int) when the user select something in the combo box you can't do it more straightforward than this:
QObject::connect(widget.comboBox,SIGNAL(currentIndexChanged(int)),widget. MYMACBOX,SLOT(showmac(int)));

As it seams that you are a bit confused about signals & slots here are some links that might help:
Signals & Slots from the Qt documentation
An introductory Qt article from my blog that explains how a very simple Qt application works (it has nothing to do with it being my blog but it's a nice overview of a Qt application for anyone starting with Qt)

