pyqt

Export QT Menu to text

I was wondering if there is a way to convert my QT (version 4.50) menu and all its submenus into a text document in something similar to the following format: Menu 1 Sub Menu 2 Menu 2 sub menu 3 sub menu 4 sub menu 1 ...

In Qt4, how to check if paintEvent is triggered by a resize?

In a Qt4 application, is it possible to tell inside a paintEvent() handler whether the repaint was triggered by a resize or not? I have a widget which is very slow to redraw (a complicated plot), and I want to speed up resizes by just blitting a resized pixmap while the widget is being resized, and only redraw the widget when the resiz...

QGraphicsView with automatic items placing

I would like to write an asset browser using QGraphicsView. It's a little different from examples using QGraphicsView and QGraphicsItems, because I want only one scrollbar and I want items to move automatically, when the viewport size changes. For example, when viewport width is large enough to display 4 asssets, they should be displayed...

How to set application's taskbar icon

How do I set an application's taskbar icon in PyQt4? I have tried setWindowIcon, and it successfully sets the icon in the top-left of the main window, but it does not affect the icon shown in the Windows 7 taskbar -- the taskbar icon remains the default Python pyw icon. Here is my code: from PyQt4 import QtGui app = QtGui.QApplication...

PyQt: Displaying QTextEdits over the window

I want to display some QTextEdits over my main window at arbitrary locations. Below is my first attempt. It doesn't quite work. If I create the text edits before I show the window, the text edits appear, but if I create them after I have shown the window they don't appear. What's up with that? How can I get the ones created later to...

Apparently my app. runs but I don't see anything

I'm learning python and Qt to create graphical desktop apps. I designed the UI with Qt Designer and converted the .ui to .py using pyuic, according to the tutorial I'm following, I should be able to run my app. but when I do it, a terminal window opens and it says: cd '/Users/andresacevedo/' && '/opt/local/bin/python2.6' '/Users/andres...

Why can't I do SHOW PROCESSLIST with QtSql (PyQT)?

I am a Python and QT newbie. I am trying to do a little app with PyQT4 in order to supervise a home MySQL server of mine, so my first idea was to do the classic SHOW PROCESSLIST, parse it, and show in a pretty UI. Nothing big, really. But for some reason, the QtSql module doesn't return anything when doing this query, although it works ...

Threading in a PyQt application: Use Qt threads or Python threads?

I'm writing a GUI application that regularly retrieves data through a web connection. Since this retrieval takes a while, this causes the UI to be unresponsive during the retrieval process (it cannot be split into smaller parts). This is why I'd like to outsource the web connection to a separate worker thread. [Yes, I know, now I have t...

PyQt custom widget in c++

Can I write custom Qt widget in pure C++, compile it and use in PyQt? I'm trying to use the ctypes-opencv with qt and I have performance problems with python's code for displaying opencv's image in Qt form. ...

Python 3 and PyQt 4 recommendations

Is the combination of Python 3 and PyQt 4 recommended? Are there any alternatives? ...

How to enable context menu on a VerticalHeaderItem inside a QTableWidget?

I have QTable widget, where I set setVerticalHeaderItem(0, QTableWidgetItem("some header", 0)) I set a contex menu by setContextMenuPolicy(Qt.ActionsContextMenu) and it works fine on my table's elements other than 1st column, i.e. a VerticalHeaderItem. Basically, when I right-click on 1st column item a context menu doesn't pop up, ...

Can I make QCompleter complete inline and show a popup.

Qt 4.5 (PyQt 4.6.1) I'm looking for a widget similar to a QComboBox that automatically filters its entries to the ones starting with the input in the text field. There are around 300 items in the combo box. I've tried two approaches: QLineEdit with QCompleter Advantages Filtering the items works. Disadvantages Doesn't show a po...

PyQT GUI Testing

Does anyone know of a automated GUI testing package for that works with PyQT besides Squish? Nothing against Squish I am just looking for other packages. It would be cool if there were an open source package. I am doing my testing under Linux. ...

[Python] Best way to extract .ico from .exe and paint with PyQt?

Hello, I am looking for a way to extract an icon from a .exe file using Python. I know that you can use win32gui's ExtractIconEx function to grab the icon of a .exe but this returns a HIcon resource handle which is no good because I want to paint the icon using PyQt. Also the only example I have seen using win32gui does not have any tr...

[PyQt] Problems using PyQt's Resource System

I am trying to use PyQt's Resource System but it appears I have no clue what I am doing! I already have to application created, along with its GUI I am just trying to import some images to use with the program. I used the QtDesigner to create the resource file and I compiled it using pyrcc4.exe. But when I attempt to import the resource...

PyQT events between multiple objects

Hello fellow programmers, I am creating a GUI program in Python/PyQT and would like to know how I can connect an event which happens in a child object to the parent? For example, if someone clicks a 'Submit' button, how would i trigger something to happen in the parent object (lets say update a QLabel on the parent) Any help would be ...

How to allow scaling with uniform aspect ratio in (Py)Qt?

If you have a QImage wrapped inside a QLabel, is it possible to scale it up or down when you resize the window and maintain the aspect ratio (so the image doesn't become distorted)? I figured out that it can scale using setScaledContents(), and you can set a minimum and maximum size, but the image still loses its aspect. It would be gr...

PyQt: Trouble with asterisk on modification in QPlainTextEdit

I'm having a problem with a QPlainTextEdit. I want the "contents have been modified" asterisk to appear in the title bar whenever the contents have been modified. In the example below, type a few letters. The asterisk appears as it should. Hit Ctrl+S, the asterisk disappears as it should. But then if you type a few more letters... w...

Python PyQT4 - Adding an unknown number of QComboBox widgets to QGridLayout

Hi all, I want to retrieve a list of people's names from a queue and, for each person, place a checkbox with their name to a QGridLayout using the addWidget() function. I can successfully place the items in a QListView, but they just write over the top of each other rather than creating a new row. Does anyone have any thoughts on how I ...

qt - pyqt QTableView not populating when changing databases.

I'm trying to allow my users to pick which database to open. Each database will have the same schema. For some reason though I can't get my QTableView to populate after I open the database. I'm paraphrasing the example code but this should give you an idea of what I'm trying to do. works: class aMainWindow(QMainWindow, Ui_MainWindow):...