pyside

pip install PySide fails QtCore Framework check (OS X)

风格不统一 提交于 2019-12-13 19:58:19
问题 The error When I run pip install PySide – whether in a virtual environment or not – build fails with the following error: ... [lots of build info, including a few warnings but no errors, for shiboken] Linking CXX executable shiboken ld: framework not found QtCore clang: error: linker command failed with exit code 1 (use -v to see invocation) Seeing as I have QtCore installed and the framework present (see below), I'm not sure why that should be. Setup info Software versions OS X 10.8.2 Qt 4.8

In QDialog, resize window to contain all columns of QTableView

柔情痞子 提交于 2019-12-13 19:23:50
问题 I am writing a simple program to display the contents of a SQL database table in a QDialog (PySide). The goal is to have a method that expands the window to show all of the columns, so the user doesn't have to resize to see everything. This problem was addressed in a slightly different context: Fit width of TableView to width of content Based on that, I wrote the following method: def resizeWindowToColumns(self): frameWidth = self.view.frameWidth() * 2 vertHeaderWidth = self.view

QtGui.QIdentityProxyModel missing in PySide?

陌路散爱 提交于 2019-12-13 15:41:38
问题 I want to write my own proxy model to "flatten" a tree-like model (i.e. some items might have children items) into a list-like model (i.e. no items have children) by mapping the indices. Subclassing QtGui.QIdentityProxyModel seems to be the best way: http://qt-project.org/doc/qt-4.8/qidentityproxymodel.html but I cannot find it in PySide 1.2.1 which is built with Qt 4.8 (which includes QIdentityProxyModel ): http://seanfisk.github.io/pyside-docs/pyside/PySide/QtGui/index.html. So this seems

Python copy.deepcopy() fails without raising warning, exception or error

让人想犯罪 __ 提交于 2019-12-13 15:14:33
问题 This question is related to another question I posted yesterday, although it is much more general in nature. Because of the thread I mentionned, I have been trying to determine what objects can be copied, pickled, marshaled and what objects cannot. While doing that, I stumbled on this puzzle: new_obj = copy.deepcopy(my_obj) function_that_uses_my_new_obj(new_obj) throws: function_that_uses_my_new_obj(new_obj) RuntimeError: Internal C++ object (Pyside.QtGui.QWidget) already deleted Now, since

Installed PySide but can't import it: “no module named PySide”

我只是一个虾纸丫 提交于 2019-12-13 13:40:19
问题 I'm new to Python. I have both Python 2.7 and Python 3 installed. I just tried installing PySide via Homebrew and got this message: PySide package successfully installed in /usr/local/lib/python2.7/site-packages/PySide... Both versions of Python and the newly installed PySide are all stored in /usr/local/Cellar/ . This issue is that when I'm in either Python 2.7 or Python 3 and try to import PySide or run a test program that includes PySide, I get the message: "no module named PySide". This

Change PySide QGroupBox checkbox image

自作多情 提交于 2019-12-13 06:49:59
问题 I would like to change the image (or icon?) displayed with the checkbox for a QGroupBox, i.e.: In particular, I would like to change the image displayed when it is 'checked' to the image 'images/custom_checked.png', and the image displayed when it is hovered over to 'images/custom_hover.png'. I think this can be accomplished using StyleSheets but I have not been able to make anything work. Edit: The following code does change the checkbox image when the checkbox is checked class MyGroupBox

Run multiple qthreads concurrently in Python

白昼怎懂夜的黑 提交于 2019-12-13 06:39:17
问题 In the attached code when you click start it creates a QSpinBox and starts counting to 20 in QThread , but if I click start again while it is counting, the first QSpinBox stops and a new one takes the focus, and both counters run in it, but I need all spins to run at the same time separately: import sys import time from PySide.QtGui import * from PySide.QtCore import * class frmMain(QDialog): def __init__(self): QDialog.__init__(self) self.btStart = QPushButton('Start') self.btStop =

How to handle mouse events in Qt?

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-13 06:08:09
问题 Dragging, panning and mouse tracking items in Qt scene are the 3 actions which I want to simultaneously use in my app. However, it is more difficult than I thought. Example code : from PySide.QtCore import * from PySide.QtGui import * class View(QGraphicsView): """# HOW TO ATTACH MOUSE EVENTS PROGRAMMATICALLY ? def mouseMoveEvent(self, event): print "View MOVE", event.pos() """ class Scene(QGraphicsScene): pass class CircleForTrackingSwitch(QGraphicsEllipseItem): def __init__(self, scene):

setData raises exit code -1073741819

醉酒当歌 提交于 2019-12-13 05:47:18
问题 I have a subclass of QtGui.QStandardItemModel with setData as follow: def setData(self, index, value, role): if role == QtCore.Qt.EditRole: old = self.itemFromIndex(index).text() new = value MAIN.changeItem(old,new,index) return QtGui.QStandardItemModel.setData(self, index, value, role) In MAIN.changeItem I take the 'old' value and replace it with the 'new' in the Database and and then I setData with the return value. And finally I refresh the Model to show the result. Like so: def changeItem

Qt tree view with Pyside

冷暖自知 提交于 2019-12-13 04:42:34
问题 I have two folders in program directory. I need them to show in tree view, they should be expandable. How can I define what folder will be in tree view? If anyone canshow me an easy example. I know names of folders. I´m using Python 2.7 and Win 8. 回答1: You can do that with QTreeView and QFileSystemModel : model = QFileSystemModel(); model.setRootPath(QDir.currentPath()) tree = QTreeView() tree.setModel(model) tree.setRootIndex(model.index(QDir.currentPath())) tree.show() 来源: https:/