pyqt

Simulating a mouse click event in PyQt

I am trying to simulate a mouse click event in Python on the ui.goButton widget. Here is what I did: QtTest.QTest.mouseClick(self.ui.goButton, QtCore.Qt.LeftButton) Is this the right way to do it? Cause it is not working. ...

Multiple drag and drop in PyQt4

Hi, i can't find an example on dragging (and dropping) multiple elements with Qt/PyQt; In my case i need to drag elements from this QTableView: class DragTable(QTableView): def __init__(self, parent = None): super(DragTable, self).__init__(parent) self.setDragEnabled(True) def dragEnterEvent(self, event): ...

Cannot select item from QListView with custom QStyledItemDelegate

I want to render each row with HTML code. The rendering works but -at least for me- items cannot be selected individually. import sys from PyQt4.QtCore import * from PyQt4.QtGui import * #################################################################### def main(): app = QApplication(sys.argv) w = MyWindow() w.show(...

How to optimize PyQt QSortFilterProxyModel filter reimplementation?

I have a reimplemented QSortFilterProxyModel acceptRows to achieve custom behavior, i want it to not filter out items which have a valid child. class KSortFilterProxyModel(QSortFilterProxyModel): #FIXME: Funciona pero es endemoniadamente lento def __init__(self, parent=None): super(KSortFilterProxyModel, self).__init__(parent) s...

Using PyQt from IronPython

Is it possible to use PyQt from IronPython? From what I've read IronPython should work with CPython compatible libraries but out of the box it doesn't seem to work. If it is possible, will code completion work? ...

PyQt's Signal / SLOT different classes

can i connect two objects that are in different classes ? lets say i want button1's clicked() signal to clear line2 class A(QGroupBox): def __init__(self, parent=None): super(A, self).__init__(parent) self.button1= QPushButton('bt1') self.button1.show() class B(QGroupBox): def __init__(self, parent=Non...

PyQt4 tray icon application context menu items don't work.

Hello! I've got a simple tray icon application, but "About" context menu item doesn't work at all. I'm definitly mising something simple, but important here. The question is what should i fix to see "About" menu item working? import sys from PyQt4 import QtCore from PyQt4 import QtGui class SystemTrayIcon(QtGui.QSystemTrayIcon): ...

pyqt application lost icon after packaged by cx_freeze

I have a pyqt application whose icon is in a resource file. I can see the icon when run the application using python app.py. But after I package the application using cx_freeze, the icon is missing. I can see the compiled resource in the `library.zip' (generated by cx_freeze), but the icon is still missing. Any one can help? Thanks. ...

Pyqt get pixel position and value when mouse click on the image

Hi everybody, I would like to know how i can select a pixel with a mouse click in an image (QImge) and get pixel position and value. Thanks ...

how to implement thin client app with pyqt

Here is what I would like to do, and I want to know how some people with experience in this field do this: With three POST requests I get from the http server: widgets and layout and then app logic (minimal) data Or maybe it's better to combine the first two or all three. I'm thinking of using pyqt. I think I can load .ui files. I c...

Retrieving stdout from subprocess in Windows.

I can call FFmpeg with subprocess.Popen and retrieve the data I need, as it occurs (to get progress), but only in console. I've looked around and seen that you can't get the data "live" when running with pythonw. Yet, waiting until the process finishes to retrieve the data is moot, since I'm trying to wrap a PyQT GUI around FFmpeg so I c...

PyQt QGraphicsView fails to setWindowIcon

I'm using sub-classed QGraphicsView's in an MDIArea I want to be able to change the icon of the window from 'within' the object, but it just seems to ignore me... no errors or warnings... it just doesn't do it. if self.world.is_dirty: self.setWindowIcon( QtGui.QIcon ( 'images/dirty.png' ) ) self.setWindowTitle('dirty') else: ...

Clear a TableView in PyQt

Hello there, I'm in the process of learning how to display data and tables using PyQt. Ultimately I'd like to have a Table showing the contents of a database, but for now I'm just getting to grips with some of the fundamentals. I have a basic setup (pasted below) made using Qt Designer with a set of buttons ("Create", "Add Row", "Add Co...

PyQt: How can I quit a QDialog?

Hi guys, I've build a QDialog Widget. My problem is, I can't quit the QDialog. If I press one of the buttons, then the QDialog is only set to "hide". Here is a little part of the code. It is executable. I don't know what I'm doing wrong. Maybe one of you can tell me. from PyQt4.QtCore import * from PyQt4.QtGui import * import sys ...

restrict movable area of qgraphicsitem

Is there a way to restrict the area where a QGraphicsItem like QRect can be moved when setFlag(ItemIsMovable) is set? I'm new to pyqt and trying to find a way to move an item with the mouse, and the restrict it to only vertically/horizontally. Thanks! ...

Wxwidgets and Pyqt

Hello, is there a similar function PyOnDemandOutputWindow in Pyqt? This function redirect the console output to a separate window. Sorry for my english. ...

PyQt4 rich text editor WYSIWYG toolbar to set basic text properties

I'm using PyQT4 to create a little GUI that allows people in my lab to write notes about physiological experiments. Right now I've got plain text editing going but it would be nice if the user could use rich text editing to set the currently selected text's font properties, bold/italic/font/font size would be sufficient. I am specificall...

PyQt: How to catch mouse-over-event of QTableWidget-headers?

Hi guys, what I want to do is to change the text of a QLable, everytime I hover with the mouse over the horizontalHeaders of my QTableWidget. How can I do that? Everytime I'm over a new header I need a signal and the index of the header. Hope someone of you has an idea. There must be a function, because if you hover over the headers, th...

Displaying QComboBox text rather than index value in QStyledItemDelegate

So I have a model and one of the columns contains a country. However because I want to display a combo box to choose the country from a list of options, I don't store the country name in the model directly. Instead I store an index value into a list of allowable countries. This allows me to use a QComboBox in my form view as recommended ...

Qt: best way to add a context menu to the central widget?

I do not understand why in the book Rapid GUI Programming with Python and Qt, a context menu is added to a central widget by calling addActions() on the main window (self), like so (p. 180): self.addActions(self.imageLabel, (editInvertAction, …)) where self is a QMainWindow, and imageLabel is a QLabel set as the centra...