pyqt4

pyQt4: QWidget subclass not responding to new setStyleSheet() background colour

I am having an issue with PyQt4. I want to create a new widget within a window, and I want this widget to have a custom color. When i create a subclass of the QWidget class, and instantiate it, I am not able to change its background color through the setStyleSheet() function. When I instantiate a new QWidget object, I have no problem...

Setting checkstate on a ListWidgetItem

Hi, I'm trying to create a list of checkbox items that change the status on activation. I can connect the activate signal and everything seems to work, but changes on the screen. Am I missing some steps here? Here's the list creation: self.listField = QtGui.QListWidget(self) muted_categories = qb.settingsCollection['mutedCategories']...

Sending custom PyQt signals?

I'm practicing PyQt and (Q)threads by making a simple Twitter client. I have two Qthreads. Main/GUI thread. Twitter fetch thread - fetches data from Twitter every X minutes. So, every X minutes my Twitter thread downloads a new set of status updates (a Python list). I want to hand this list over to the Main/GUI thread, so that it can...

QFileDialog and german umlaute within a path

Hey Everybody, i am working on a project, which i am developing with Python and PyQT4. I have stumbled upon a somewhat odd behaviour of the QFileDialog, that is not occuring when running the project within in my IDE (Eclipse). The problem is that QFileDialog in ExistingFiles-mode does fail to return the list of selected files, when one...

Setting A Generator As The Argument Of A PyQt4 Signal

I want to use a generator as the argument passed by a PyQt4 signal, and I am not sure as to the cleanest way. I could just do something like elementChosen=QtCore.pyqtSignal(type((i for i in xrange (i)))), but this just looks ugly. Any suggestions? ...

Difference between cellPressed and cellClicked signals of PyQt4 QTableWidget

The PyQt4 QTableWidget has both cellPressed and cellClicked signals. From the name, and the little experimentation I did with them, they appear to do exactly the same thing. Is there a difference between the two? ...

How to check wether a path represented by a QString with german umlauts exists?

Hey, i get a QString which represents a directory from a QLineEdit. Now i want to check wether a certain file exists in this directory. But if i try this with os.path.exists and os.path.join and get in trouble when german umlauts occur in the directory path: #the direcory coming from the user input in the QLineEdit #i take this QString...

PyQt: How to keep QTreeView nodes correctly expanded after a sort

I'm writing a simple test program using QTreeModel and QTreeView for a more complex project later on. In this simple program, I have data in groups which may be contracted or expanded, as one would expect in a QTreeView. The data may also be sorted by the various data columns (QTreeView.setSortingEnabled is True). Each tree item is a lis...

PyQt QAbstractListModel seems to ignore tristate flags

I've been trying for a couple days to figure out why my QAbstractLisModel won't allow a user to toggle a checkable item in three states. The model returns the Qt.IsTristate and Qt.ItemIsUserCheckable in the flags() method, but when the program runs only Qt.Checked and Qt.Unchecked are toggled on edit. class cboxModel(QtCore.QAbstractLis...

Python Qlistview output dir

Hi all i wish make little gui with pyqt4 that show the output of "dir c:\windows\" line by line I'm looking for QlistView but i don't understand how do it. Can anyone help me? ...

How to allow resizing of QMessageBox in PyQt4

I'm using the nice feature in QMessageBox to optionally show detailed text to the user. However, the window after expansion is still fairly small, and one immediately tries to resize the window so more of the details are visible. Even after setting what I think are the proper settings it won't allow resizing. Here's the relevant snippet...

Qt: How to autoexpand parents of a new QTreeView item when using a QSortFilterProxyModel

I'm making an app wherein the user can add new data to a QTreeModel at any time. The parent under which it gets placed is automatically expanded to show the new item: self.tree = DiceModel(headers) self.treeView.setModel(self.tree) expand_node = self.tree.addRoll() #addRoll makes a node, adds it, and returns the (parent) note to be expa...

Making File Dialog only accept directories

I want to have a file dialog only allow directories, here's what I've been trying: fileDialog = QtGui.QFileDialog() fileDialog.setFileMode(QtGui.QFileDialog.ShowDirsOnly) filename = fileDialog.getOpenFileName(self, 'Select USB Drive Location')) Thank You ...

Tying PyQt4 QAction triggered() to local class callable doesn't seem to work. How to debug this?

I create this object when I want to create a QAction. I then add this QAction to a menu: class ActionObject(object): def __init__(self, owner, command): action = QtGui.QAction(command.name, owner) self.action = action self.command = command action.setShortcut(command.shortcut) action.setStatusTip(command.name) ...

where can i find pyqt examples folder in Mac Os x??

Hai, I've installed pyqt on mac os x and it's up and running well. But i can't find the pyqt examples folder? May i know where this is located by default.. Regards.. ...

Why doesn't my QsciLexerCustom subclass work in PyQt4 using QsciScintilla?

My end goal is to get Erlang syntax highlighting in QsciScintilla using PyQt4 and Python 2.6. I'm running on Windows 7, but will also need Ubuntu support. PyQt4 is missing the necessary wrapper code for the Erlang lexer/highlighter that "base" scintilla has, so I figured I'd write a lightweight one on top of QsciLexerCustom. It's a litt...

how code a Image button in PyQt?

Im trying to do simple audio player, but I want use a image(icon) as a pushbutton. ...

More compact layout

In the following code, I'd like to get rid of the margin around the buttons. I'd like to have the buttons stretch all the way to the edge of the frame. How can I do that? import sys from PyQt4.QtGui import * from PyQt4.QtCore import * app = QApplication(sys.argv) window = QWidget() layout = QVBoxLayout() layout.setSpacing(0) window....

How can I set the line style of a specific cell in a QTableView?

I am working with a QT GUI. I am implementing a simple hex edit control using a QTableView. My initial idea is to use a table with seventeen columns. Each row of the table will have 16 hex bytes and then an ASCII representation of that data in the seventeenth column. Ideally, I would like to edit/set the style of the seventeenth column t...

Cannot import PyQt4.QtGui

I have a working Python 2.6 install and just installed the PyQt4 built for Python 2.6 (available at http://www.riverbankcomputing.co.uk/software/pyqt/download). When I try to import PyQt4.QtGui I get the following error: ImportError: DLL load failed: The specified procedure could not be found. I'm on Windows 2k8 64-bit, but my Python ...