pyside

Qt : Fit width of TableView to width of content

纵然是瞬间 提交于 2019-12-12 10:36:54
问题 I have a window that contains a QTableView which columns are adjusted to content and are fixed in width . The QTableView is nested within a QWidget that in turn is nested within a QScrollArea that in turn is nested within a tabbed QMdiArea which is the centralWidget of a QMainWindow . When the QScrollArea is shown, the QTableView has extra space to the right of the last column that I want to be removed : I want the QTableView to fit the exact width of the columns (i.e. no extra space after

Qthread locking up Gui PySide

久未见 提交于 2019-12-12 09:57:05
问题 I am trying to run a process in a separate thread but it is freezing my Gui and I cant understand why. I am initialising the thread in the init function of my class: self.cipher = Cipher() self.cipher_thread = QThread() self.cipher.moveToThread(self.cipher_thread) self.cipher_thread.started.connect(lambda: self.cipher.encrypt(self.plaintext_file_path, self.ciphertext_file_path, self.init_vector, self.key)) self.cipher_thread.start() The encrypt method of the cipher class is: def encrypt(self)

Pyside applications not closing properly

拥有回忆 提交于 2019-12-12 09:52:58
问题 I recently took up GUI programming in PySide and I'm having trouble with an oddity regarding exit commands. Sys.exit([x]) seems to be widely used to stop a PySide program; whenever I use it in a PySide program using classes, however, it doesn't return an exit code to PyCharm or stop the Python process in the task manager. Oddly enough it seems it's incredibly hard to do either of these things when using PySide; I could break out of the main loop, call sys.exit(0) , raise SystemExit(0) and it

How to install ipython qtconsole with pyenv (Python version 3.4.2)

你离开我真会死。 提交于 2019-12-12 09:21:11
问题 I am using Ubuntu 14.04. I installed pyenv and then installed Python 3.4.2 under pyenv . Then I switched to version 3.4.2: $ pyenv global 3.4.2 Now I would like to install ipython and the qtconsole : $ pip install ipython $ ipython3 qtconsole & This gives an error message (traceback not shown): ImportError: Could not load requested Qt binding. Please ensure that PyQt4 >= 4.7 or PySide >= 1.0.3 is available, and only one is imported per session. Currently-imported Qt library: Noneu PyQt4

Where is pyside-uic?

流过昼夜 提交于 2019-12-12 08:38:18
问题 I'm trying to use Qt Designer and pyside-uic mydesign.ui > design.py however, this program doesn't exist. I looked in site packages under python 2.7, and I see: pyside-lupdate.exe pyside-rcc.exe and a bunch of other programs, but there is no such thing as pyside-uic.exe ... why ?? Why is it missing from the installation package? Where do I get it? 回答1: You should see a /Python27/Scripts/pyside-uic.exe. But I'm wondering why it's not visible (not executable). Maybe it's a packaging problem

Controlling drag-n-drop disable/enable of QTreeWidget items - python

我的未来我决定 提交于 2019-12-12 05:39:34
问题 In my example I want users to have the ability to drag and drop children between families of all kinds. However I want to restrict users from having the ability to drag and drop a person onto another person, or dropping a person as a root object which in return would make it become a family. I've gotten very close. There is a single bug though. If a user drags a person to a family, while hovering over the cursor over the family, if you carefully move the cursor to the top most edge of the

How to draw line between folded blocks in QPlainTextEdit?

跟風遠走 提交于 2019-12-12 03:35:03
问题 I have a struggle and I even don't know is it possible in QPlainTextEdit . Have no idea how to draw a line between to folded blocks in QPlainTextEdit : import sys from PySide.QtCore import * from PySide.QtGui import * app = QApplication(sys.argv) textEdit = QPlainTextEdit() textEdit.setViewportMargins( 50,0,0,0 ) textEdit.setPlainText( '''There is a house in New Orleans They call the Rising Sun And it's been the ruin of many a poor boy And God, I know I'm one' ''') for n in [1,2] : textEdit

PyQtGraph with PySide producing tiny, squashed graphs (including the example code)

拈花ヽ惹草 提交于 2019-12-12 02:58:21
问题 I am running Python 3.3 with PySide 1.2.2 and PyQtGraph 0.9.8. The problem I am having is that every graph I try and produce returns an obviously incorrect result. This is the graph I get when I run the basic plotting example that is packaged with PyQtGraph: Rather than what I am supposed to get: (source: pyqtgraph.org) Any ideas? Thanks 回答1: A description of the problem and solution could be found here: pyqtgraph Google Group The problem is caused by a faulty binary installation file from

Python - PyQt4 (Webkit) How to set value of input(type=“file” multiple=“”)?

早过忘川 提交于 2019-12-12 02:44:41
问题 I'm trying to upload a file using QWebPage module of (WebKIt) like this. <form action="#"> Select a file: <input type="file" id="photos_upload_input" multiplie=""> <input type="submit"> </form> I try it: class WebPage(QWebPage): def __init__(self, parent = None): QWebPage.__init__(self) self.overrideUpload = None def extension(self, extension, option, output): ''' The behavior of this function is determined by extension . The option and output values are typically casted to the corresponding

Catch which mousebutton is pressed on item

我与影子孤独终老i 提交于 2019-12-12 02:29:02
问题 I have a UI.py file with the mainWindow class definition (build with Qt Designer and Pyside). The UI is imported in the main module. In the Ui I have a listbox. Based on the left or right mouse clicked on an item a procedure must be executed, e.g leftMouseClicked and rightMouseClicked. Thanks for your help. 回答1: you can define a mousePressEvent() method in your QListWidget subclass to handle mouse press event. Get which button is clicked by the event parameter and save it to an attribute.