pyside

Installing pyside with python3 on os x

泄露秘密 提交于 2019-12-09 13:44:15
问题 I have tried to install pyside together with python3 on osx mountain lion. I have been trying both brew install pyside But then it only works in python2. I have also tried using the buildscripts from the pyside github rep. Making the changes needed ./build_and_install fails however, with Linking CXX shared library libpyside.cpython-33m.dylib [ 4%] Built target pyside [ 4%] Running generator for QtCore... /bin/sh: /Users/einar/devel/pkg/pyside-sandbox-python3/bin/SHIBOKEN_GENERATOR-NOTFOUND:

Chained QSortFilterProxyModels

六月ゝ 毕业季﹏ 提交于 2019-12-09 12:28:34
问题 Let's say I have a list variable datalist storing 10,000 string entities. The QTableView needs to display only some of these entities. That's is why QTableView was assigned QSortFilterProxyModel that does all the filtering. After all Proxy work is completed the QTableView "receives" 25 entities to display (so remaining 9,975 entities were "filtered out". Now, I create a QLineEdit to be used as a search field where the user can type a keyword to narrow down the list of the displayed 25

calling a parent method from a child widget in pyside/pyqt

坚强是说给别人听的谎言 提交于 2019-12-09 06:38:03
问题 I'm trying to call a method of a parent class from within a child class. Specifically, my parent class is a PySide.QtGui.QMainWindow object, and my child class is a PySide.QtGui.QWidget object; the latter is set to be the central widget of the former. I'm trying to connect a button within the child to a method in the parent class. This has worked for me in the past using self.parent().method_name , but it doesn't work in the example below and I don't understand why: import sys from PySide

PySide/PyQt Overlay widget

早过忘川 提交于 2019-12-09 03:39:25
I am trying to achieve something like this in PySide: https://codepen.io/imprakash/pen/GgNMXO What I want to do is create a child window frameless with a black overlay below. I didn't succeed to create a child window frameless and the overlay... This is a base code to replicate the HTML: from PySide import QtCore, QtGui import sys class MainWindow(QtGui.QWidget): def __init__(self): QtGui.QWidget.__init__(self) self.resize(800, 500) self.button = QtGui.QPushButton("Click Me") self.setLayout(QtGui.QVBoxLayout()) self.layout().addWidget(self.button) # Connections self.button.clicked.connect(self

PyQt: How Can I set row heights of QTreeView

喜你入骨 提交于 2019-12-08 22:14:45
问题 In PyQt, I am looking for a way to set the height of rows in a QTreeView (similarly to QTableView.setRowHeight(row, row_height) , but QTreeView does not have this function). QAbstractItemModel is used to set the tree model. I read some suggestions here using and sub-classing QAbstractItemDelegate.sizeHint(option, index) but I don't know exactly how to call them correctly within my tree model. Any minimal code or suggestion would be greatly appreciated. Thanks. 回答1: The QTreeView works out a

How to change minimize event behavior in PyQt or PySide?

夙愿已清 提交于 2019-12-08 19:37:51
问题 I'm developing a Qt application and changed the closing behavior with the closeEvent virtual function this way: class MainWindow(QMainWindow): def closeEvent(self, event): event.ignore() self.hide() self.trayicon.showMessage('Running', 'Running in the background.') This works as expected. If I remove event.ignore() the application quits as expected, everything is fine. I want to control the minimize event too, so when the user clicks the minimize button on the title bar, I want to move the

PySide's shiboken python module not found

大憨熊 提交于 2019-12-08 19:15:36
PySide is installed successfully, and it works perfectly, but I can't find a way to import the shiboken module. Now I found the discussion about the feature request to expose shiboken functions through a python module ( http://bugs.pyside.org/show_bug.cgi?id=902 ), but the issue is resolved. It was implemented in january 2012, if I understood correctly. Even though after the installation of PySide 1.1.1 when I try: >>> import shiboken Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: No module named shiboken I get an ImportError exception. How can I install

Loading animated gif data in QMovie

余生长醉 提交于 2019-12-08 14:40:24
I'm very new to Qt (specifically PySide) and I'm trying write a script that loads an animated gif from file into a QByteArray and then into a QMovie. The reason for going from file to the QByteArray is because I cannot keep that gif file in memory. I want to be able to store the animated gif in such a way that it can be written out to a JSON file later (hence the QByteArray). I've tried using ekhumoro's answer from here and although no errors showed up, the animated gif also doesn't show up. (There could be something there but I don't see anything.) My code, in a nutshell, looks like this:

Conditional module importing in Python

风格不统一 提交于 2019-12-08 13:56:18
问题 I'm just trying out Maya 2017 and seen that they've gone over to PySide2 , which is great but all of my tools have import PySide or from PySide import ... in them. The obvious solution would be to find/replace import PySide to import PySide2 and hope everything still works after that, but I'd still like to be able to support older versions of Maya. My idea was to have a single line solution to find/replace like: import (PySide2 if "PySide2" in sys.modules else PySide) But this returns: Error:

Populating a QListWidget with custom widgets

孤街浪徒 提交于 2019-12-08 13:34:47
问题 I would like to create a QListView or QListWidget that contains many of these items. I have looked at making delegates and also using setItemWidget to set the widget. I am having difficulties with both. This below was created in QT Designer, I then have a UIC file that I load in a subclassed QWidget with uic.loadUi, nothing is crashing, but the listWidgetItems are empty. Any help would be appreciated. I will be iterating on this below, so I would like to be able to load a UIC dynamically.