pyqt

Semi-Interactive Pandas Dataframe in a GUI

馋奶兔 提交于 2021-02-17 03:43:52
问题 There are a number of excellent answers to this question GUIs for displaying dataframes, but what I'm looking to do is a bit more advanced. I'd like to display a dataframe, but have a couple of the columns be interactive where the user can manually overwrite values (and the rest be static). It would be useful to have "total" rows that change with the overwritten values and eventually have some interactive buttons around the dataframe for loading and clearing data. QTPandas looks promising,

Emiting QTableWidgetItem specific signal on being clicked

China☆狼群 提交于 2021-02-17 02:52:06
问题 I want to implement the functionality that multiple QTableWidgetItems inside of a QTableWidget can be selected and unselected so that the values and "positions" of those QTableWidgetItems is known for further use. Inside of the QTableWidget there are some empty cells, for aesthetics/spacing, which should be ignored by the functionality I'm trying to implement. But that could also easily be done afterwards by checking if a selected item does have content. self.table_widget.itemClicked.connect

mouse release event on entire screen

痞子三分冷 提交于 2021-02-17 02:48:46
问题 I have a pyqt widget that is shown over all windows when launched. I need it to keep unclosed until user decides to. Is that possible to catch mouse release event every time mouseclick performed no matter where it was done: inside QtWidget window or outside of it? Here is a sample I use: class Release_check(QWidget): def __init__(self): super().__init__() self.initUI() def initUI(self): self.canvas = iface.mapCanvas() self.setWindowFlags(self.windowFlags() | QtCore.Qt.WindowStaysOnTopHint)

QFileSystemModel QTableView Date Modified highlighting

て烟熏妆下的殇ゞ 提交于 2021-02-16 20:54:06
问题 I am trying to make a little file browser using QFileSystemModel and QTableView. I was wondering if it is possible to highlight rows with same value in "Date Modified" column, for instance if I have two or more files which been modified today row gets highlighted in green, those modified yesterday highlighted in green but lighter shade, etc. 回答1: To change the background color there are several options such as: override the data() method of the model so that the return value associated with

function call through signal changes default keyed arguments to 'False'. Why?

≯℡__Kan透↙ 提交于 2021-02-16 20:21:06
问题 When calling a function via a signal connection as in mybutton.clicked.connect(myfunction) the function is called with all its arguments set to False. Even though default arguments have been set. Is this the expected behavior? The code below shows a simple example. For my particular case having all arguments set to False is not a big issue as I can simply catch it with an if statement. However I feel that knowledge on why it is implemented this way may be helpful for further projects. This

How do i use QComboBox.setPlaceholderText?

左心房为你撑大大i 提交于 2021-02-16 17:59:28
问题 In Qt 5.15 the placeholderText property was introduced - link to documentation However using setPlaceholderText doesn't do anything for me . When running the code below i don't get any text in the QComboBox (unless of course i select one of the three items) Is this a bug or am i missing something? How can i make this work? import sys from PyQt5 import QtWidgets from PyQt5 import QtCore class MainWindow(QtWidgets.QMainWindow): def __init__(self): super().__init__() central_w = QtWidgets

PyQt4 filter by text on a QListView using setRowHidden

烈酒焚心 提交于 2021-02-16 15:09:25
问题 I have a dialog which looks like this: That dialog has the following code connected to the filter button: class Dialog(QtGui.QDialog, addWin.Ui_Dialog): ... self.list = QListView() self.filter.clicked.connect(self.filterClicked) ... def filterClicked(self): filter_text = str(self.lineEdit.text()).lower() for row in range(self.model.rowCount()): if filter_text in str(self.model.item(row).text()).lower(): self.list.setRowHidden(row, True) else: self.list.setRowHidden(row, False) However, when I

PyQt4 filter by text on a QListView using setRowHidden

∥☆過路亽.° 提交于 2021-02-16 15:08:58
问题 I have a dialog which looks like this: That dialog has the following code connected to the filter button: class Dialog(QtGui.QDialog, addWin.Ui_Dialog): ... self.list = QListView() self.filter.clicked.connect(self.filterClicked) ... def filterClicked(self): filter_text = str(self.lineEdit.text()).lower() for row in range(self.model.rowCount()): if filter_text in str(self.model.item(row).text()).lower(): self.list.setRowHidden(row, True) else: self.list.setRowHidden(row, False) However, when I

KeyEvent in MainWindow (PyQt4)

[亡魂溺海] 提交于 2021-02-16 11:40:15
问题 I'm trying to to build a GUI with PyQt4 and control some actions with the arrow keys. Nevertheless I fail to get the keystrokes. It have to be a simple issue, but I newbie to this. So any help will be appreciated. Thanks! import sys from PyQt4 import QtCore, QtGui class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(910, 500) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8(

KeyEvent in MainWindow (PyQt4)

早过忘川 提交于 2021-02-16 11:36:15
问题 I'm trying to to build a GUI with PyQt4 and control some actions with the arrow keys. Nevertheless I fail to get the keystrokes. It have to be a simple issue, but I newbie to this. So any help will be appreciated. Thanks! import sys from PyQt4 import QtCore, QtGui class Ui_MainWindow(object): def setupUi(self, MainWindow): MainWindow.setObjectName(_fromUtf8("MainWindow")) MainWindow.resize(910, 500) self.centralwidget = QtGui.QWidget(MainWindow) self.centralwidget.setObjectName(_fromUtf8(