Я погуглил и нашел эту ветку форума , в которой OP, похоже, имел ту же проблему, что и я. Вопрос в том, как мне унаследовать от QLabel
и повторно реализовать событие mousepressed? Я предполагаю, что это будет примерно так:
class CustomLabel : public QLabel
{
public:
//what about the constructors?
void mousePressEvent ( QMouseEvent * ev );
}
void CustomLabel::mousePressEvent ( QMouseEvent * ev )
{
QPoint = ev->pos();
//I want to have another function get the event position.
//How would I achieve this? It's void!
//Is there perhaps some way to set up a signal and slot with the position?
}
И после того, как я успешно создал класс CustomLabel
, как я смогу поместить его в представление дизайна?