buc*_*uck 24
我不认为继承QLineEdit是正确的选择.如果你不需要,为什么要子类?您可以改为使用事件过滤器.查看QObject :: eventFilter.
例:
MyClass::MyClass() :
edit(new QLineEdit(this))
{
edit->installEventFilter(this);
}
bool MyClass::eventFilter(QObject* object, QEvent* event)
{
if(object == edit && event->type() == QEvent::FocusIn) {
// bring up your custom edit
return false; // lets the event continue to the edit
}
return false;
}
Run Code Online (Sandbox Code Playgroud)
您需要在扩展QLineEdit的新类中重新实现focusInEvent.以下链接将帮助您.
| 归档时间: |
|
| 查看次数: |
23575 次 |
| 最近记录: |