I'm using the QT property system and I want to run a particular function as soon as a property is modified. I followed the [Qt documentation](http://doc.qt.io/qt-4.8/properties.html) to set up my property and its different "slots" (READ, WRITE, NOTIFY):

```
class MyClass : public QObject
{
Q_OBJECT
Q_PROPERTY(Priority priority READ priority WRITE setPriority NOTIFY priorityChanged)
Q_ENUMS(Priority)

public:
MyClass(QObject *parent = 0);
~MyClass();

enum Priority { High, Low, VeryHigh, VeryLow };

void setPriority(Priority priority)
{
    m_priority = priority;
    emit priorityChanged(priority);
}
Priority priority() const
{ return m_priority; }

signals:
void priorityChanged(Priority);

private:
Priority m_priority;
};

```

If I understood properly, I should then use the `priorityChanged()` function to achieve what I want. But if I define the function in my mainwindow.cpp:

```
void MainWindow::priorityChanged() {
    //my code
}

```

I get the following error message: 

> 
> fatal error LNK1169: one or more multiply defined symbols found
> 
> 
> 

So I tried instead to write my code in the header, like this :

```
signals:
void priorityChanged(Priority) {
    //my code
}

```

but this doesn't work neither.

Any help would be appreciated, thanks. :)