I also want to do the same thing and I have approached to implement this thing is, I subclass the QComboBox and add some my custom slot and signal.
header file
#ifndef _MY_COMBO_BOX_H
#define _MY_COMBO_BOX_H
#include <qobject.h>
#include <qcombobox.h>
//***********Defination of OdyComboBox****************
{
Q_OBJECT
public:
CMyComboBox
( int row,
int column,
QWidget * parent,
const char * name
= 0 ) ;
signals:
void activated
(int row,
int column,
const QString & string
);
public slots:
void reEmitActivated
(const QString &);
private:
int row;
int column;
};
#endif
#ifndef _MY_COMBO_BOX_H
#define _MY_COMBO_BOX_H
#include <qobject.h>
#include <qcombobox.h>
//***********Defination of OdyComboBox****************
class CMyComboBox : public QComboBox
{
Q_OBJECT
public:
CMyComboBox ( int row, int column, QWidget * parent, const char * name = 0 ) ;
signals:
void activated (int row, int column, const QString & string);
public slots:
void reEmitActivated(const QString &);
private:
int row;
int column;
};
#endif
To copy to clipboard, switch view to plain text mode
and source File
//***********Implementation of OdyComboBox****************
CMyComboBox
::CMyComboBox (int row,
int column,
QWidget * parent,
const char * name
) : QComboBox( parent, name
), row
(row
), column
(column
) {
setPaletteBackgroundColor( Qt::white );
connect( this,
SIGNAL(activated
(const QString &)),
this,
SLOT(reEmitActivated
(const QString &) ));
}
void CMyComboBox
::reEmitActivated(const QString & string
) { emit activated( row, column, string );
}
//***********Implementation of OdyComboBox****************
CMyComboBox::CMyComboBox (int row, int column, QWidget * parent, const char * name )
: QComboBox( parent, name ), row(row), column(column) {
setPaletteBackgroundColor( Qt::white );
connect( this, SIGNAL(activated (const QString &)), this, SLOT(reEmitActivated(const QString &) ));
}
void CMyComboBox::reEmitActivated(const QString & string) {
emit activated( row, column, string );
}
To copy to clipboard, switch view to plain text mode
Bookmarks