Hi, i'm a newbie in QT, and i'm working in a proyect with it. now i need to get a simple MouseEvent but i don't get it.
There is a class called ListaMensajes where QScrollArea is placed. Inside i can load PanelTx objects.
The idea is to select the PanelTx object by clicking over each one.
protected:
private:
Ui::PanelTxClass ui;
protected:
void clickPanelTxEvent(QMouseEvent *e);
private:
Ui::PanelTxClass ui;
To copy to clipboard, switch view to plain text mode
and the definition ..
PanelTx
::PanelTx (CArincMsgData
*msg, ListaMensajes
&listaMensajes,
QWidget *parent
): QWidget(parent
), m_cListaMensajes
(listaMensajes
), m_pMessage
(msg
) {
ui.setupUi(this);
m_pDialogPropiedades = 0;
loadValues ();
colorPanelTx(m_pMessage->isEnabledTx ()); //poner color activo-desactivo
}
PanelTx::~PanelTx()
{
}
.............
{
if (e->button() == Qt::LeftButton)
{
//this line is just to check it works
}
else if (e->button() == Qt::RightButton)
{
......
}
}
PanelTx::PanelTx (CArincMsgData *msg, ListaMensajes &listaMensajes, QWidget *parent)
: QWidget(parent), m_cListaMensajes (listaMensajes), m_pMessage (msg)
{
ui.setupUi(this);
m_pDialogPropiedades = 0;
loadValues ();
colorPanelTx(m_pMessage->isEnabledTx ()); //poner color activo-desactivo
}
PanelTx::~PanelTx()
{
}
.............
void PanelTx::clickPanelTxEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton)
{
//this line is just to check it works
this->setPalette(QPalette(Qt::white));
}
else if (e->button() == Qt::RightButton)
{
......
}
}
To copy to clipboard, switch view to plain text mode
the line:
this->setPalette(QPalette(Qt::white));
works perfectly with this widget cause im using it in other parts, but i can't get the handler work for the QMouseEvents
could anybody help me?
thanks
Bookmarks