pyqt

Uppercase input in QLineEdit python way

给你一囗甜甜゛ 提交于 2021-02-10 08:09:07
问题 I had drawn up an UI using the QT Designer but found out that there are no parameters for me to set QLineEdit inputs to be uppercase. After doing some online searching, I have only seen a very few handful of results that cater to my needs, however all are coded in Qt. Example, this link And so, are there ways for me to do this in the pythonic way? 回答1: Try this, I believe this serves your purpose. I won't call it much pythonic. More like PyQt override. #minor code edit from PyQt4 import QtGui

Uppercase input in QLineEdit python way

笑着哭i 提交于 2021-02-10 08:08:28
问题 I had drawn up an UI using the QT Designer but found out that there are no parameters for me to set QLineEdit inputs to be uppercase. After doing some online searching, I have only seen a very few handful of results that cater to my needs, however all are coded in Qt. Example, this link And so, are there ways for me to do this in the pythonic way? 回答1: Try this, I believe this serves your purpose. I won't call it much pythonic. More like PyQt override. #minor code edit from PyQt4 import QtGui

Drag items between QTreeWidget and QListWidget in PyQt5?

大憨熊 提交于 2021-02-10 07:13:23
问题 I have a QListWidget and a QTreeWidget and I want to be able to drag one or multiple list items around within each one as well as between them. I have the internal drag and drop working, but I'm not sure how to drag between them. When I print event.mimeData().formats() in my code below it says ['application/x-qabstractitemmodeldatalist'] . I am stuck on how to extract the text and index of that item (it should be a QListWidgetItem or QTreeWidgetItem, right?) so I can delete the original from

Drag items between QTreeWidget and QListWidget in PyQt5?

拈花ヽ惹草 提交于 2021-02-10 07:09:20
问题 I have a QListWidget and a QTreeWidget and I want to be able to drag one or multiple list items around within each one as well as between them. I have the internal drag and drop working, but I'm not sure how to drag between them. When I print event.mimeData().formats() in my code below it says ['application/x-qabstractitemmodeldatalist'] . I am stuck on how to extract the text and index of that item (it should be a QListWidgetItem or QTreeWidgetItem, right?) so I can delete the original from

Mouse movements too fast for `mouseMoveEvent()`

♀尐吖头ヾ 提交于 2021-02-10 05:21:25
问题 The following Python 3 resp. UI XML code shows 4 QProgessBar for each mouse direction (labeled X+, X-, Y+, Y-). Fast mouse movements (in circles) will make the 4 QProgessBar move up to 99% and then some of the QProgessBar take a break until the mouse movements are slowed down to finally reach 100%. What's the reason for this behavior ? How can the code be fixed so that no QProgessBar takes a break at 99% ? main.py import sys from PyQt5.QtCore import Qt from PyQt5.QtGui import QCursor from

How to Add Dynamic Data to a QML Table

三世轮回 提交于 2021-02-09 11:46:22
问题 I'm trying to add rows to a table from Python. I'm using a TableView described with QML. I can't figure out how to add a model to the table, unless the model is also in QML. But I can't figure out how to add values to the model. import sys from PyQt5.QtCore import QAbstractTableModel, QObject, QUrl from PyQt5.QtQml import QQmlApplicationEngine from PyQt5.QtQuick import QQuickView from PyQt5.QtWidgets import QApplication myApp = QApplication(sys.argv) engine = QQmlApplicationEngine() context =

QtGui.QMovie gif stops when function executes

时间秒杀一切 提交于 2021-02-08 11:24:17
问题 I want to show a loading gif until a function is completed. The code I have is self.LoadingGif = QtGui.QLabel(MainWindow) movie = QtGui.QMovie("hashUpdate.gif") self.LoadingGif.setMovie(movie) self.LoadingGif.setAlignment(QtCore.Qt.AlignCenter) self.gridLayout_2.addWidget(self.LoadingGif, 4, 1, 1, 1) movie.start() self.MYFUNCTION() The problem is that the gif shows but it is not playing. It starts to play only when the function is completed. How can I make the gif play while the function is

PyQt5 from QLineEdit to variable [duplicate]

笑着哭i 提交于 2021-02-08 10:24:30
问题 This question already has answers here : How to get text in QlineEdit when QpushButton is pressed in a string? (3 answers) Closed 2 years ago . I have created a simple PyQt5 User Interface that looks like this: import sys from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QLineEdit class App(QWidget): def __init__(self): super().__init__() self.title = 'Test' self.left = 10 self.top = 10 self.width = 400 self.height = 500 self.initUI() def initUI(self): self.setWindowTitle(self

PyQt5 from QLineEdit to variable [duplicate]

泄露秘密 提交于 2021-02-08 10:23:18
问题 This question already has answers here : How to get text in QlineEdit when QpushButton is pressed in a string? (3 answers) Closed 2 years ago . I have created a simple PyQt5 User Interface that looks like this: import sys from PyQt5.QtWidgets import QApplication, QPushButton, QWidget, QLineEdit class App(QWidget): def __init__(self): super().__init__() self.title = 'Test' self.left = 10 self.top = 10 self.width = 400 self.height = 500 self.initUI() def initUI(self): self.setWindowTitle(self

How to display 2 SQLite tables with one to many relation into one QTableWidget

主宰稳场 提交于 2021-02-08 08:23:09
问题 I have following two tables in Db, with one to many relationship: self.c.execute("CREATE TABLE IF NOT EXISTS dispatch(" "id_dispatch INTEGER PRIMARY KEY AUTOINCREMENT," "d_date TEXT," "d_mill TEXT," "d_buyer TEXT," "d_addFreight INTEGER," "d_subFreight INTEGER," "d_amount INTEGER," "d_cd INTEGER," "d_comm INTEGER," "d_netAmount INTEGER)") self.c.execute("CREATE TABLE IF NOT EXISTS dispatch_products(" "dispatch_id INTEGER NOT NULL REFERENCES DISPATCH(id_dispatch)," "product INTEGER," "quantity