PySide Bugzilla Closed for New Bugs

PySide is now a Qt Add-on and uses the Qt Project's JIRA Bug Tracker instead of this Bugzilla instance. This Bugzilla is left for reference purposes.

Bug 320 - OR'ing Qt alignments doesn't work; adding them does
: OR'ing Qt alignments doesn't work; adding them does
Status: CLOSED FIXED
Product: PySide
Classification: Unclassified
Component: PySide
: 0.4.0
: PC Linux
: P5 normal
Assigned To: renato filho
:
:
:
  Show dependency treegraph
 
Reported: 2010-08-26 22:15 EEST by Dan Halbert
Modified: 2010-09-10 19:21 EEST (History)
8 users (show)

See Also:


Attachments
program showing problem (727 bytes, text/plain)
2010-08-26 22:15 EEST, Dan Halbert
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Dan Halbert 2010-08-26 22:15:22 EEST
Created attachment 68 [details]
program showing problem

This is slightly bizarre. See the test program below. Notice the how I combine
the TextAlignmentRole values, which you would think would turn out to be the
same. However, boolean-or'ing them does not seem to work, but adding them does.
Running the program should show identical alignments, but it does not.

If you replace PySide with PyQt4 (reverse the import comments), it works fine.

Perhaps this is a shiboken issue, as it seems to be some kind of type
conversion problem. I tried a simpler test case with setting text alignments
directly instead of in a model, but had trouble getting it to fail.

test program (also in attachment)
=================================

from PySide.QtCore import *
from PySide.QtGui import *
#from PyQt4.QtCore import *
#from PyQt4.QtGui import *

class Model(QAbstractTableModel):

    def columnCount(self, index):
        return 1

    def rowCount(self, index):
        return 2

    def data(self, index, role=Qt.DisplayRole):
        if role == Qt.DisplayRole:
            return str(index.row()+10)
        if role == Qt.TextAlignmentRole:
            if index.row() == 0:
                return Qt.AlignRight + Qt.AlignVCenter
            if index.row() == 1:
                return Qt.AlignRight | Qt.AlignVCenter
        return None


app = QApplication([])
listview = QTableView()
model = Model()
listview.setModel(model)

listview.show()
app.exec_()
Comment 1 Hugo Parente Lima 2010-09-03 11:02:03 EEST
fixed in commits:
shiboken/3fed4510716ad6444c77ecd50466f514e1f03848
pyside/823eec81c245f56cd2baf7c9fe0b1bf006500561