If I write the following:
QValidator *validator = new QRegExpValidator(regExp, this);
What does this mean here? 开发者_如何学PythonWhat is it referring to? If I don't use it what effect will occur?
this is a pointer to the current class where validator is declared in.
its there to let QRegExpValidator know who is the parent of validator so whenever the parent is deleted, so as validator. this way you dont need to delete it manually.
More about the this pointer, see here
加载中,请稍侯......
精彩评论