私はグーグルで調べて、this forum threadが見つかりました。そのOPには私が抱えている問題がありました。質問は、私はQLabel
からどのように継承し、mousepressedイベントを再実装するのですか?qt内のラベルのマウスクリック位置を取得する
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
クラスを作成した後、どのように私は、デザインビューでそれを置くことができるだろう:私はそれがこのようなものになるだろう推測していますか?
あなたがメインウィンドウに戻ってラベルを置くの第二の溶液を見つかりましたか? – arqam