<div dir="ltr">Hi Phil,<div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 2, 2015 at 11:11 PM, Phil Thompson <span dir="ltr"><<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><span class="">On 02/04/2015 7:37 pm, Baz Walter wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On 02/04/15 18:33, Phil Thompson wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On 02/04/2015 5:38 pm, Baz Walter wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
On 02/04/15 17:18, Andreas Pakulat wrote:<br>
<br>
QAbstractItemModel.parent(<u></u>QModelIndex) overloads QObject.parent(), so<br>
it is a bug in PyQt4/5 that it doesn't support the latter.<br>
</blockquote>
<br>
Eh? The QAbstractItemModel parent() hides the QObject parent().<br>
</blockquote>
<br>
No, it shouldn't do. A QAbstractItemModel is a QObject. It takes<br>
another QObject as its parent, not a QModelIndex:<br>
<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
from PyQt4 import QtCore, QtGui<br>
app = QtGui.QApplication([])<br>
model = QtGui.QStandardItemModel(app)<br>
model.parent()<br>
</blockquote></blockquote></blockquote>
<PyQt4.QtGui.QApplication object at 0x7f397aae0c18><br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
model.parent(QtCore.<u></u>QModelIndex())<br>
</blockquote></blockquote></blockquote>
<PyQt4.QtCore.QModelIndex object at 0x7f3975078358><br>
<br>
QAbstractItemModel::parent(<u></u>QModelIndex) is virtual, but<br>
QObject::parent() isn't, so it cannot not be overridden.<br>
</blockquote>
<br></span>
So the attached C++ code should compile?</blockquote><div><br></div><div>Not without a fix for qfilesystemmodel.h. qabstractitemmodel.h as well as qstandarditemmodel.h (and probably other qaim subclasses in qt) explicitly 'reuse' QObject::parent using something like:</div><div><br></div><div>#ifdef Q_NO_USING_KEYWORD</div><div> inline QObject *parent() const { return QObject::parent(); }</div><div>#else</div><div> using QObject::parent;</div><div>#endif</div><div><br></div><div>For qfilesystemmodel.h this is missing and hence one cannot call QObject::parent() with a pointer or instance of it.</div><div><br></div><div>Andreas</div></div></div></div>