pyqt

Removing custom widget from QVBoxLayout

I've got a QFrame with a QVBoxLayout and I'm adding my own custom widgets to the layout to simulate a QListWidget but with more information/functionality in the items. I add the widget to the layout and keep a reference in a member variable (this is Python): self.sv_widgets[purchase.id] = widget self.vl_seatView.addW...

QSqlTableModel.insertRecord() is very slow

Hello, I am using PyQt to insert records into a MySQL database. the code basically looks like self.table = QSqlTableModel() self.table.setTable('mytable') while True: rec = self.table.record() values = getValueDictionary() for k,v in values.items(): rec.setValue(k,QVariant(v)) self.table.insertRecord(-1,rec) The table curr...

help needed for using qt designer files in python(silly noob question)...

Hello all, I'm new to PyQt though i know python a bit.. I wanted to Qt designer for GUI programming since it'll make my job easier. I've taken a simple dialog in Qt designer and converted using pyuic4. from PyQt4 import QtCore, QtGui class Ui_Form1(object): def setupUi(self, Form1): Form1.setObjectName("Form1") ...

how to catch close,minimize and other events in this program(pyqt)???

Hai friends, The problem here is i want to catch the minimize and close event of QTabWidget(by default this widget do not have any slot named close or minimize) to hide the widget.. so the only way the user can quit the application is by clicking exit from the tray icon menu.. from PyQt4 import QtCore, QtGui import sys class Ui_TabWid...

In Qt, how to show keyboard shortcuts in menu but disable them?

I'm adding a bunch of QActions to my main window's menus. These actions can also be triggered by the keyboard, and I want the shortcut to be visible in the menu, as usual, e.g. ----------------- |Copy Ctrl+C| ----------------- I can do this using QAction.setShortcut(). However, I don't want these QActions to be triggered by the s...

PyQt: Call a TrayMinimized application.

I have an application wich is minimized to the tray (showing an icon) when the user close it. What I need to know is how can I call it back with a combination of keys, like Ctrl+Alt+Something. Actually I call it back when I double-click it, but it will be nice to do the same on a keystroke. Here is a portion of the code: # -*- coding: u...

Using style sheets in tab widgets in PyQT

Can you please tell me the syntax for using style sheets? in sub-controls like QStyle.SE_TabWidgetTabBar by having QTabWidget as a reference element For setting stylesheets for tabs (sub-control) in tab bar (example here) I've searched everywhere for the solution, but have had no luck. ...

PyQt: Always on top

This is on PyQt4, Linux and Python 2.5 Can I make PyQt set my window "always on top" over other applications? For example, in GTK i use the property: Modal. Now, in PyQt I am using a QWidget, but, I can't find a way to do that. Any ideas?? ...

[pyqt] Strange thing about tabbar.. Help me to solve..

Hello all, I just started learning pyqt.. When i'm experimenting with the tabbar i encountered this.. As a minimal example i want to show a button in tab1 and a label in tab2.. Here's what i did from PyQt4 import QtGui class Ui_TabWidget(QtGui.QTabWidget): def __init__(self,parent=None): QtGui.QTabWidget.__init_...

PyQt 4 UI freezes

The following programm should just count up and int and displays its value in a label. But after a while the GUI stops working, while the loop continous. from PyQt4 import QtGui,QtCore import sys class main_window(QtGui.QWidget): def __init__(self,parent=None): #Layout QtGui.QWidget.__init__(self,parent) ...

Matplotlib PyQt-Widget plot() resets autoscale

Hello, i am using a Matplotlib figure as widget, in a PyQt4 programm. Everything works, except "set_autoscale_on(False)". Everytime i call a figure axes to plot something, it forgets its autoscale status. Here some code, with axs a subplot of a figure: print axs.get_autoscale_on() print axs.get_autoscaley_on() p...

Help with qt4 qgraphicsview

I've done lots of stuff with pygtk however i'm deciding to learn pyqt, im stuck at the qgraphicsview i have absolutley no idea how to get signals from the items i place on the graphics view, primarily mouse events.How do i get the mouse events from idividual items in a scene? ...

PyQt Documentation

I have installed PyQt GPL v4.6.2 for Python v3.1 and Qt by Nokia v4.6.0 (OpenSource), but the documentation in PyQt is not coming up. Example docs are all blank too. Would anyone mind writing a step-by-step guide on what links to visit and what procedures must be executed in order to get text to come up for the PyQt Documentation? Edit...

PyQt, click action on Qwidget

Hi I've this simple problem, I can grab the event of a click on button, but now I need to handle a click over a widget, here is part of the code: self.widget = QtGui.QWidget(self) self.widget.setStyleSheet("QWidget { background-color: %s }" % color.name()) self.widget.setGeometry(150, 22, 50, 50) self.connect(???) well, what should i...

Qt Python Combo-Box "currentIndexChanged" firing twice

I have a combo, which is showing some awkward behavior. Given a list of options from the combo-box, the user should pick the name of a city clicking with the mouse. Here is the code: QtCore.QObject.connect(self.comboCity, QtCore.SIGNAL("currentIndexChanged(QString)"), self.checkChosenCity) def checkChosenCity(self): ...

PyQt, widget do not shown

Hi I've this hort program in Python ad Qt4 #!/usr/bin/python # -*- coding: utf-8 -*- import sys from PyQt4 import QtGui from PyQt4 import QtCore color = QtGui.QColor(99, 0, 0) class colorButton(QtGui.QWidget): def __init__(self, args): QtGui.QWidget.__init__(self,args) self.setGeometry(150, 22, 50, 50) se...

PyQt4 Signalling between classes

Hi folks, I have a family of classes (based on the same parent class) that are data cells in a QTableWidget (so they are all derived from QItemDelegate). I'm trying to create a signal that these classes can pass up to the controller to communicate data changes. I can't find the right combination (despite much experimentation and rea...

How can I disable clear of clipboard on exit of PyQt4 application?

I have a simple PyQt4 application (see the code below) that reveals next problem: if I select the text from QLineEdit and copy it to clipboard then I can paste it to another application only while my application is running. It seems that on exit PyQt application clears the clipboard so I can't paste the text after the application is clos...

Problem while building a PyQt script with py2exe (QtCore)

Hi, I'm trying to make a simple hello-world executable python gui app in windows using pyqt. So I've made the pyqt.py file import sys from PyQt4.QtGui import * app = QApplication(sys.argv) button = QPushButton("Hello World", None) button.show() app.exec_() I tried to use py2exe with the following setup.py script: from py2exe.build_ex...

PyQt Qtreewidget turn off selection

By default a QTreeWidget manages the selection of rows [when you click a row it highlights it, when you click another row it highlights that and deselects the previous row] , I dont want this and cant figure out how to turn it off. ...