pyside

How to make subclass of QStyledItemDelegate react properly on mouse hover in a QListView in PySide/PyQt?

你说的曾经没有我的故事 提交于 2019-12-13 02:10:45
问题 On my way to solve the problems I stated in earlier questions (question 1, question 2) alone, I succeeded to implement a custom QStyledItemDelegate which meets my demands. Here is a minimal working example illustrating the current state: import sys import PySide.QtCore as core import PySide.QtGui as gui class DataRef(object): def __init__(self, i): self.i = i def upperLabel(self): return u'upperLabel {0}'.format(self.i) def lowerLabel(self): return u'lowerLabel {0}'.format(self.i) def pixmap

PyQt/PySide QSpinBox flickering issue

蹲街弑〆低调 提交于 2019-12-13 01:26:02
问题 I have added a QSpinBox to a QGraphicsScene using a QGraphicsProxyWidget. Each time I hover over the QSpinBox, it flickers with a black band overlaid on the spinbox controls. I have attached a screenshot and the code below. Am I doing something wrong? Is there a way to avoid this? Pyside 1.1.2, Python 2.7, Windows7. class testWidget(QGraphicsView): def __init__(self): QGraphicsView.__init__(self) floorSpinBox = QSpinBox() floorSpinBox.setGeometry(0,0,50,25) proxyWidget = QGraphicsProxyWidget(

Waiting in for loop until QRadioButton get checked everytime?

耗尽温柔 提交于 2019-12-13 00:34:17
问题 I have a situation where i need to get Pass/Fail from tester for every test step in PySide GUI. Now the data of testsuite i am running in for loop and trying to get current checked/unchecked state of QRadioButton in for loop based on which i will do further code processing. My code is :- for i in range(self.ui.hlfDataset_sa_lst.count()): self.ui.pass_radio.setChecked(False) self.ui.fail_radio.setChecked(False) print "command ", str(self.ui.hlfDataset_sa_lst.item(i).text()) print "Run ", str(i

Replacing QTextEdit bounding box with a line

梦想与她 提交于 2019-12-13 00:13:30
问题 This question is a slight modification of the bounding box example. I'm trying to understand how to draw simple shapes. I just want to replace the bounding box with a diagonal line from the upperLeft point to the lowerRight point. However, QLine() does not appear to have a show() method and viewport() has no addItem() method. So, I think the line is not being displayed. Here is my modification of the showBoxes method: def showLines(self): while self.boxes: self.boxes.pop() #self.boxes.pop()

Getting OpenGL context newer than 2.1 with Qt 4 and Mavericks

≯℡__Kan透↙ 提交于 2019-12-13 00:10:59
问题 I'm having difficulty creating an OpenGL context newer than 2.1 (Mac OS 10.9.1, Qt 4.8.5, PySide 1.2.1). Minimal example code is given below; it produces a 2.1 context rather than 3.2 or higher. The code is based on this tutorial; the tutorial's sample C++ code also fails when run on my machine. This issue might be related to this bug: QGLFormat.openGLVersionFlags() returns 0x7f (indicating compatability up to OpenGL 2.1 but no later). Is there something that I'm missing, or is it hopeless

looking for example for QCompleter with segmented completion / tree models

依然范特西╮ 提交于 2019-12-12 20:19:31
问题 The PySide docs include this section on QCompleter with tree models: PySide.QtGui.QCompleter can look for completions in tree models, assuming that any item (or sub-item or sub-sub-item) can be unambiguously represented as a string by specifying the path to the item. The completion is then performed one level at a time. Let’s take the example of a user typing in a file system path. The model is a (hierarchical) PySide.QtGui.QFileSystemModel . The completion occurs for every element in the

Pyside Installation Error

╄→гoц情女王★ 提交于 2019-12-12 19:18:23
问题 I have a 32-bit Windows 7 OS. Today, I tried downloading the PySide setup program. However, after I try running the downloaded file, I get the following error: "PySide Setup program invalid or damaged." Why am I getting this? I have recently started a course on building GUI applications with Python using the Qt framework, and need PySide for the same. I use Python 2.7 btw. 回答1: My solution to nearly the same exact problem was simply that it needed to be installed with admin privileges, so

How to stop qt app from freezing the main program?

瘦欲@ 提交于 2019-12-12 17:11:48
问题 For example: #!/usr/bin/env python3 import sys from PySide import QtCore, QtGui class Dialog(QtGui.QDialog): def __init__(self): QtGui.QDialog.__init__(self) button = QtGui.QPushButton("test") layout = QtGui.QVBoxLayout() layout.addWidget(button) self.setLayout(layout) app = QtGui.QApplication(sys.argv) toast = Dialog() toast.show() app.exec_() print("App freezes the main process!") The last print() function will not be executed until you close the dialog. I am working on a script that only

QThread.isFinished returns False in slot connected to finished() signal

最后都变了- 提交于 2019-12-12 16:21:11
问题 I have a QThread that emits finished() signal, but its isFinished() returns False. Why is that? How to know when isFinished will start to return True? from __future__ import print_function from PySide import QtCore, QtGui qapp = QtGui.QApplication([]) worker_thread = QtCore.QThread() worker_thread.start() worker_thread.quit() def fin(): print('isFinished:', worker_thread.isFinished()) worker_thread.finished.connect(fin) QtCore.QTimer.singleShot(200, qapp.quit) qapp.exec_() sometimes it

Why doesn't menu get added?

北战南征 提交于 2019-12-12 12:23:15
问题 I'm clearly missing something here; why doesn't the File menu get added in this little example app? import sys from PySide.QtGui import * class Window(QMainWindow): def __init__(self): super(Window, self).__init__() self.setWindowTitle('Test') layout = QHBoxLayout() self.widget = QWidget() self.widget.setLayout(layout) self.setCentralWidget(self.widget) self.exitAction = QAction('Exit', self, shortcut=QKeySequence.Quit, triggered=self.close) self.fileMenu = self.menuBar().addMenu('File') self