pyside

How to prevent from inserting new row when item is dropped with QTableWidget in PySide

微笑、不失礼 提交于 2019-12-11 08:35:01
问题 related post here QTablewidget drop without creating new rows but this has not been confirmed yet. Is it duplicate?but I dare to ask... I'm making QTableWidget I want to install drag & drop Event. But it has side-effect. When this code is executed, from PySide import QtGui from PySide import QtCore import sys class CustomTableWidget(QtGui.QTableWidget): def __init__(self,row=0,column=0,parent=None): super(CustomTableWidget,self).__init__(parent=None) self.setRowCount(row) self.setColumnCount

Unable to dynamically reset the maximum height of widgets in a QSplitter

回眸只為那壹抹淺笑 提交于 2019-12-11 08:33:57
问题 I'd like to have a QSplitterHandle resize only the widget above it, by: Initially fixing the maximum and minimum height of all the widgets ( QFrame 's actually) in the QSplitter . On QSplitterHandle::mousePressEvent "increase the" the maximum height, and on QSplitterHandle::mouseReleaseEvent reset the maximum height to the current. Code #! /usr/bin/python import sys from PySide import QtGui from PySide import QtCore # Custom Splitter Handle class SplitterHandle(QtGui.QSplitterHandle): QWIDGET

QGraphicsItem paint delay

帅比萌擦擦* 提交于 2019-12-11 07:23:07
问题 What could be the possible reason for this? When i zoom in the QGraphicsView and move the QGraphicsItem, I get this weird result. It does update if I zoom or pan the View again or if I focus on other widgets. Im using PySide. And the painter function is this def paint(self, painter, option, widget): if self.isSelected(): brush = self.highlight_brush pen = self.highlight_pen else: brush = self.dormant_brush pen = self.dormant_pen painter.setBrush(brush) painter.setPen(pen) painter.drawRect(0,

PyQt how to add link to QTextBrowser

喜欢而已 提交于 2019-12-11 07:19:52
问题 I don't know why I'm having such a hard time finding this, but how do you add a hyperlink to QTextEdit or QTextBrowser ? I'm trying to make something that has a list of links and when you click on a link you get the object that the link is referencing. 回答1: You need to set the acceptRichText property to true. Then you can just pass in HTML using the setHTML() slot. win.setHTML("<a href="http://foo>Bar</a>"); 来源: https://stackoverflow.com/questions/10134107/pyqt-how-to-add-link-to-qtextbrowser

Accessing a webcam from pyside / opencv

ⅰ亾dé卋堺 提交于 2019-12-11 05:52:37
问题 I have problems accessing a webcam in a pyside / opencv project. This is a stripped down example that produces the problem I face: from PySide import QtCore, QtGui import cv, cv2, time, ImageQt app = QtGui.QApplication([]) while True: camcapture = cv.CaptureFromCAM(0) cv.SetCaptureProperty(camcapture,cv.CV_CAP_PROP_FRAME_WIDTH, 1280) cv.SetCaptureProperty(camcapture,cv.CV_CAP_PROP_FRAME_HEIGHT, 720); frame = cv.QueryFrame(camcapture) image = QtGui.QImage(frame.tostring(), frame.width, frame

How do I add a layout to a Qtablewidget in pyqt?

荒凉一梦 提交于 2019-12-11 04:58:40
问题 I have my qtablewidget defined like this: def __init__(self, parent = None): super(Window, self).__init__(parent) QtGui.QWidget.__init__(self) QtGui.QTableWidget.setMinimumSize(self, 500, 500) QtGui.QTableWidget.setWindowTitle(self, "Custom table widget") self.table = QtGui.QTableWidget() rowf = 3 self.table.setColumnCount(3) self.table.setRowCount(rowf) self.table.setHorizontalHeaderItem(0, QtGui.QTableWidgetItem("col1")) self.table.setHorizontalHeaderItem(1, QtGui.QTableWidgetItem("col2"))

PySide QWebView and downloading unsupported content

ぃ、小莉子 提交于 2019-12-11 04:25:18
问题 Below is the code for a minimal browser using PySide for demoing webapps and the like. It generally functions as I'd like though I can't quite seem to get my head around how to successfully download unsupportedContent. In the Finished method self.reply.readAll() returns an empty QByteArray. Any help would be greatly appreciated. Thanks import sys import os from PySide import QtCore, QtGui, QtWebKit, QtNetwork class Browser(QtGui.QMainWindow): def __init__(self): QtGui.QMainWindow.__init__

Vertically center item's text using a delegate (PySide/Qt/PyQt)

爱⌒轻易说出口 提交于 2019-12-11 04:08:30
问题 I have a custom delegate for a QTableView that allows for the display/editing of html strings (using a QTextDocument ). There is a SSCCE below. Unfortunately, when I display the text using paint() , it is not vertically centered, but seems to top align. For instance, if I apply the delegate to the second column, but not the first, the table looks like this: My search hasn't revealed anything on how to fix this from within the delegate in a principled way. Manually adding 5 to option.rect.y()

PySide: QPushButton stays highlighted after pressing it

↘锁芯ラ 提交于 2019-12-11 03:57:07
问题 In my tool, when the user pushes a button a popup window is created. My issue is that the button that the user presses to bring up the window stays highlighted (as if I have my mouse over it) on popup creation and remains that way even after the popup is deleted. I actually like this highlight while the popup is active (it visually connects the window to the popup which is nice), but I'd like it to go away when the window is deleted. Below is an example to clarify what's happening: If I click

Nested DirectConnection Signals are causing a segfault

自闭症网瘾萝莉.ら 提交于 2019-12-11 03:20:26
问题 This is a follow-up to my unanswered question here. The code, exactly as it is below crashes with a segfault (copy/paste it into your system and run it). When I remove type=QtCore.Qt.DirectConnection from one or both of the signal constructor calls (thereby using QtCore.Qt.AutoConnection instead), everything runs the way it should: A widget appears, showing five progress bars filling up then emptying in an endless loop. from PySide import QtCore, QtGui import time class Worker(QtCore.QThread)