pyqt

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

左心房为你撑大大i 提交于 2021-02-08 08:22:48
问题 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

PyQt5: Questions about QGraphicsScene's itemAt() and focusItemChanged()

房东的猫 提交于 2021-02-08 06:54:23
问题 I have two questions: what does QTransform() mean in itemAt()? The sentence below is what it says in Qt doc, but I can't understand: deviceTransform is the transformation that applies to the view, and needs to be provided if the scene contains items that ignore transformations. why focusItemChanged signal is not working? Here is my code: import sys from PyQt5.QtGui import QTransform from PyQt5.QtWidgets import QApplication, QGraphicsItem, QGraphicsScene, QGraphicsView class Demo(QGraphicsView

Python QT Application with vlc does not show fullscreen

守給你的承諾、 提交于 2021-02-08 06:44:24
问题 I am working on an application where several vlc streams (rtsp) are shown and by double-clicking one of them, the stream should be displayed fullscreen. The application is python 3.7 using pyqt5 and vlc-qt. Code as follows: import sys import vlc from PyQt5.QtCore import * from PyQt5.QtWidgets import * from PyQt5.QtGui import * from PyQt5.QtWebEngineWidgets import * from PyQt5.QtPrintSupport import * class MainWindow(QMainWindow): def __init__(self, *args, **kwargs): super(MainWindow, self)._

PyQt4 - how to add scrollbar into tabbed windows of fixed size?

旧巷老猫 提交于 2021-02-08 06:34:51
问题 Simplest case: How do you add a scrollbar to a tabbed GUI window of fixed size? Full case: I'm working with a GUI with non-scaleable objects (scenes) in each tabbed frame, and would like the user to still be able to drag-scale the window down on itself (whereby the objects in the scene don't scale, but just get hidden as the window-drag moves over them) and a scroll bar appears. This is the minimal, working code that I've written to help exemplify: import sys from pyface.qt import QtGui,

How to create a file dialog that returns file paths for both selected files AND directories?

守給你的承諾、 提交于 2021-02-08 06:34:24
问题 I'm trying to use QFileDialog to get a list of the paths of selected folders AND directories. I know how to do one or the other using QFileDialog.getOpenFileNames and QFileDialog.getExistingDirectory , but not both at the same time. The C++ docs and other questions elsewhere didn't seem to help me no matter how much I googled. I am using PyQt5 5.14.2 and Python 3.8.2 on Windows. Edit: I've managed to conjure up the following solution not using the native Windows dialog and it works but seems

How to add notification number to a button icon?

自古美人都是妖i 提交于 2021-02-08 05:15:40
问题 I am trying to make a GUI with PyQt5. It will have a notification button with an icon. I want to add a small bubble with the number of notifications on the icon. If a number is not possible, I would like to use a red dot as a backup method. But how should I keep track of the new notifications (like a listener for notification) and change the icon while the window is running? I have been googling about this problem, but only mobile development stuff and non-PyQt5 related results come up.

How to add notification number to a button icon?

别来无恙 提交于 2021-02-08 05:07:04
问题 I am trying to make a GUI with PyQt5. It will have a notification button with an icon. I want to add a small bubble with the number of notifications on the icon. If a number is not possible, I would like to use a red dot as a backup method. But how should I keep track of the new notifications (like a listener for notification) and change the icon while the window is running? I have been googling about this problem, but only mobile development stuff and non-PyQt5 related results come up.

How to update a QTableView cell with a QCombobox selection?

不羁的心 提交于 2021-02-08 04:36:39
问题 I want to add a delegate QComboBox delegate to specific cells in some of the QTableView rows. I've found several posts on how to add the delegate, but none with examples for updating a cell with the QComboBox selection. This is what I have so far: main.ui <?xml version="1.0" encoding="UTF-8"?> <ui version="4.0"> <class>Dialog</class> <widget class="QDialog" name="Dialog"> <property name="geometry"> <rect> <x>0</x> <y>0</y> <width>350</width> <height>239</height> </rect> </property> <property

PyQt: Multiple QProcess and output

时光总嘲笑我的痴心妄想 提交于 2021-02-08 03:38:55
问题 I have a PyQt window that calls multiple executables as QProcess. How can I list the outputs of each process after the last one has finished? (something like process_result = ["result1", "result2",..]) Let us say it looks like this: for i in list_of_processes: process = QtCore.QProcess() process.start(i) I can read with process.readyReadStandardOutput() somehow but it is quite chaotic because processes run parallel. process.waitForFinished() does not work because the GUI will freeze. Also, I

What is best way to remove items from layout in pyqt

一曲冷凌霜 提交于 2021-02-07 23:30:02
问题 I am having some issue with layout in pyqt. After closing the items from the layout still if layout.count() returns the old item count. So I think .close() not really removing items from the layout. Here is a full working example. import sys from PyQt4 import QtGui,QtCore class LayoutTest(QtGui.QWidget): def __init__(self): super(LayoutTest, self).__init__() self.vvbox = QtGui.QVBoxLayout() self.dvbox = QtGui.QVBoxLayout() vbox = QtGui.QVBoxLayout() vbox.addLayout(self.vvbox) vbox.addLayout