pyside

pyside / pyqt: Getting values from dynamically created qlineedits on button clicked

半腔热情 提交于 2019-12-11 03:01:53
问题 I have a program that creates a number of qlineedits and buttons depending on the users input: On the image above 4 lines have been added with a button after the grayed out "Next" button was clicked. Now I want to get the input from the user into a function when the corresponding button is clicked (Click "Create Shot 1! --> goto a function with "exShot1" passed as an argument). The thing is I have no idea how to get the names of each qline and button when they are created in a loop. I guess I

Differentiate single click from double click in pyside

一个人想着一个人 提交于 2019-12-11 02:41:48
问题 I have tried to implement in Pyside the method described in How to distinguish between mouseReleaseEvent and mousedoubleClickEvent on QGrapnhicsScene, but I had to add a crufty flag to keep it from showing single click after the second button release in a double click. Is there a better way? import sys from PySide import QtGui, QtCore class Example(QtGui.QWidget): def __init__(self): super(Example, self).__init__() """an attempt to implement https://stackoverflow.com/questions/18021691/how-to

How to get link URL on onClick in a QWebView?

与世无争的帅哥 提交于 2019-12-11 02:19:23
问题 How do I get a link's URL when clicking on the link? If I have a link in the A tag, it's simple: just connect linkClicked(const QUrl&) signal to specific slot. But if I have a table with an "onClick" event on its cell (generated html: "<td onClick=\"window.location.href='" + link_ + "';\" ......blahblahblah"), it's not working. Why? 回答1: As it's name suggests, the linkClicked signal is only emitted whenever a link is activated. But you can intercept all navigation requests by reimplementing

“Module use of python34.dll conflicts with this version of Python”

做~自己de王妃 提交于 2019-12-11 02:05:10
问题 My knowledge of Python is still pretty basic, and I am only now trying to wrap my head around how to use / call libraries from within Maya. (Because I need to create a basic UI from QT Designer and have it be opened in Maya after converting it to a .py file) After I learned to properly convert a .ui to a .py, I now get this error in Maya "Module use of python34.dll conflicts with this version of Python" I tried following what was said here and here, but even then - after setting these

PyQt/PySide How to access/move QGraphicsItem after having added it to QGraphicsScene

天大地大妈咪最大 提交于 2019-12-11 01:42:19
问题 This might be a very uninformed question. I've been trying to figure out QGraphics* , and have run into a problem when trying to move an item (a pixmap) relative to or inside of the QGraphicsView . class MainWindow(QMainWindow,myProgram.Ui_MainWindow): def __init__(self): super().__init__() self.setupUi(self) self.scene = QGraphicsScene() self.graphicsView.setScene(self.scene) pic = QPixmap('myPic.png') self.scene.addPixmap(pic) print(self.scene.items()) This is the relevant part of the

How to send None with Signals across threads?

对着背影说爱祢 提交于 2019-12-10 23:41:12
问题 I've implemented a version of the worker pattern that is described in the Qt Threading docs. I'm using Signals/Slots to send data between the worker thread and the main thread. When defining the Signal , I've set the argument signature type to object since I believe it should allow me to pass any python object through the Signal . result_ready = QtCore.Signal(object) However, when I try to pass None through the Signal it crashes python. This only happens when trying to pass the Signal across

QNetworkAccessManager and HTTP persistent connection

假装没事ソ 提交于 2019-12-10 20:14:45
问题 HTTP 1.1 supports persistent connection by default, so I want to send my a second http request using the same connection that was setup when the first HTTP request was made. how can this be achieved through Qt? If I simply make the second request after the first one finished like the following manager->get(QNetworkRequest(QUrl("http://qt-project.org"))); it seems a new TCP connection to the server will be initiated (I have checked with a network sniffer) The experiment also says: If the reply

Proper PySide QThread use in Maya to avoid hard crash

不羁的心 提交于 2019-12-10 18:45:21
问题 I'm attempting to use QThreads to update my custom tool's Qt-based UI inside of Maya. I have a thread that executes arbitrary methods and returns the result via an emitted signal, which I then use to update my UI. Here's my custom QThread class: from PySide import QtCore class Thread(QtCore.QThread): result = QtCore.Signal(object) def __init__(self, parent, method, **kwargs): super(Thread, self).__init__(parent) self.parent = parent self.method = method self.kwargs = kwargs def run(self):

PySide / Python GUI freezes

二次信任 提交于 2019-12-10 18:18:38
问题 I'm currently writing a GUI for rvplayer that shall enable artists to automatically render dailies with slate and burn-in information. The GUI is written with PySide and scripted in Python 2.7. My problem is that upon calling my process and updating my QProgressBar with the stdout the GUI freezes. I know that this is a common problem and that it can probably be solved with processEvents() somehow, but I know far too little about threading and process loops to get my head around this issue.

Make QTreeWidgetItem unique among siblings

僤鯓⒐⒋嵵緔 提交于 2019-12-10 17:56:15
问题 Is there some way to make sure that updating an existing QTreeWidgetItem or inserting a new one ensures that the item is unique among its siblings based on the value of a single column? I have tried to do something like this with a QTreeView and my own custom model and have gotten it to work, but some advanced features like moving items with drag and drop are eluding me. I figure, the QTreeWidget and QTreeWidgetItem classes ought to get more of this type of stuff for free and ought to cause