pyside

PySide Multiple Inheritance: Inheriting a QWidget and a Mixin

半世苍凉 提交于 2019-12-11 12:24:21
问题 I'm trying to create a set of PySide classes that inherit QWidget, QMainWindow, and QDialog. Also, I would like to inherit another class to overrides a few functions, and also set the layout of the widget. Example: Mixin: class Mixin(object): def __init__(self, parent, arg): self.arg = arg self.parent = parent # Setup the UI from QDesigner ui = Ui_widget() ui.setupUi(self.parent) def setLayout(self, layout, title): self.parent.setWindowTitle(title) self.parent.setLayout(layout) def

Qt Tooltip how to prevent the text from disappearing after the builtin delay?

我只是一个虾纸丫 提交于 2019-12-11 11:44:42
问题 I have a QGraphicsScene and inside I have a few QGraphicsItem s. When I hover over a QGraphicsRectItem , I want to show an overlay text immediately. Only when the cursor leaves the item, then the text can disappear. Below you can see I tried using whatsthis (which crashes python) and tooltip. With tooltip, I am able to make the text appear immediately but the text disappears on its own after the built-in delay. class Node(QGraphicsRectItem): def __init__(self, x, y, w, h, qpen, qbrush, text):

MainWindow Widget Resize (Pyside)

≯℡__Kan透↙ 提交于 2019-12-11 11:28:51
问题 I have a problem with the resize of the MainWindow of a GUI Application. This is what i see when i try to run the Application: Link Image 1 and what happen when i try to resize it with the mouse: Link Image 2 I would like that, when i try to resize the MainWindow it shows the Widget inside like the first image i showed before instead have that large spacing between each "label". If it can help this is the code: Link Code You can go straigth on to the functions setUi(), setGridUI(), ignoring

qwebview in pyside after packaged with pyinstaller goes wrong

ぐ巨炮叔叔 提交于 2019-12-11 11:21:30
问题 Here's my code import sys from PySide.QtCore import * from PySide.QtGui import * from PySide.QtWebKit import * from encodings import * from codecs import * class BrowserWindow( QWidget ): def __init__( self, parent=None ): QWidget.__init__( self, parent ) self.Setup() self.SetupEvent() def Setup( self ): self.setWindowTitle( u"Truease Speedy Browser" ) self.addr_input = QLineEdit() self.addr_go = QPushButton( "GO" ) self.addr_bar = QHBoxLayout() self.addr_bar.addWidget( self.addr_input ) self

Global application menu active in modal dialog box (on Linux)

佐手、 提交于 2019-12-11 11:09:08
问题 I am developing an application in PySide on Windows and Linux (Ubuntu). On Windows everything works as expected. But on Linux, when I open a modal dialog box in the application (even system dialogs, e.g. OpenFileDialog), the global application menu still stays visible and active. What is the meaning of modality then? I know this is likely a duplicate to this: Application menu is enabled even if a modal dialog box is open According to it, if I understand well, I would have to keep the

QThreads and xmlrpc client

删除回忆录丶 提交于 2019-12-11 09:44:10
问题 I'm trying to use xmlrpc client from many QThreads. To make sure that only one thread is using xmlrpc client I created lock with QMutex. My code: import sys import xmlrpclib import threading import time from SimpleXMLRPCServer import SimpleXMLRPCServer from PyQt4 import QtCore, QtGui class MM(object): def __init__(self): self.lock = QtCore.QMutex() self.xmlrpc_client = xmlrpclib.ServerProxy('http://localhost:9092') def __getattr__(self, name): self.lock.lock() sys.stderr.write('locked, for %s

How to intercept and propagate an event from overlapping widgets

梦想的初衷 提交于 2019-12-11 09:42:35
问题 I'd like to intercept an event from a widget placed on-top of another widget, without consuming it. Here's what I've got so far. When clicking the overlapping part, I'd like it to print "Hello World", but all I'm getting is "Hello". import sys from PyQt5 import QtWidgets class Button(QtWidgets.QPushButton): def mousePressEvent(self, event): print self.text() return super(Button, self).mousePressEvent(event) app = QtWidgets.QApplication(sys.argv) window = QtWidgets.QWidget() window

Zooming a view in PyQt?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 09:06:27
问题 I have a simple to do tree application that displays a QTreeView inside of a QMainWindow. I want to give the user the ability to change the magnification level of the content (using a spinbox most likely), but without actually changing the underlying font size of the text. Is there a way to do this without changing my whole app to a QGraphicsScene ? The app is just showing a good-old fashioned tree with text, no graphics or anything fancy other than wanting to change the magnification of the

Can I have one slot for several signals?

北城余情 提交于 2019-12-11 08:58:52
问题 I have several buttons, each with a Signal that emits one of their attributes (say, an integer) whenever the button is clicked. In a parent class, I'd like to be able to catch any of the buttons' emits and react based on that particular attribute from the button. I can think of a way to do that by individually 'connecting' each button in the parent class, but that seems wrong, and cumbersome, because in my application I add and remove buttons as part of the functionality. I'm probably

How to drop a custom QStandardItem into a QListView

删除回忆录丶 提交于 2019-12-11 08:56:48
问题 I am trying to get drag&drop to work between two QListViews using a custom QStandardItem. I can't find the info I need online other than this document which helped a little bit but now I'm stuck. Drag&drop from one QListView to another works fine when I use a QStandardItem to hold my data, but when I use a custom item I run into trouble, because the receiving model/view creates a QStandardItem when a custom item is dropped. Ideally I could tell the receiving model to use my custom item as the