pyside

Implementing a delegate for wordwrap in a QTreeView (Qt/PySide/PyQt)?

試著忘記壹切 提交于 2019-12-01 00:46:22
I have a tree view with a custom delegate to which I am trying to add word wrap functionality. The word wrapping is working fine, but the sizeHint() seems to not work, so when the text wraps, the relevant row does not expand to include it. I thought I was taking care of it in sizeHint() by returning document.size().height() . def sizeHint(self, option, index): text = index.model().data(index) document = QtGui.QTextDocument() document.setHtml(text) document.setTextWidth(option.rect.width()) return QtCore.QSize(document.idealWidth(), document.size().height()) However, when I print out document

Painting background on QGraphicsView using drawBackground

泪湿孤枕 提交于 2019-12-01 00:19:41
I have a problem trying to paint and draw on QGraphicsView/Scene . I'm drawing a bunch of QLineF as background overriding QGraphicsView::drawBackGround`. However, when I try to change the background color nothing happens. Here is minimal example of what I'm doing: import sys import platform import ctypes from PySide import QtCore, QtGui from mygv import Ui_Dialog import sys class myView(QtGui.QDialog): def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) self.ui = Ui_Dialog() self.ui.setupUi(self) self.ui.view.drawBackground = self.drawBackground self.ui.view.wheelEvent =

PySide and QProgressBar update in a different thread

此生再无相见时 提交于 2019-11-30 22:37:48
This may be a little long post, so, thanks in advance to be with me till the end. Here is the problem, (i think a fairly basic one, just my inexperience with PiSide and Qt making it harder for me.) I have a main window with one menu item, suppose "Process". the code is following - from PySide import QtCore, QtGui class Ui_MainWindow(object): def setupUi(self, MainWindow, AppObj): . . self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow.setStatusBar(self.statusbar) . . . self.actionProcess = QtGui.QAction(MainWindow) self.actionProcess.setObjectName

PyInstaller packaged application works fine in Console mode, crashes in Window mode

强颜欢笑 提交于 2019-11-30 21:22:29
I am building a fairly complex application using Python and PySide. Finally the day of the release is nearing so I want to build this application as an exe. However, I have a strange problem on my hands. I've used PyInstaller (using version 2 by the way) in the past and never had this happened to me. Basically, when I build the application with the --console flag, it works fine - but it opens the console window. When I build the application with the window flag ( -w ), it doesn't work fine. It starts and everything, but there are all these weird glitches. For example, loading a text file often

Painting background on QGraphicsView using drawBackground

谁说我不能喝 提交于 2019-11-30 19:24:08
问题 I have a problem trying to paint and draw on QGraphicsView/Scene . I'm drawing a bunch of QLineF as background overriding QGraphicsView::drawBackGround`. However, when I try to change the background color nothing happens. Here is minimal example of what I'm doing: import sys import platform import ctypes from PySide import QtCore, QtGui from mygv import Ui_Dialog import sys class myView(QtGui.QDialog): def __init__(self, parent = None): QtGui.QDialog.__init__(self, parent) self.ui = Ui_Dialog

upload files through http post in Pyside/PyQt

痴心易碎 提交于 2019-11-30 17:53:30
问题 I'm trying to send a file and other POST variables to a xfilesharing script(which is in perl) on my customer server. There are no good resources on Google and the code samples I've found don't work.(actually they were in c++ and I couldn't get them work) server is using Apache for webserver I ask a question before and I got a pretty good answer,so I'm using that uploader in here,code just not work for uploading file through http post so can anyone first of all tell me what I need to do to

PySide and QProgressBar update in a different thread

限于喜欢 提交于 2019-11-30 17:46:24
问题 This may be a little long post, so, thanks in advance to be with me till the end. Here is the problem, (i think a fairly basic one, just my inexperience with PiSide and Qt making it harder for me.) I have a main window with one menu item, suppose "Process". the code is following - from PySide import QtCore, QtGui class Ui_MainWindow(object): def setupUi(self, MainWindow, AppObj): . . self.statusbar = QtGui.QStatusBar(MainWindow) self.statusbar.setObjectName("statusbar") MainWindow

PyInstaller packaged application works fine in Console mode, crashes in Window mode

戏子无情 提交于 2019-11-30 17:11:31
问题 I am building a fairly complex application using Python and PySide. Finally the day of the release is nearing so I want to build this application as an exe. However, I have a strange problem on my hands. I've used PyInstaller (using version 2 by the way) in the past and never had this happened to me. Basically, when I build the application with the --console flag, it works fine - but it opens the console window. When I build the application with the window flag ( -w ), it doesn't work fine.

python qt, display text/label above another widget(phonon)

假如想象 提交于 2019-11-30 16:55:57
I'm making a video player using PySide which is a python bind to the Qt framework. I'm using phonon(a module) to display the video and I want to display text above the video as a subtitle. How can I put another widget above my phonon widget. Is opengl an option? If you just create your label and set the phonon widget as the parent, the label should appear over it. QLabel *label = new QLabel(phononWidget); label->setText("Text over video!"); (I realize this is C++ and you are working in Python but it should be similar) Update: The above will not work for hardware accelerated video playback. An

PySide: Segfault(?) when using QItemSelectionModel with QListView

大憨熊 提交于 2019-11-30 16:55:25
问题 Same exact problem as this: Connecting QTableView selectionChanged signal produces segfault with PyQt I have a QListView, and I want to call a function when an item is selected: self.server_list = QtGui.QListView(self.main_widget) self.server_list_model = QtGui.QStandardItemModel() self.server_list.setModel(self.server_list_model) self.server_list.selectionModel().selectionChanged.connect(self.server_changed) But, when it reaches the last line, where I'm using the selection model, the app