I've got a Qt4 application (using the PyQt bindings) which contains a QListWidget, initialized like so:
class MyList(QtGui.QListWidget):
def __init__(self):
QtGui.QListWidget.__init__(self)
self.setDragDropMode(self.InternalMove)
I can add items, and this allows me to drag and drop to reorder the list. But how do ...
Consider the code below:
#!/usr/bin/env python
from PyQt4 import QtCore, QtGui
import os,sys
class MainWindow(QtGui.QMainWindow):
def __init__(self, parent=None):
super(MainWindow, self).__init__(parent)
self.listWidget = QtGui.QListWidget(None)
self.setCentralWidget(self.listWidget)
if __name__ == ...
I'm trying to implement a custom QLayout using PyQt. setGeometry gets called, and I loop through and call setGeometry on all the widgets I'm managing, but for some reason the widgets never get painted, despite all having the correct geometry.
Also, invalidate, update, and activate never seem to get called on my Layout. Does anyone hav...
i know that there is a documentation page on qt web site but i was wondering if that's possible to get dynamically through python.
...
I have three QDockWidgets which are tabbed at startup using QMainWindow.tabifyDockWidget.
In the main window, after all of the addDockWidget calls:
self.tabifyDockWidget(self.dock_widget1, self.dock_widget2)
self.tabifyDockWidget(self.dock_widget1, self.dock_widget3)
Based on certain actions, I'd like to select one of these tabs and ...
Hi,
How can I place a Qt4 widget just above the system tray on windows.
Since exact coordinates may depend on resolution and even the size and placement of the task bar(top or bottom of the screen etc.)?
I think there is probably a method for getting the screen resolution, but is there any method for getting the size of the taskbar and...
Hi folks,
I'm trying to learn PyQt4 and GUI design with QtDesigner. I've got my basic GUI designed, and I now want to capture when the user clicks on a column header.
My thought is that I need to override QTableWidget, but I don't know how to attach to the signal. Here's my class so far:
class MyTableWidget(QtGui.QTableWidget):
...
I just compiled the latest preview of Qt4.6 on Snow Leopard in 64 bit without any major issues.
http://qt.nokia.com/developer/qt-4.6-technology-preview#download-the-qt-4-1
Now, I am trying to do the same for PyQt4.6 with the latest snapshot from the River Bank website. However, the compiler exits with the following issue:
g++ -c -pipe...
I'm trying to open a PNG image and write some text to it (a watermark) via QImage and QPainter. The code works 100% on Linux but when I run it on Windows XP (haven't tested with any other versions of Windows) the text is never written to the image. I have the code in a try/except block, but no errors are returned.
image = QtGui.QImage('...
I have a PyQt program used to visualize some python objects. I would like to do display multiple objects, each in its own window.
What is the best way to achieve multi-window applications in PyQt4?
Currently I have the following:
from PyQt4 import QtGui
class MainWindow(QtGui.QMainWindow):
windowList = []
def __init__(self,...
Hi folks,
I'm having to create a custom table manually with Qt4 (I need 2 header rows/columns). To do that, I've disabled horizontalHeader/verticalHeader's, and have created the header rows. Now, I'd like to style those table cells like the header cells are styled, but I don't see how to do that.
Anybody able to help?
TIA
Mike
...
Hi,
I'm trying to add some syntax highlighting to a text editor in PyQt4. I've found an example in the documentation which works find when compiled from C++ but when i convert it to Python/PyQt it no longer works.
The part of the code that fails (no longer highlights anything) is:
def highlightCurrentLine(self):
extraSelections =...
OK, this is driving me nuts. I'm sure it is trivial, but I've been looking for the answer for a while and don't see it. I'm sure it will be a flat forehead.
I'm designing a Qt4 dialog in Python. I generated the code via QDesigner, and have 4 inputs on the system:
QLineEdit (can't be blank)
QPlainTextEdit
QLineEdit (can't be blank...
Hi guys,
I'm adding a contextmenu to a QTableWidget dynamically:
playlistContenxt = QAction("Add to %s" % (currentItem.text()), self.musicTable)
playlistContenxt.setData(currentData)
self.connect(playlistContenxt, SIGNAL("triggered()"), self.addToPlaylistAction)
self.musicTable.addAction(playlistContenxt)
currentItem.text() is a play...
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...
Hi all,
I am trying to trying to retrieve some values from a user using a QLineEdit widget. When a QPushButton raises a clicked event, I want the text to be retrieved from all QLineEdit widgets and stored in a local MySQL databaase. However, when I try to use string substition in the insert statement, the values don't get substituted. H...
My PyQt application works fine when running on Linux, when in my Windows build environment, or frozen on the machine where it was build with py2exe. But after moving the frozen executable and its supporting files to another machine it can't load the database driver.
It worked fine when I had Python2.5 and an earlier version of PyQt and ...
Is the combination of Python 3 and PyQt 4 recommended? Are there any alternatives?
...
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, ...
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...