Question: I'm new in Qt and have a question.

I have `QLabel` and `QLineEdit` objects, and when `QLabel` text is clicked on, I want to set this text in `QLineEdit`.

Also I have read that `QLabel` has not clicked signal.

Can you explain how can I do this and write code for me ?!

Answer: 
Either style another type of QWidget such as a specific QPushButton to look like a QLabel and use its clicked() signal or inherit QLabel yourself and emit your own clicked() signal. 

See this example:
<https://wiki.qt.io/Clickable_QLabel>

If you choose the latter option you can pass the text in the signal. Then connect the necessary signals/slots up between the QLabel and the QLineEdit like so:

```
QObject::connect(&label, SIGNAL(clicked(const QString& text)),
                 &lineEdit, SLOT(setText(const QString& text)));

```
You need to create one Custom Label class, which will inherit `QLabel`. Then you can use `MouseButtonRelease` event to check clicking of Label and `emit` your custom signal and catch in one `SLOT`. 

Your `.h` file will be as below:

```
class YourLabelClass : public QLabel{

signals:
    void myLabelClicked();       // Signal to emit 

public slots:
    void slotLabelClicked();    // Slot which will consume signal 

protected:
    bool event(QEvent *myEvent); // This method will give all kind of events on Label Widget    
};

```

In your `.cpp` file, your constructor will connect signal & slot as below :

```
YourLabelClass :: YourLabelClass(QWidget* parent) : QLabel(parent) {
   connect(this, SIGNAL(myLabelClicked()), this, SLOT(slotLabelClicked()));
}

```

Remaining `event` method and `SLOT` method will be implemented as below:

```
bool YourLabelClass :: event(QEvent *myEvent)  
{
    switch(myEvent->type())
    {        
        case(QEvent :: MouseButtonRelease):   // Identify Mouse press Event
        {
            qDebug() << "Got Mouse Event";
            emit myLabelClicked();
            break;
        }
    }
    return QWidget::event(myEvent);
}

void YourLabelClass  :: slotLabelClicked()   // Implementation of Slot which will consume signal
{
    qDebug() << "Clicked Label";
}

```

For Changing a Text on `QLineEdit`, you need to create a Custom Class and share object pointer with custom `QLabel` Class. Please check test code at [this link](https://drive.google.com/file/d/0B3m9ig6-SoCfbi1nYTZHcE1zNVU/view?usp=sharing)