pyqt5

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 =

Adjust indents in QTableWidget cells and header items

风格不统一 提交于 2021-01-28 14:13:00
问题 I would like to align texts in a QTableWidget on the left side, but I would also like to add an indent so the text isn't stuck against the border. On the image, col_2 is what I want. And I would like the same for the header labels. from PyQt5 import QtCore, QtGui, QtWidgets from PyQt5.QtWidgets import QTableWidgetItem class Ui_Form(object): def setupUi(self, Form): Form.setObjectName("Form") Form.resize(400, 300) self.gridLayout = QtWidgets.QGridLayout(Form) self.gridLayout.setObjectName(

pyqt5 can't apply border to framelesswindow

半腔热情 提交于 2021-01-28 12:30:41
问题 I applied border width and border color via setStyleSheet funciton in pyqt5. But when I use it in frameless window, border not applied. any issue in my code? I need help. Here comes my code. import sys from PyQt5.QtWidgets import QWidget,QApplication from PyQt5.QtCore import Qt,QPoint class CommonFramelessWidget(QWidget): def __init__(self,parent): super(CommonFramelessWidget,self).__init__(parent) self.setWindowFlags(Qt.Window|Qt.FramelessWindowHint) self.setStyleSheet('border:5px black;

pyqt5 can't apply border to framelesswindow

坚强是说给别人听的谎言 提交于 2021-01-28 12:18:38
问题 I applied border width and border color via setStyleSheet funciton in pyqt5. But when I use it in frameless window, border not applied. any issue in my code? I need help. Here comes my code. import sys from PyQt5.QtWidgets import QWidget,QApplication from PyQt5.QtCore import Qt,QPoint class CommonFramelessWidget(QWidget): def __init__(self,parent): super(CommonFramelessWidget,self).__init__(parent) self.setWindowFlags(Qt.Window|Qt.FramelessWindowHint) self.setStyleSheet('border:5px black;

Why get's Python with PyQt5 slow when creating a large amount of QPushButtons?

此生再无相见时 提交于 2021-01-28 12:10:39
问题 I am building a larger program in PyQt5. I want to create a large number of clickable QPushButtons in a ScrollArea. As far as I can see it, the program works so far, but gets very slow, when the number of buttons gets high (about 10,000 to 20,000 characters). How can I ensure that this program builds these buttons responsive? I need to load textfiles separated by chars as QPushButtons which are usually about 15-20 kb large (sometimes up to 50 kb). I believe, this should not be a size

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 make tabbed browser with qwebengine

我的未来我决定 提交于 2021-01-28 09:20:42
问题 I have some pyqt5 code that I am trying to make tabbed browser and how when I click target _blank link it opens in new tab with that link. Also, As I am still new to PyQt5 and practicing thorugh this project so I need some help.In the code I have 3 classes one holds mainwindow and one holds webview and one holds webpage. Here is the code: class Ui_MainWindow(QMainWindow): def __init__(self): super(Ui_MainWindow, self).__init__() self.setupUi(self) def setupUi(self, MainWindow): self

how to make tabbed browser with qwebengine

南笙酒味 提交于 2021-01-28 09:12:00
问题 I have some pyqt5 code that I am trying to make tabbed browser and how when I click target _blank link it opens in new tab with that link. Also, As I am still new to PyQt5 and practicing thorugh this project so I need some help.In the code I have 3 classes one holds mainwindow and one holds webview and one holds webpage. Here is the code: class Ui_MainWindow(QMainWindow): def __init__(self): super(Ui_MainWindow, self).__init__() self.setupUi(self) def setupUi(self, MainWindow): self

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