Hi.
I'm trying the auto-connect feature in my code but i don't arrive to get it working.
this is my code:
File .h
Q_OBJECT
private:
TColorComboBox* CBoxTraitCouleurs;
....
private Q_SLOTS:
void on_CBoxTraitCouleurs_activated(int);
....
};
class TBarAffichage : public QToolBar{
Q_OBJECT
private:
TColorComboBox* CBoxTraitCouleurs;
....
private Q_SLOTS:
void on_CBoxTraitCouleurs_activated(int);
....
};
To copy to clipboard, switch view to plain text mode
File .cpp:
TBarAffichage
::TBarAffichage(QWidget *parent
): CBoxTraitCouleurs (new TColorComboBox(this)) {}
...
void TBarAffichage::on_CBoxTraitCouleurs_activated(int i){
qDebug() << "activated";
}
...
TBarAffichage::TBarAffichage(QWidget *parent):
QToolBar(parent),
CBoxTraitCouleurs (new TColorComboBox(this)) {}
...
void TBarAffichage::on_CBoxTraitCouleurs_activated(int i){
qDebug() << "activated";
}
...
To copy to clipboard, switch view to plain text mode
The TColorComboBox.h:
Q_OBJECT
public:
};
class TColorComboBox : public QComboBox{
Q_OBJECT
public:
TColorComboBox(QWidget *widget = 0):QComboBox(widget){}
};
To copy to clipboard, switch view to plain text mode
When i select the color combobox (CBoxTraitCouleurs) and change it (from red to white) the qDebug isn't launched.
I've tried with others objects and signals but nothing works.
What i'm doing wrong?
I've to put something into the .pro?
I've to add something to the constructor?
Thanks
Bookmarks