pyqt

QListView.indexAt in PyQt5 returning wrong index?

懵懂的女人 提交于 2021-01-28 14:49:42
问题 I'm trying to pop up a context menu when a user right-clicks on an item in a QListView and a different context menu if the user right-clicks outside of any of the items (any of the whitespace). What I'm finding is that the index I'm receiving when performing the indexAt command is not accurate, and I can't figure out why. I initialize the QListView as its own class: class RBKDataTypesTab(QWidget): def __init__(self): super().__init__() self.models = [] grid = QGridLayout() self.list =

QWizard: Change height/dimensions of title field

白昼怎懂夜的黑 提交于 2021-01-28 12:26:59
问题 I'm currently trying to implement a simple "First steps" Wizard for a Python/Qt application I'm working on. This is really easy to do with Designer, but as usual the devil lies in the details. My problem is that the 'Title' field is way too big for me (~50% of the available screen estate). Here is a screenshot, and there the *.ui-file. I've already had a look at all the QWizard/QWizardPage properties and couldn't find anything that referred to the size/styling of the 'Title' field. Is there

QWizard: Change height/dimensions of title field

杀马特。学长 韩版系。学妹 提交于 2021-01-28 12:18:56
问题 I'm currently trying to implement a simple "First steps" Wizard for a Python/Qt application I'm working on. This is really easy to do with Designer, but as usual the devil lies in the details. My problem is that the 'Title' field is way too big for me (~50% of the available screen estate). Here is a screenshot, and there the *.ui-file. I've already had a look at all the QWizard/QWizardPage properties and couldn't find anything that referred to the size/styling of the 'Title' field. Is there

Drag and Drop of subclassed QListWidgetItem

非 Y 不嫁゛ 提交于 2021-01-28 10:07:58
问题 I'm encountering some poblems trying to implement drag and drop for a custom QListWidgetItem. Here is some example code: from PyQt4 import QtGui, QtCore import sys, os class MyListWidgetItem(QtGui.QListWidgetItem): def __init__(self, label, data, parent=None): super(QtGui.QListWidgetItem, self).__init__(label, parent=parent) self.data = data def GetData(self): return self.data class MyListWidget(QtGui.QListWidget): def __init__(self, type, parent=None): super(MyListWidget, self).__init__

Drag and Drop of subclassed QListWidgetItem

元气小坏坏 提交于 2021-01-28 10:03:54
问题 I'm encountering some poblems trying to implement drag and drop for a custom QListWidgetItem. Here is some example code: from PyQt4 import QtGui, QtCore import sys, os class MyListWidgetItem(QtGui.QListWidgetItem): def __init__(self, label, data, parent=None): super(QtGui.QListWidgetItem, self).__init__(label, parent=parent) self.data = data def GetData(self): return self.data class MyListWidget(QtGui.QListWidget): def __init__(self, type, parent=None): super(MyListWidget, self).__init__

PyQt QMediaPlayer setPosition rounds the position value

梦想与她 提交于 2021-01-28 09:50:33
问题 I have an app that's designed to help synchronise an experiment video and data signals. The App has a video widget and a slider that can set the temporal position of the video. However, QMediaPlayer will only set the position at 500mSec/1000mSec intervals (in my app 500mSec/in the contrived app 1000mSec) while the video is shot at 50fps implying 20mSec intervals. This makes synchronisation pretty useless. I've added an output of the position before and after the position change. Any help

How do I enforce the minimum index of any one of multiple QComboBoxes within a for loop?

a 夏天 提交于 2021-01-28 09:22:16
问题 I have a QWizard that reads the column headers of a CSV file and makes the user choose what they want with each column. In the 2nd page of this wizard, I add the combo-boxes in a for loop that loops over the column names of the CSV. All combo-boxes are mandatory fields. However, another constraint is that at least one of them must be selected to choice 3 or above (c1 or c2 in my MWE), before the user can press "Next". In addition to self.NextButton.setEnabled(False) , I also tried using

How to resize a window from the edges after adding the property QtCore.Qt.FramelessWindowHint

会有一股神秘感。 提交于 2021-01-28 09:08:34
问题 Good night. I have seen some programs with new borderless designs and still you can make use of resizing. At the moment I know that to remove the borders of a pyqt program we use: QtCore.Qt.FramelessWindowHint And that to change the size of a window use QSizeGrip. But how can we resize a window without borders? This is the code that I use to remove the border of a window but after that I have not found information on how to do it in pyqt5. I hope you can help me with an example of how to

How to add a tab to QTabWidget using the button on the form?

雨燕双飞 提交于 2021-01-28 08:22:18
问题 I decided to write a visual form for my script. The idea is to have a button that will add new tabs to QTabWidget. It does not work and I can not find a good example. I use PyQt5. Here's a piece of what I've tried: import sys from PyQt5.QtGui import QIcon from PyQt5 import QtCore, QtWidgets class mainForm(QtWidgets.QWidget): def __init__(self): super().__init__() self.runUi() def runUi(self): self.resize(250, 150) self.move(300, 300) self.setWindowTitle('Let\'s Rock!') self.setWindowIcon

CSS doesn't work in QWebEngineView.setHtml()

我的未来我决定 提交于 2021-01-28 08:20:22
问题 I have a string obtained from rendering a Jinja template. In the template I have the absolute path to the css file. For example: <link rel='stylesheet' href="C:\Users\User\project\reports\template\css"> But, when I set the html in QWebEngineView only appear the plain HTML, without CSS. How can I make to detect the css reference? This is my code class WidgetEdificioCirsoc(QtWidgets.QWidget): def __init__(self): super().__init__() self._tab_edificio = widgets.TabEdificio() self._webview =