pyside

PySide Signal argument can't be retrieved from QML

自古美人都是妖i 提交于 2019-11-29 16:09:38
I've noticed that QML can receive a signal emitted from Python by using the Connections object. Unfortunately, I can't figure out how to get that object to receive the arguments of that signal. I've created a minimal test case that demonstrates what I want to do: min.py from PySide import QtCore, QtGui, QtDeclarative import sys # init Qt app = QtGui.QApplication(sys.argv) # set up the signal class Signaller(QtCore.QObject): emitted = QtCore.Signal(str) signaller = Signaller() # Load the QML qt_view = QtDeclarative.QDeclarativeView() context = qt_view.rootContext() context.setContextProperty(

Display data from QAbstractTableModel in QTreeView

烂漫一生 提交于 2019-11-29 16:02:07
Short version I am trying to display data from a QAbstracctTableModel in a QTreeView . When I do, I end up with the entire table displayed as the child of every node (and grandchild, and so-on). How can I display a treeview of an abstract table model? Details I am trying to display some data in a QAbstractTableModel in a QTreeView . In the Model-View Tutorial , after presenting an example QAbstractTableModel , it makes it seem it's as simple as replacing QTableView with QTreeView : You can convert the example above into an application with a tree view. Simply replace QTableView with QTreeView

Why python executable opens new window instance when function by multiprocessing module is called on windows

本秂侑毒 提交于 2019-11-29 15:44:52
Short Question: Why python executable generated by pyinstaller opens new window instance when function by multiprocessing module is called on windows operating system I have a GUI code written using pyside. Where when we click on simple button it will calculate factorial in another process (using multiprocessing module). It works as expected when I run python program. But after I create executable using PyInstaller and when I run using exe it is creating new window when function by multiprocessing module gets called. Here is the code and step by step process to reproduce the issue. Code:

Access values of dropActions in model (PySide/PyQt/Qt)

廉价感情. 提交于 2019-11-29 15:44:42
In a QTableModel when I enter the following: print model.supportedDropActions() I just get: <PyQt4.QtCore.DropActions object at 0x00000000081172E8> How can I access an actual list of the supported drop actions from this object? At the documentation , it says, "The DropActions type is a typedef for QFlags. It stores an OR combination of DropAction values." Note I am doing this in Python (PySide). Related posts: Drag and drop rows within QTableWidget neuronet Background First, make sure you understand how the bitwise-encoding works for these flags. There are really good descriptions in the

Connect action in QMainWindow with method of view's delegate (PySide/Qt/PyQt)

喜欢而已 提交于 2019-11-29 15:41:14
I have a QTreeView displaying data from a QStandardItemModel . One of the columns of the tree is displayed with a delegate that lets the user edit and display rich text. Below is a SSCCE that limits the editing to bold (with keyboard shortcut). When the user is editing one of the items, how can I set it up so that in addition to toggling boldness with keyboard shortcut (CTRL-B), the user can also toggle it using the toolbar icon? Thus far, the keyboard shortcut works great (you can double click, edit text, and CTRL-B will toggle bold). However, I haven't figured out how to connect the bold

Dockable window in Maya with PySide clean up

不打扰是莪最后的温柔 提交于 2019-11-29 15:40:06
问题 I created a tool that is able to dock in Maya's main ui, but I can't figure out a way to clean it up once it closes. The problem is if I create multiple instances of the tool then drag it in place to dock it, they will ALL show up when I right-click on Maya's window. How do I properly clean these up when the tool closes? I already tried cmds.deleteUI , QObject.deleteLater() and at best I can only clear the tool's contents, but it will still exist in Maya. Here's an example of what I have so

pyqt QTablewidget remove scrollbar to show full table

隐身守侯 提交于 2019-11-29 14:50:02
问题 I have a scrollview to which I dynamically add QTableWidgets. However, the QTables themselves also have scrollbars and therefore dont show the full table. Is there a way to disable the scroll bar so that the table always gets shown in full? EDIT: I added self.setVerticalScrollBarPolicy(Qt.ScrollBarAlwaysOff) self.setHorizontalScrollBarPolicy(Qt.ScrollBarAlwaysOff) as suggested. The scroll bar does disappear, but it still only shows the partial tables (Ican scroll with hovering iverthe table

A .py file which compiled from .qrc file( using pyside-rcc ) does not work

不羁岁月 提交于 2019-11-29 14:07:05
I am working on python project and I have a problem with my .py file which complied from .qrc file. First, let I explain briefly about my project. I created my project GUI in QtDesigner and also use the image in the GUI. Then, I generate .py from .ui file using pyside-uic and generate .py file from .qrc file using pyside-rcc. The problem is when I use the .py file (an image file), images does not show in my GUI. Is anybody knows how to solve this problem? Thank you for all your answer. :) Ps. I use PySide as my GUI language. Have you actually added the resource to your GUI project? Starting

How to get all child components of QWidget in pyside/pyqt/qt?

放肆的年华 提交于 2019-11-29 13:39:08
问题 I am developing a desktop application using pyside(qt), I want to access(iterate) all line edit components of QWidget. In qt I found two methods findChild and findChildren but there is no proper example found and My code shows error, 'form' object has no attribute 'findChild'. Here 'form' is Qwidget form consist components lineEdit, comboboxes, Qpushbuttons etc. Code: lineEdits = form.findChild<QLineEdit>() //This is not working lineEdits = form.findChild('QLineEdit) //This also not working

Drag and drop rows within QTableWidget

六眼飞鱼酱① 提交于 2019-11-29 12:39:42
问题 Goal My goal is to have a QTableWidget in which the user can drag/drop rows internally. That is, the user can drag and drop one entire row, moving it up or down in the table to a different location in between two other rows. The goal is illustrated in this figure: What I tried, and what happens Once I have populated a QTableWidget with data, I set its properties as follows: table.setDragDropMode(QtGui.QAbstractItemView.InternalMove) #select one row at a time table.setSelectionMode(QtGui