self._controlLayout.addWidget(self._message, 1000)
self._controlLayout.addWidget(self._closeLabel, 1, QtCore.Qt.AlignCenter)
- self._topLevelLayout = QtGui.QHBoxLayout()
- self._topLevelLayout.addLayout(self._controlLayout)
self._widget = QtGui.QWidget()
- self._widget.setLayout(self._topLevelLayout)
+ self._widget.setLayout(self._controlLayout)
self._widget.hide()
@property
doc.documentLayout().draw(painter, ctx)
painter.restore()
- def setWidth(self, width):
- # @bug we need to be emitting sizeHintChanged but it requires an index
+ def setWidth(self, width, model):
+ if self._width == width:
+ return
self._width = width
+ for c in xrange(model.rowCount()):
+ cItem = model.item(c, 0)
+ for r in xrange(model.rowCount()):
+ rItem = cItem.child(r, 0)
+ rIndex = model.indexFromItem(rItem)
+ self.sizeHintChanged.emit(rIndex)
+ return
def sizeHint(self, option, index):
newOption = QtGui.QStyleOptionViewItemV4(option)
return size
+class QSignalingMainWindow(QtGui.QMainWindow):
+
+ closed = QtCore.pyqtSignal()
+ hidden = QtCore.pyqtSignal()
+ shown = QtCore.pyqtSignal()
+
+ def __init__(self, *args, **kwd):
+ QtGui.QMainWindow.__init__(*((self, )+args), **kwd)
+
+ def closeEvent(self, event):
+ QtGui.QMainWindow.closeEvent(self, event)
+ self.closed.emit()
+
+ def hideEvent(self, event):
+ QtGui.QMainWindow.hideEvent(self, event)
+ self.hidden.emit()
+
+ def showEvent(self, event):
+ QtGui.QMainWindow.showEvent(self, event)
+ self.shown.emit()
+
+
def _null_set_stackable(window, isStackable):
pass
def _maemo_set_window_orientation(window, orientation):
if orientation == QtCore.Qt.Vertical:
- newHint = QtCore.Qt.WA_Maemo5LandscapeOrientation
- oldHint = QtCore.Qt.WA_Maemo5PortraitOrientation
- elif orientation == QtCore.Qt.Horizontal:
oldHint = QtCore.Qt.WA_Maemo5LandscapeOrientation
newHint = QtCore.Qt.WA_Maemo5PortraitOrientation
+ elif orientation == QtCore.Qt.Horizontal:
+ oldHint = QtCore.Qt.WA_Maemo5PortraitOrientation
+ newHint = QtCore.Qt.WA_Maemo5LandscapeOrientation
window.setAttribute(oldHint, False)
window.setAttribute(newHint, True)