Hi list Fixing bug 913 [1] I noticed some differences on our QUiTools.load() function to what should be expected by people using PyQt4.uic.loadUi function, pyside- uic or pyuic4, I'll try to explain both behaviors and then let list choose if I can commit the fix or let the different behavior live.
The example:
Suppose an ui file like the one on bug 913 [1] with a QTabWidget with a page
and a QLineEdit inside that page. The QTabWidget was named "tabWidget", the
page was named "tab" and the QLineEdit was named "le_first".
On PyQt4 uic.loadUi, pyside-uic and pyuic4 you access those widgets direct
from the root widget no matter if they are a direct child of the root widget
or not, e.g.:
wdg = load_ui_file("myui.ui") # load the ui using PyQt4 uic.loadUi, pyside-uic
# or pyuic4
print wdg.tab # works!
print wdg.tabWidget # works!
print wdg.le_first # works!
This is the default behavior also on C++ because it decouples the Ui structure
from the code using it, so you can move your widgets from a frame to another
without worry about the code using it.
Now what happens to our version of QUiTools.load(), or at least what should
happen, because as seen on bug 913 [1] it's not fully working.
loader = QUiLoader()
wdg = loader.load("myui.ui")
print wdg.tabWidget # works!
print wdg.tabWidget.tab # works (if bug 913 gets fixed)
print wdg.tabWidget.tab.le_first # works (if bug 913 gets fixed)!
As you had noticed my opinion is a bit biased =], and I prefer the first
choice for three reasons:
- Compatibility with PyQt4.
- QtUiTools keeps the same behavior of pyside-uic.
- Decouple the Ui structure from the code using it.
However as pointed me by Renato I can't just commit these changes without
further advice on mailing list because it can affect code depending on this
buggy behavior.
The fix is already done since yesterday, just waiting for you opinions about
this issue to know if I should commit them or not..... should I?
Regards.
[1] http://bugs.pyside.org/show_bug.cgi?id=913
--
Hugo Parente Lima
INdT - Instituto Nokia de Tecnologia
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ PySide mailing list [email protected] http://lists.pyside.org/listinfo/pyside
