pyside

QDataWidgetMapper and multiple delegates

我与影子孤独终老i 提交于 2019-12-23 11:11:55
问题 mapper = QtGui.QDataWidgetMapper() mapper.setModel(my_table_model) mapper.addMapping(widgetA, 0) #mapping widget to a column mapper.addMapping(widgetB, 1) #mapping widget to a column mapper.setItemDelegate(MyDelegateA(widgetA)) #Hmm. Where is the 'column' parameter? mapper.setItemDelegate(MyDelegateB(widgetB)) #now itemDelegate is rewritten, MyDelegateB will be used So... How do I set up mutiple delegates for a single QDataWidgetMapper ? As far as I understand there is no QDataWidgetMapper

QDataWidgetMapper and multiple delegates

若如初见. 提交于 2019-12-23 11:11:29
问题 mapper = QtGui.QDataWidgetMapper() mapper.setModel(my_table_model) mapper.addMapping(widgetA, 0) #mapping widget to a column mapper.addMapping(widgetB, 1) #mapping widget to a column mapper.setItemDelegate(MyDelegateA(widgetA)) #Hmm. Where is the 'column' parameter? mapper.setItemDelegate(MyDelegateB(widgetB)) #now itemDelegate is rewritten, MyDelegateB will be used So... How do I set up mutiple delegates for a single QDataWidgetMapper ? As far as I understand there is no QDataWidgetMapper

Why is a rectangle partly outside of view drawn as a triangle?

佐手、 提交于 2019-12-23 06:56:09
问题 I use the Python-Qt bindings from PySide and I want to draw a scene with amongst others a rectangle and the rectangle is not fully visible because the view should only show a part of the scene where the rectangle is not fully contained. Here is a minimal example: from PySide.QtGui import * app = QApplication([]) scene = QGraphicsScene() scene.addRect(0, 0, 100, 100) view = QGraphicsView(scene) view.setSceneRect(-60, 20, 100, 100) view.show() app.exec_() I expect to see the lower part of a

label displays sum of two QSpinBox (Python + Pyside)?

雨燕双飞 提交于 2019-12-23 05:09:38
问题 Could someone help me fix the code to display in the total column the sum of the two spinners 'Amount + Counter'. Currently the total label just displays the value of a single spinner. I need it to display the sum of both spinners. Any additional fixes or notes are welcome as I'm new to python. Thank you very much. BELOW IS THE FIXED WORKING CODE #!/usr/bin/python # -*- coding: utf-8 -*- import sys from PySide import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self): super

Installing python modules for specific version on linux (pySide)

烂漫一生 提交于 2019-12-23 05:01:36
问题 So, to keep it simple. Ubuntu 12.10 has python 3.2 pre installed and it is linked to "python3". I downloaded python 3.3 and it's command is "python3.3". However, I downloaded pySide for python3 from synaptic. Using "from PySide.QtCore import *" fails on python3.3. BUT, when I ran just "python3" (aka 3.2) everything works fine. Synaptic just installed lib for python3.2 which is default for python3 in ubuntu. How can I force synaptic to install modules for python3.3? Thanks 回答1: Try working in

Installing python modules for specific version on linux (pySide)

吃可爱长大的小学妹 提交于 2019-12-23 05:01:05
问题 So, to keep it simple. Ubuntu 12.10 has python 3.2 pre installed and it is linked to "python3". I downloaded python 3.3 and it's command is "python3.3". However, I downloaded pySide for python3 from synaptic. Using "from PySide.QtCore import *" fails on python3.3. BUT, when I ran just "python3" (aka 3.2) everything works fine. Synaptic just installed lib for python3.2 which is default for python3 in ubuntu. How can I force synaptic to install modules for python3.3? Thanks 回答1: Try working in

PySide “hello world”: py2exe/pyinstaller/cx_freeze and access violation

允我心安 提交于 2019-12-23 03:53:07
问题 I am trying to build a very basic executable (Windows) using PySide. The following script runs properly in the interpreter (Python 2.7, PySide 1.1.2) #!/usr/bin/python import sys sys.stdout = open("my_stdout.log", "w") sys.stderr = open("my_stderr.log", "w") import PySide.QtGui from PySide.QtGui import QApplication from PySide.QtGui import QMessageBox # Create the application object app = QApplication(sys.argv) # Create a simple dialog box msgBox = QMessageBox() msgBox.setText("Hello World -

PySide emit signal causes python to crash

柔情痞子 提交于 2019-12-23 03:32:12
问题 I am working through the book "Rapid Gui Programming with Python and Qt" and am having a problem on the signals/slots project. I have downloaded the authors code to compare against my own, and it all looks the same, however, when I emit a signal from a derived spin box class, python just crashes. Here is the entire code that I have: import sys from PySide.QtCore import * from PySide.QtGui import * class ZeroSpinBox(QSpinBox): zeros = 0 def __init__(self, parent=None): super(ZeroSpinBox, self)

PySide: QMetaObject.connectSlotsByName emits warnings “No matching signal…” but still works..?

六月ゝ 毕业季﹏ 提交于 2019-12-23 03:18:32
问题 In Qt Designer, I created a QDialog window and used pysideuic to compile that to a base class which contains a setupUi method initialising all GUI elements and which I extend to implement the functionality, as so: class MyDialog(QtGui.QDialog, ui_file.Ui_main_dialog): def __init__(self, parent=None): QtGui.QDialog.__init__(self, parent) ui_file.Ui_main_dialog.__init__(self) self.setupUi(self) This setupUi method has calls to QtCore.QObject.connect for the signal-slot connections I created in

Objects seems to be deleted if not assigned to object variable in PySide

大兔子大兔子 提交于 2019-12-23 03:04:24
问题 I'm trying to use QStandardItemModel to represent a hierarchy of data, but when I'm adding QStandardItems to the model, I have to assign them in object member variables, or the objects seems to be deleted. For example self.tree_model = QStandardItemModel() self.tree_model.setHorizontalHeaderLabels(['Category']) self.out_insertions = QStandardItem("Insertions") self.tree_model.invisibleRootItem().appendRow(self.out_insertions) Works as expected (an "Insertion" row is inserted under the column