Thank you very much for your help I'll follow the bug and try to help as
much as possible!
Best regards
Ricardo
On Sun, Oct 30, 2011 at 20:35, Ben Breslauer <[email protected]> wrote:
> I've submitted bug 1040 for this. I just tested, and it's still an issue
> with 1.0.8.
>
> http://bugs.pyside.org/show_bug.cgi?id=1040
>
> Ben
>
>
> On Sun, Oct 30, 2011 at 6:46 PM, Ricardo Manriquez <
> [email protected]> wrote:
>
>> Thank you for your insight I hadn't noticed the brush overwritting
>> problem. I also had attached the Ui file but the name and extension
>> got mangled. Here I'm posting the full Ui file in plain text, with the
>> information your are giving me I can work around the bug and finish my
>> app but I hope that with your bug it can be solved for everyone.
>>
>> Thank you a lot for your time and good will
>> Best regards
>> Ricardo ManrĂquez
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <ui version="4.0">
>> <class>MainWindow</class>
>> <widget class="QMainWindow" name="MainWindow">
>> <property name="geometry">
>> <rect>
>> <x>0</x>
>> <y>0</y>
>> <width>236</width>
>> <height>97</height>
>> </rect>
>> </property>
>> <property name="windowTitle">
>> <string notr="true">MainWindow</string>
>> </property>
>> <widget class="QWidget" name="widget">
>> <layout class="QHBoxLayout" name="horizontalLayout">
>> <item>
>> <widget class="QTableWidget" name="tableWidget">
>> <row>
>> <property name="text">
>> <string notr="true">1</string>
>> </property>
>> </row>
>> <row>
>> <property name="text">
>> <string notr="true">2</string>
>> </property>
>> </row>
>> <column>
>> <property name="text">
>> <string notr="true">1</string>
>> </property>
>> </column>
>> <column>
>> <property name="text">
>> <string notr="true">2</string>
>> </property>
>> </column>
>> <item row="0" column="0">
>> <property name="text">
>> <string notr="true">Black FG Red BG</string>
>> </property>
>> <property name="background">
>> <brush brushstyle="SolidPattern">
>> <color alpha="255">
>> <red>255</red>
>> <green>0</green>
>> <blue>0</blue>
>> </color>
>> </brush>
>> </property>
>> </item>
>> <item row="0" column="1">
>> <property name="text">
>> <string notr="true">White FG Red BG</string>
>> </property>
>> <property name="background">
>> <brush brushstyle="SolidPattern">
>> <color alpha="255">
>> <red>255</red>
>> <green>0</green>
>> <blue>0</blue>
>> </color>
>> </brush>
>> </property>
>> <property name="foreground">
>> <brush brushstyle="NoBrush">
>> <color alpha="255">
>> <red>255</red>
>> <green>255</green>
>> <blue>255</blue>
>> </color>
>> </brush>
>> </property>
>> </item>
>> <item row="1" column="0">
>> <property name="text">
>> <string notr="true">Yellow FG Red BG</string>
>> </property>
>> <property name="background">
>> <brush brushstyle="SolidPattern">
>> <color alpha="255">
>> <red>255</red>
>> <green>0</green>
>> <blue>0</blue>
>> </color>
>> </brush>
>> </property>
>> <property name="foreground">
>> <brush brushstyle="NoBrush">
>> <color alpha="255">
>> <red>255</red>
>> <green>255</green>
>> <blue>0</blue>
>> </color>
>> </brush>
>> </property>
>> </item>
>> <item row="1" column="1">
>> <property name="text">
>> <string notr="true">Yellow FG Red BG</string>
>> </property>
>> <property name="background">
>> <brush brushstyle="SolidPattern">
>> <color alpha="255">
>> <red>255</red>
>> <green>0</green>
>> <blue>0</blue>
>> </color>
>> </brush>
>> </property>
>> <property name="foreground">
>> <brush brushstyle="NoBrush">
>> <color alpha="255">
>> <red>255</red>
>> <green>255</green>
>> <blue>0</blue>
>> </color>
>> </brush>
>> </property>
>> </item>
>> </widget>
>> </item>
>> </layout>
>> </widget>
>> </widget>
>> <resources/>
>> <connections/>
>> </ui>
>>
>> On 29/10/2011, Ben Breslauer <[email protected]> wrote:
>> > I can confirm this problem on my system. Can you send along the .ui file
>> > used to create table? I can submit a bug on your behalf once I have that
>> > file.
>> >
>> > The problem seems to be a bug in pyside-uic. It creates a brush for the
>> BG,
>> > then replaces it with the FG brush, and then applies that brush to both
>> the
>> > BG and FG. The background is white in the 2-4 cells because the FG brush
>> > style is set to QtCore.Qt.NoBrush, probably because text only uses the
>> > color, not the brush type (i.e. text cannot have a diagonal pattern, or
>> a
>> > gradient). Since this FG brush gets applied to the background, the
>> > background defaults to white. When the text color is not specified
>> (i.e. it
>> > defaults to black), then a FG brush is not created and the background
>> shows.
>> > I expect that if you were to manually specify the text color as black,
>> then
>> > the background color would always be white.
>> >
>> > Ben
>> >
>> > On Sun, Oct 16, 2011 at 9:10 PM, Ricardo Manriquez <
>> > [email protected]> wrote:
>> >
>> >> The problem goes like this I'm trying to get a table which looks like
>> >> a semaphore so for the dark colors I chose white text in Qt 4.7 using
>> >> C++ It works correctly just as It shows in Designer but when I execute
>> >> it with pyside the text color disables the background color. If chose
>> >> black as background and white as foreground the result is a white cell
>> >> with white text. The problem shows up in windows and linux.
>> >>
>> >> Please help me file a bug if it's necessary
>> >>
>> >> I'm attaching my code here, generated by pyside-uic
>> >>
>> >> # -*- coding: utf-8 -*-
>> >>
>> >> # Form implementation generated from reading ui file 'test.ui'
>> >> #
>> >> # Created: Sun Oct 16 21:58:39 2011
>> >> # by: pyside-uic 0.2.13 running on PySide 1.0.7
>> >> #
>> >> # WARNING! All changes made in this file will be lost!
>> >>
>> >> from PySide import QtCore, QtGui
>> >>
>> >> class Ui_MainWindow(object):
>> >> def setupUi(self, MainWindow):
>> >> MainWindow.setObjectName("MainWindow")
>> >> MainWindow.resize(236, 97)
>> >> MainWindow.setWindowTitle("MainWindow")
>> >> self.widget = QtGui.QWidget(MainWindow)
>> >> self.widget.setObjectName("widget")
>> >> self.horizontalLayout = QtGui.QHBoxLayout(self.widget)
>> >> self.horizontalLayout.setObjectName("horizontalLayout")
>> >> self.tableWidget = QtGui.QTableWidget(self.widget)
>> >> self.tableWidget.setObjectName("tableWidget")
>> >> self.tableWidget.setColumnCount(2)
>> >> self.tableWidget.setRowCount(2)
>> >> item = QtGui.QTableWidgetItem()
>> >> self.tableWidget.setVerticalHeaderItem(0, item)
>> >> self.tableWidget.verticalHeaderItem(0).setText("1")
>> >> item = QtGui.QTableWidgetItem()
>> >> self.tableWidget.setVerticalHeaderItem(1, item)
>> >> self.tableWidget.verticalHeaderItem(1).setText("2")
>> >> item = QtGui.QTableWidgetItem()
>> >> self.tableWidget.setHorizontalHeaderItem(0, item)
>> >> self.tableWidget.horizontalHeaderItem(0).setText("1")
>> >> item = QtGui.QTableWidgetItem()
>> >> self.tableWidget.setHorizontalHeaderItem(1, item)
>> >> self.tableWidget.horizontalHeaderItem(1).setText("2")
>> >> brush = QtGui.QBrush(QtGui.QColor(255, 0, 0))
>> >> brush.setStyle(QtCore.Qt.SolidPattern)
>> >> item = QtGui.QTableWidgetItem()
>> >> item.setBackground(brush)
>> >> self.tableWidget.setItem(0, 0, item)
>> >> self.tableWidget.item(0, 0).setText("Black FG Red BG")
>> >> brush = QtGui.QBrush(QtGui.QColor(255, 0, 0))
>> >> brush.setStyle(QtCore.Qt.SolidPattern)
>> >> brush = QtGui.QBrush(QtGui.QColor(255, 255, 255))
>> >> brush.setStyle(QtCore.Qt.NoBrush)
>> >> item = QtGui.QTableWidgetItem()
>> >> item.setBackground(brush)
>> >> item.setForeground(brush)
>> >> self.tableWidget.setItem(0, 1, item)
>> >> self.tableWidget.item(0, 1).setText("White FG Red BG")
>> >> brush = QtGui.QBrush(QtGui.QColor(255, 0, 0))
>> >> brush.setStyle(QtCore.Qt.SolidPattern)
>> >> brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
>> >> brush.setStyle(QtCore.Qt.NoBrush)
>> >> item = QtGui.QTableWidgetItem()
>> >> item.setBackground(brush)
>> >> item.setForeground(brush)
>> >> self.tableWidget.setItem(1, 0, item)
>> >> self.tableWidget.item(1, 0).setText("Yellow FG Red BG")
>> >> brush = QtGui.QBrush(QtGui.QColor(255, 0, 0))
>> >> brush.setStyle(QtCore.Qt.SolidPattern)
>> >> brush = QtGui.QBrush(QtGui.QColor(255, 255, 0))
>> >> brush.setStyle(QtCore.Qt.NoBrush)
>> >> item = QtGui.QTableWidgetItem()
>> >> item.setBackground(brush)
>> >> item.setForeground(brush)
>> >> self.tableWidget.setItem(1, 1, item)
>> >> self.tableWidget.item(1, 1).setText("Yellow FG Red BG")
>> >> self.horizontalLayout.addWidget(self.tableWidget)
>> >> MainWindow.setCentralWidget(self.widget)
>> >>
>> >> self.retranslateUi(MainWindow)
>> >> QtCore.QMetaObject.connectSlotsByName(MainWindow)
>> >>
>> >> def retranslateUi(self, MainWindow):
>> >> __sortingEnabled = self.tableWidget.isSortingEnabled()
>> >> self.tableWidget.setSortingEnabled(False)
>> >> self.tableWidget.setSortingEnabled(__sortingEnabled)
>> >>
>> >>
>> >> if __name__ == "__main__":
>> >> import sys
>> >> app = QtGui.QApplication(sys.argv)
>> >> MainWindow = QtGui.QMainWindow()
>> >> ui = Ui_MainWindow()
>> >> ui.setupUi(MainWindow)
>> >> MainWindow.show()
>> >> sys.exit(app.exec_())
>> >>
>> >> _______________________________________________
>> >> PySide mailing list
>> >> [email protected]
>> >> http://lists.pyside.org/listinfo/pyside
>> >>
>> >>
>> >
>>
>
>
_______________________________________________
PySide mailing list
[email protected]
http://lists.pyside.org/listinfo/pyside