I would like to display widgets between the QHeaderView and the rest of the QTableView, like in the example picture below (created with Photoshop), as this seems like a natural way to enable input for filtering columns. Does anybody have any ideas of how to inject widgets inbetween? Answer Below is a demo of a FilterHeader class that I wrote
Tag: pyqt
Is it possible to paint a QGraphicsItem inside the paint() method?
I’m creating a subclass of QGraphicsItem, and this subclass has different places that the user can click. My idea is for each component clicked to create a subclass of QGraphicsItem with mousePressEvent replaced. The problem is how can I merge this component into a subclass of QGraphicItem. Here’s the code I’m trying, but I do not know how to show
How to delete row/rows from a qtableview in pyqt?
I am using QStandardItemModel for my qtableview. here when I am trying to delete the row selected(i.e. model.removeRow() ) I am getting a error” TypeError: argument 1 of QAbstractItemModel.removeRow() has an invalid type”. I have searched a lot for the correct way of deleting a selected row/rows in qtableview of pyqt. However, I am not able to delete the selected
How to use KDE Okular’s document view widget in a Python Qt app?
I am writing a desktop application in Python (3.4) on Linux using Qt (4.8) and PyQt. Is there a way to use/import Okular’s pdf view functionality as a widget? If yes, how? Answer This works for me:
QtConcurrent in PySide/PyQt
I’m trying to figure out if subclassing QtConcurrent and writing a run method inside it will work: Or is it completely useless? Answer It’s completely useless, because QtConcurrent is a namespace, not a class. Also, neither PyQt nor PySide provide any of the functionality provided by QtConcurrent, because it’s all template-based and therefore impossible to wrap. PS: the PySide documentation
Resize QMainWindow to minimal size after content of layout changes
I’m using a subclass of QMainWindow, in which I declared a central widget. This widget contains, among other things, a QGridLayout, which holds a set of buttons. The amount of buttons can grow or shrink, depending on the user’s input. The spacing is set to zero, so that all buttons are clumped together. By default, it looks like this: If
Error “QObject::startTimer: QTimer can only be used with threads started with QThread” many times when closing application
I know this has been asked many times before. I read all of those threads, and my case seems different. Everybody else who has this trouble has a few straightforward causes that I think I’ve ruled out, such as: Starting a timer with no event loop running Starting/stopping a timer from a thread other than the one that created the
PyQt4 QWizard: How to disable the back button on a single page?
I would like to disable the “Back” button on a QWizard page. My Class inherits from QWizard and from a generated file. It looks somehow like this: from PyQt4 import QtGui Here http://doc.qt.digia.com/3.3/qwizard.html#backButton I found the method setBackEnabled(). With self.setBackEnabled(page1, False) I am not able to call this method. It says: Am I doing something wrong? Or is this method
How to grab a desktop screenshot with PyQt?
Can I take a screenshot from desktop or any window with PyQt? How to handle keyPressEvent on desktop? Thanks. Answer Example of how to take a screenshot of the desktop: If you want to take a screenshot of a specific window, replace QApplication.desktop() with the widget you want to take a screenshot of.
PyQt: How to connect QComboBox to function with Arguments
QComboBox is connected to a function using following syntax: But I need to be able to send the arguments from ComboBox to myFunction(). But if I use: I am getting What syntax needs to be used to connect a QComboBox to a function that is able to receive arguments sent from Comobobox? EDITED LATER: Here is the code resulting an