I do this:
# somewhere in init
self._last_vsb_height = None
self.verticalScrollBar().rangeChanged[int,int].connect(self._on_range_changed)
def _on_range_changed(self, min, max):
# Try to prevent infinite recursion
# Count is in rows
if max !=
for i,txt in enumerate(lst):
edit = getattr(self, 'lineEdit_%d' % i)
edit.settext(txt)
-Original Message-
From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On Behalf Of
lucabe...@libero.it
Sent: Tuesday, October 11, 2011 8:49 AM
To:
I use QTreeView's selectionChanged signal. But you should also look at
QAbstractItemView's signals; it has many for you to choose from:
activated, clicked, doubleClicked, entered, pressed, ...
p
From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On
If you need hotkey+click then this is the best way I've found to do it
# Implement shift-click to expand/contract
@pyqtSlot(QModelIndex)
def _on_expanded(self, index):
if self._in_shift_press:
self._in_shift_press = False
You've probably forgotten to call your base class's __init__.
p
-Original Message-
From: pyqt-boun...@riverbankcomputing.com
[mailto:pyqt-boun...@riverbankcomputing.com] On
Behalf Of Entity Reborn
Sent: Wednesday, February 09, 2011 8:42 PM
To: pyqt@riverbankcomputing.com
Subject:
http://doc.qt.nokia.com/qq/qq25-undo.html has this snip of example code
that demonstrates (among other things) how to back out commands that
fail or otherwise do nothing so they don't clutter up the undo stack:
bool UndoRedoProxy::setData( ... ){
if (!index.isValid() || index.data(role)
I want know when the number of rows change in QTableWidget. Is there
any
signal or event in PyQt for that?
widget.model() will emit rowsInserted/Moved/Removed signals. You could
try connecting
to those. See QAbstractItemModel for details.
You may also need to connect to modelReset because
Well, I suppose you would start with
class MainWindow(QMainWindow):
def contextMenuEvent(self, event):
item = self.tree_widget.itemAt(event.globalPos())
# create or fetch a QMenu that relates to your item
menu.exec(event.globalPos())
or you could override the event on the
This change to PyQt4/uic/Loader/loader.py loadUi() breaks support for
file-like objects,
but uic.loadUi() is still documented as supporting them:
# Allow the filename to be a QString.
filename = str(filename)
return self.parse(filename, os.path.dirname(filename))
The use