[PyQt] pyuic does NOT generate non-default property value

Zhaohao Liang liangvls at gmail.com
Tue Dec 29 08:09:33 GMT 2009


A QListWIdgetItem has property "flags" whose default is "Selectable |
DragEnable | UserCheckEnable | Enabled" as total bitwise is 53

If i change the flags value, pyuic will not generate the change to .py

###bug.ui:

<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
 <class>Dialog</class>
 <widget class="QDialog" name="Dialog">
  <property name="geometry">
   <rect>
    <x>0</x>
    <y>0</y>
    <width>400</width>
    <height>300</height>
   </rect>
  </property>
  <property name="windowTitle">
   <string>Dialog</string>
  </property>
  <widget class="QListWidget" name="listWidget">
   <property name="geometry">
    <rect>
     <x>90</x>
     <y>40</y>
     <width>256</width>
     <height>192</height>
    </rect>
   </property>
   <item>
    <property name="text">
     <string>New Item</string>
    </property>
    <property name="flags">

<set>ItemIsSelectable|ItemIsEditable|ItemIsDragEnabled|ItemIsUserCheckable|ItemIsEnabled</set>
    </property>
   </item>
  </widget>
 </widget>
 <resources/>
 <connections/>
</ui>

####bug.py:

# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'bug.ui'
#
# Created: Tue Dec 29 15:47:04 2009
#      by: PyQt4 UI code generator 4.6.2
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

class Ui_Dialog(object):
    def setupUi(self, Dialog):
        Dialog.setObjectName("Dialog")
        Dialog.resize(400, 300)
        self.listWidget = QtGui.QListWidget(Dialog)
        self.listWidget.setGeometry(QtCore.QRect(90, 40, 256, 192))
        self.listWidget.setObjectName("listWidget")
        QtGui.QListWidgetItem(self.listWidget)

        self.retranslateUi(Dialog)
        QtCore.QMetaObject.connectSlotsByName(Dialog)

    def retranslateUi(self, Dialog):
        Dialog.setWindowTitle(QtGui.QApplication.translate("Dialog",
"Dialog", None, QtGui.QApplication.UnicodeUTF8))
        __sortingEnabled = self.listWidget.isSortingEnabled()
        self.listWidget.setSortingEnabled(False)

 self.listWidget.item(0).setText(QtGui.QApplication.translate("Dialog", "New
Item", None, QtGui.QApplication.UnicodeUTF8))
        self.listWidget.setSortingEnabled(__sortingEnabled)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20091229/2a002626/attachment-0001.html


More information about the PyQt mailing list