#
# Excerpt output from pyuic
#
self.History.setAlternatingRowColors(True)
self.History.setTextElideMode(QtCore.Qt.ElideNone)
self.History.setWordWrap(True)
self.History.setObjectName("History")
self.History.setColumnCount(3)
self.History.setRowCount(0)
self.History.setHorizontalHeaderItem(0, item)
self.History.setHorizontalHeaderItem(1, item)
self.History.setHorizontalHeaderItem(2, item)
self.verticalLayout_10.addWidget(self.History)
#
# from the Databaseviewer
#
widget = self.ui.History
widget.clearContents()
# read the story from database
story = self.getHistory()
widget.setRowCount(len(story))
remember_sorting = widget.isSortingEnabled()
widget.setSortingEnabled(False)
for index_line, items in enumerate(story):
id, first_created, last_updated, memo, remind = items
widg1 = (first_created and first_created.strftime("%Y%m%d %H:%M") ) or ""
widg2 = (remind and remind.strftime("%Y%m%d %H:%M") ) or ""
widg3 = memo or ""
for index_col, widgetitem in enumerate( (widg1, widg2, widg3) ):
it
= QtCore.
QString( unicode
( widgetitem
) ) it.
setData(QtCore.
Qt.
UserRole, QtCore.
QVariant(id
)) widget.setItem(index_line , index_col, it)
if index_col == 2:
pol.setHeightForWidth(True)
pol.setVerticalStretch( 9999 )
it.
setWordWrapMode( QtGui.
QTextOption.
WrapAtWordBoundaryOrAnywhere ) it.
setLineWrapMode( QtGui.
QTextEdit.
WidgetWidth ) it.setSizePolicy( pol )
it.
setPlainText( QtCore.
QString( unicode
( widgetitem
))) print it.sizePolicy().horizontalPolicy(), it.sizePolicy().verticalPolicy()
print it.sizePolicy().horizontalStretch(), it.sizePolicy().verticalStretch()
widget.setCellWidget( index_line, index_col, it )
else:
pass
widget.resizeColumnsToContents()
widget.resizeRowsToContents()
#
# Excerpt output from pyuic
#
self.History = QtGui.QTableWidget(self.groupBox_9)
self.History.setAlternatingRowColors(True)
self.History.setSelectionBehavior(QtGui.QAbstractItemView.SelectItems)
self.History.setTextElideMode(QtCore.Qt.ElideNone)
self.History.setWordWrap(True)
self.History.setObjectName("History")
self.History.setColumnCount(3)
self.History.setRowCount(0)
item = QtGui.QTableWidgetItem()
self.History.setHorizontalHeaderItem(0, item)
item = QtGui.QTableWidgetItem()
self.History.setHorizontalHeaderItem(1, item)
item = QtGui.QTableWidgetItem()
self.History.setHorizontalHeaderItem(2, item)
self.verticalLayout_10.addWidget(self.History)
#
# from the Databaseviewer
#
widget = self.ui.History
widget.clearContents()
# read the story from database
story = self.getHistory()
widget.setRowCount(len(story))
remember_sorting = widget.isSortingEnabled()
widget.setSortingEnabled(False)
for index_line, items in enumerate(story):
id, first_created, last_updated, memo, remind = items
widg1 = (first_created and first_created.strftime("%Y%m%d %H:%M") ) or ""
widg2 = (remind and remind.strftime("%Y%m%d %H:%M") ) or ""
widg3 = memo or ""
for index_col, widgetitem in enumerate( (widg1, widg2, widg3) ):
it = QtCore.QString( unicode( widgetitem ) )
it = QtGui.QTableWidgetItem( it )
it.setData(QtCore.Qt.UserRole, QtCore.QVariant(id))
widget.setItem(index_line , index_col, it)
if index_col == 2:
pol = QtGui.QSizePolicy( QtGui.QSizePolicy.Fixed, QtGui.QSizePolicy.Expanding )
pol.setHeightForWidth(True)
pol.setVerticalStretch( 9999 )
it = QtGui.QTextEdit()
it.setWordWrapMode( QtGui.QTextOption.WrapAtWordBoundaryOrAnywhere )
it.setLineWrapMode( QtGui.QTextEdit.WidgetWidth )
it.setSizePolicy( pol )
it.setPlainText( QtCore.QString( unicode( widgetitem )))
print it.sizePolicy().horizontalPolicy(), it.sizePolicy().verticalPolicy()
print it.sizePolicy().horizontalStretch(), it.sizePolicy().verticalStretch()
widget.setCellWidget( index_line, index_col, it )
else:
pass
widget.resizeColumnsToContents()
widget.resizeRowsToContents()
To copy to clipboard, switch view to plain text mode
Bookmarks