From Cristian.Maureira-Fredes at qt.io Tue Aug 9 19:04:26 2022 From: Cristian.Maureira-Fredes at qt.io (=?UTF-8?Q?Cristi=c3=a1n_Maureira-Fredes?=) Date: Tue, 9 Aug 2022 19:04:26 +0200 Subject: [PySide] Packaging Qt for Python for *Linux Message-ID: <8a94b149-b48d-fa49-d6b5-8d5a5c175fbc@qt.io> Hey there, In case you are currently maintaining shiboken/pyside for a *Linux OS, you might want to check a couple of issues that were recently reported by the person currently in charge of packaging Shiboken and PySide for Debian (thanks Lisandro!) We have interacted in the past with folks maintaining the packages for Fedora and Arch, but maybe someone else is on this list. These issues contain some discussion on them: https://bugreports.qt.io/browse/PYSIDE-2001 (signature_p.h, fixed) https://bugreports.qt.io/browse/PYSIDE-2002 (shiboken path) https://bugreports.qt.io/browse/PYSIDE-2003 (get_path scheme change) https://bugreports.qt.io/browse/PYSIDE-2005 (soon to be merged) https://bugreports.qt.io/browse/PYSIDE-2009 (cmake dir name change) https://bugreports.qt.io/browse/PYSIDE-2010 (arch qualified so) https://bugreports.qt.io/browse/PYSIDE-2020 (installation path) Even if you have no problem with the suggested solution or build process change, please let us know as well with a comment. The changes might break your current packaging workflow, so your opinion is crucial. Thanks for your time! -- Dr. Cristi?n Maureira-Fredes Senior R&D Manager The Qt Company GmbH Erich-Thilo-Str. 10 D-12489 Berlin Gesch?ftsf?hrer: Mika P?lsi, Juha Varelius, Jouni Lintunen Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B From frank at ohufx.com Thu Aug 25 10:36:01 2022 From: frank at ohufx.com (Frank Rueter) Date: Thu, 25 Aug 2022 20:36:01 +1200 Subject: [PySide] editing selected cells in QTabelWidget Message-ID: Hi all, I have a simple table which will never hold much data, so I opted for QTabelWidget rather than QTabelView. Two columns have combo boxes set as cell widgets; all other cells house straight up strings. I have set the selection behaviour to QAbstractItemView.SelectRows and am now trying to figure out how to enable editing of selected cells, so that the user can select multiple rows, then double click a cell in that selection and edit it, which will cause all other cells in the same column within the selection to receive the new value. I have hit a couple of issues: 1. By default the selection is reset when I double click in a cell, so I assume I will have to override QTableWidget.mousePressEvent() to prevent that somehow. Any suggestions on how to best manage that best? I am not sure what I need to re-implement to just prevent the selection being reset. 2. the cell widgets do not modify the actual cell item's value. Do I need to manually connect the widgets to a slot that will do that or is there a better way to do that? Is there an example for this sort of functionality out there? I am trying not to use the lower level model/view classes in this case if possible. Any help would be greatly appreciated. Cheers, frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From dc at dcsoft.com Thu Aug 25 18:51:14 2022 From: dc at dcsoft.com (David Ching) Date: Thu, 25 Aug 2022 09:51:14 -0700 Subject: [PySide] editing selected cells in QTabelWidget In-Reply-To: References: Message-ID: <037001d8b8a2$e3bee1a0$ab3ca4e0$@dcsoft.com> > Date: Thu, 25 Aug 2022 20:36:01 +1200 > From: Frank Rueter > Subject: [PySide] editing selected cells in QTabelWidget > Hi all, > > I have a simple table which will never hold much data, so I opted for QTabelWidget rather than QTabelView. > Two columns have combo boxes set as cell widgets; all other cells house straight up strings. > > I have set the selection behaviour to QAbstractItemView.SelectRows and am now trying to figure out how to enable > editing of selected cells, so that the user can select multiple rows, then double click a cell in that selection and edit it, > which will cause all other cells in the same column within the selection to receive the new value. > > I have hit a couple of issues: > > 1. By default the selection is reset when I double click in a cell, so I assume I will have to override QTableWidget.mousePressEvent() to prevent that somehow. Any suggestions on how to best manage that best? I am not sure what I need to re-implement to just prevent the selection being reset. In general, double clicking on a multiple selection doesn't work since as you note, the first click (of the double click) selects the single item that was clicked and de-selects the other items. To edit multiple selected items (my app runs on Windows) I select them and then start editing by pressing F2 (which Excel uses similarly) or a toolbar button, or right-clicking one of the selected items which opens a context menu with an Edit item. > 2. the cell widgets do not modify the actual cell item's value. Do I > need to manually connect the widgets to a slot that will do that or is > there a better way to do that? I had a similar task: MyTableWidget::MyTableWidget(QWidget *parent) : QTableWidget(parent) { m_delegate = new MyTableItemDelegate(); // MyTableItemDelegate is derived from QStyledItemDelegate setItemDelegate(m_delegate); } MyTableItemDelegate overrides createEditor(), setEditorData(), setModelData(), updateEditorGeometry(). Apologies, this code is in C++. It has been years since I developed this code, so don't know more details off the top of my head. Hope this helps, David From frank at ohufx.com Thu Aug 25 21:58:46 2022 From: frank at ohufx.com (Frank Rueter) Date: Fri, 26 Aug 2022 07:58:46 +1200 Subject: [PySide] editing selected cells in QTabelWidget In-Reply-To: <037001d8b8a2$e3bee1a0$ab3ca4e0$@dcsoft.com> References: <037001d8b8a2$e3bee1a0$ab3ca4e0$@dcsoft.com> Message-ID: Thanks David, I was thinking about a right click option as a Plan B. Will do that. I will look into using a delegate as well. I had forgotten I could use those with the TableWidget as well. Thanks! Frank On Fri, Aug 26, 2022 at 4:52 AM David Ching wrote: > > Date: Thu, 25 Aug 2022 20:36:01 +1200 > > From: Frank Rueter > > Subject: [PySide] editing selected cells in QTabelWidget > > Hi all, > > > > I have a simple table which will never hold much data, so I opted for > QTabelWidget rather than QTabelView. > > Two columns have combo boxes set as cell widgets; all other cells house > straight up strings. > > > > I have set the selection behaviour to QAbstractItemView.SelectRows and am > now trying to figure out how to enable > > editing of selected cells, so that the user can select multiple rows, > then double click a cell in that selection and edit it, > > which will cause all other cells in the same column within the selection > to receive the new value. > > > > I have hit a couple of issues: > > > > 1. By default the selection is reset when I double click in a cell, so I > assume I will have to override QTableWidget.mousePressEvent() to prevent > that somehow. Any suggestions on how to best manage that best? I am not > sure what I need to re-implement to just prevent the selection being > reset. > > In general, double clicking on a multiple selection doesn't work since as > you note, the first click (of the double click) selects the single item > that > was clicked and de-selects the other items. To edit multiple selected > items > (my app runs on Windows) I select them and then start editing by pressing > F2 > (which Excel uses similarly) or a toolbar button, or right-clicking one of > the selected items which opens a context menu with an Edit item. > > > > 2. the cell widgets do not modify the actual cell item's value. Do I > > need to manually connect the widgets to a slot that will do that or is > > there a better way to do that? > > I had a similar task: > > MyTableWidget::MyTableWidget(QWidget *parent) : QTableWidget(parent) > { > m_delegate = new MyTableItemDelegate(); // MyTableItemDelegate is > derived from QStyledItemDelegate > setItemDelegate(m_delegate); > } > > MyTableItemDelegate overrides createEditor(), setEditorData(), > setModelData(), updateEditorGeometry(). > > Apologies, this code is in C++. It has been years since I developed this > code, so don't know more details off the top of my head. > > Hope this helps, > David > > > > _______________________________________________ > PySide mailing list > PySide at qt-project.org > https://lists.qt-project.org/listinfo/pyside > -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank at ohufx.com Fri Aug 26 09:04:55 2022 From: frank at ohufx.com (Frank Rueter) Date: Fri, 26 Aug 2022 19:04:55 +1200 Subject: [PySide] editing selected cells in QTabelWidget In-Reply-To: References: <037001d8b8a2$e3bee1a0$ab3ca4e0$@dcsoft.com> Message-ID: So I made some progress but am now having the problem that a right click on a persistent editor (combo box) will lose the current table selection. I tried reimplementing the mousePressEvent on both the editor widget and the actual table widget to stop that behaviour but to no avail. Here is a simplified version of the code that shows the problem: https://pastebin.com/M9RSTFSJ [image: image.png] What I am trying to achieve is that a right click on the editor ithe "Type" column will keep the current row selection, so that I can then pop up the editor and apply the new value to all selected rows. What am I missing? Cheers, frank On Fri, Aug 26, 2022 at 7:58 AM Frank Rueter wrote: > Thanks David, > I was thinking about a right click option as a Plan B. Will do that. > I will look into using a delegate as well. I had forgotten I could use > those with the TableWidget as well. > > Thanks! > Frank > > > On Fri, Aug 26, 2022 at 4:52 AM David Ching wrote: > >> > Date: Thu, 25 Aug 2022 20:36:01 +1200 >> > From: Frank Rueter >> > Subject: [PySide] editing selected cells in QTabelWidget >> > Hi all, >> > >> > I have a simple table which will never hold much data, so I opted for >> QTabelWidget rather than QTabelView. >> > Two columns have combo boxes set as cell widgets; all other cells house >> straight up strings. >> > >> > I have set the selection behaviour to QAbstractItemView.SelectRows and >> am >> now trying to figure out how to enable >> > editing of selected cells, so that the user can select multiple rows, >> then double click a cell in that selection and edit it, >> > which will cause all other cells in the same column within the >> selection >> to receive the new value. >> > >> > I have hit a couple of issues: >> > >> > 1. By default the selection is reset when I double click in a cell, so >> I >> assume I will have to override QTableWidget.mousePressEvent() to >> prevent >> that somehow. Any suggestions on how to best manage that best? I am not >> sure what I need to re-implement to just prevent the selection being >> reset. >> >> In general, double clicking on a multiple selection doesn't work since as >> you note, the first click (of the double click) selects the single item >> that >> was clicked and de-selects the other items. To edit multiple selected >> items >> (my app runs on Windows) I select them and then start editing by pressing >> F2 >> (which Excel uses similarly) or a toolbar button, or right-clicking one of >> the selected items which opens a context menu with an Edit item. >> >> >> > 2. the cell widgets do not modify the actual cell item's value. Do I >> > need to manually connect the widgets to a slot that will do that or >> is >> > there a better way to do that? >> >> I had a similar task: >> >> MyTableWidget::MyTableWidget(QWidget *parent) : QTableWidget(parent) >> { >> m_delegate = new MyTableItemDelegate(); // MyTableItemDelegate is >> derived from QStyledItemDelegate >> setItemDelegate(m_delegate); >> } >> >> MyTableItemDelegate overrides createEditor(), setEditorData(), >> setModelData(), updateEditorGeometry(). >> >> Apologies, this code is in C++. It has been years since I developed this >> code, so don't know more details off the top of my head. >> >> Hope this helps, >> David >> >> >> >> _______________________________________________ >> PySide mailing list >> PySide at qt-project.org >> https://lists.qt-project.org/listinfo/pyside >> > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image.png Type: image/png Size: 9971 bytes Desc: not available URL: From keith.kyzivat at qt.io Fri Aug 26 16:38:48 2022 From: keith.kyzivat at qt.io (Keith Kyzivat) Date: Fri, 26 Aug 2022 14:38:48 +0000 Subject: [PySide] editing selected cells in QTabelWidget In-Reply-To: References: <037001d8b8a2$e3bee1a0$ab3ca4e0$@dcsoft.com> Message-ID: Hi Frank, You should be able to suppress the single click deselect using an event filter. You create (or use an existing) QObject that will receive all events that are sent to the QObject that you install the event filter on, and from that, you define an `eventFilter(obj: QObject, event: QEvent) -> bool` method on that which will do the event filtering. From that method, you can look at the events type, looking for `QEvent.MouseButtonPress` or `QEvent.MouseButtonRelease` (not sure which is actually triggering the unselect), and just return `True` from the event filter in those cases. All other cases, you just return the parent?s implementation of eventFilter, passing the same object and event. This way you achieve suppression of the mousePress and mouseRelease. (I tried my best to translate these to Python, but these might not be 100% correct). ~Keith From: PySide On Behalf Of Frank Rueter Sent: Friday, August 26, 2022 3:05 AM To: David Ching Cc: pyside at qt-project.org Subject: Re: [PySide] editing selected cells in QTabelWidget So I made some progress but am now having the problem that a right click on a persistent editor (combo box) will lose the current table selection. I tried reimplementing the mousePressEvent on both the editor widget and the actual table widget to stop that behaviour but to no avail. Here is a simplified version of the code that shows the problem: https://pastebin.com/M9RSTFSJ [cid:image001.png at 01D8B937.5E6EA900] What I am trying to achieve is that a right click on the editor ithe "Type" column will keep the current row selection, so that I can then pop up the editor and apply the new value to all selected rows. What am I missing? Cheers, frank On Fri, Aug 26, 2022 at 7:58 AM Frank Rueter > wrote: Thanks David, I was thinking about a right click option as a Plan B. Will do that. I will look into using a delegate as well. I had forgotten I could use those with the TableWidget as well. Thanks! Frank On Fri, Aug 26, 2022 at 4:52 AM David Ching > wrote: > Date: Thu, 25 Aug 2022 20:36:01 +1200 > From: Frank Rueter > > Subject: [PySide] editing selected cells in QTabelWidget > Hi all, > > I have a simple table which will never hold much data, so I opted for QTabelWidget rather than QTabelView. > Two columns have combo boxes set as cell widgets; all other cells house straight up strings. > > I have set the selection behaviour to QAbstractItemView.SelectRows and am now trying to figure out how to enable > editing of selected cells, so that the user can select multiple rows, then double click a cell in that selection and edit it, > which will cause all other cells in the same column within the selection to receive the new value. > > I have hit a couple of issues: > > 1. By default the selection is reset when I double click in a cell, so I assume I will have to override QTableWidget.mousePressEvent() to prevent that somehow. Any suggestions on how to best manage that best? I am not sure what I need to re-implement to just prevent the selection being reset. In general, double clicking on a multiple selection doesn't work since as you note, the first click (of the double click) selects the single item that was clicked and de-selects the other items. To edit multiple selected items (my app runs on Windows) I select them and then start editing by pressing F2 (which Excel uses similarly) or a toolbar button, or right-clicking one of the selected items which opens a context menu with an Edit item. > 2. the cell widgets do not modify the actual cell item's value. Do I > need to manually connect the widgets to a slot that will do that or is > there a better way to do that? I had a similar task: MyTableWidget::MyTableWidget(QWidget *parent) : QTableWidget(parent) { m_delegate = new MyTableItemDelegate(); // MyTableItemDelegate is derived from QStyledItemDelegate setItemDelegate(m_delegate); } MyTableItemDelegate overrides createEditor(), setEditorData(), setModelData(), updateEditorGeometry(). Apologies, this code is in C++. It has been years since I developed this code, so don't know more details off the top of my head. Hope this helps, David _______________________________________________ PySide mailing list PySide at qt-project.org https://lists.qt-project.org/listinfo/pyside -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: image001.png Type: image/png Size: 9971 bytes Desc: image001.png URL: From frank at ohufx.com Sat Aug 27 00:30:41 2022 From: frank at ohufx.com (Frank Rueter) Date: Sat, 27 Aug 2022 10:30:41 +1200 Subject: [PySide] PySide2 on OSX 12.5.1 not working? Message-ID: Hi all, I just set up PySide2 on my laptop but when I run a simple test like the below all I get is an empty window which freezes/beachballs straight away. No messages in the Console app or my python interpreter so I have no idea what is going on. I installed pyside2 into a virtual env as usual: python3.7 -m venv venv_pyside2 followed by: source venv_pyside2/bin/activate Then ran this test code: from PySide2 import QtWidgets import sys args = sys.argv app = QtWidgets.QApplication(args) w = QtWidgets.QMessageBox() w.setText("Test") w.show() sys.exit(app.exec_()) Any ideas why PySide2 will just beachball? I used to do a lot of PySide on my laptop but that was on older OSX versions, so I suspect some insanely paranoid security settings in the latest version. Cheers, frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank at ohufx.com Tue Aug 30 00:08:07 2022 From: frank at ohufx.com (Frank Rueter) Date: Tue, 30 Aug 2022 10:08:07 +1200 Subject: [PySide] signal connection only works with lambda Message-ID: Hi all, probably a pre-coffee hiccup: I have this weird issue where my signal connection only works when utilising lambda, even though the data type sent by the signal is exactly what the receiving slot needs. This is my code: In a worker class (QRunnable) I emit this signal * tasks_data_available = QtCore.Signal(list)* In my main widget I connect it like this: * worker.tasks_data_available.connect(self.__prep_task_data)* the slot looks like this: * def __prep_task_data(self, task_list):* * print(task_list)* I have done this countless times, but for some reason in this case the code never calls the slot when the QRunnable emits task_list. When I do this it works though: * worker.tasks_data_available.connect(lambda t: self.__prep_task_data(t))* What am I missing? I should not have to use lambda in this case. Cheers, frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From dc at dcsoft.com Tue Aug 30 01:35:39 2022 From: dc at dcsoft.com (David Ching) Date: Mon, 29 Aug 2022 16:35:39 -0700 Subject: [PySide] PySide2 on OSX 12.5.1 not working? In-Reply-To: References: Message-ID: <07a701d8bc00$0c753760$255fa620$@dcsoft.com> > Date: Sat, 27 Aug 2022 10:30:41 +1200 > From: Frank Rueter > Subject: [PySide] PySide2 on OSX 12.5.1 not working? > > Hi all, > > I just set up PySide2 on my laptop but when I run a simple test like the below all I get is an empty window which freezes/beachballs straight away. ... > from PySide2 import QtWidgets Are you sure you want PySide2 and not PySide6? I did a test on OSX 12.5.1 with Python 3.10 and it works with PySide6. Thanks, David From frank at ohufx.com Tue Aug 30 02:06:13 2022 From: frank at ohufx.com (Frank Rueter) Date: Tue, 30 Aug 2022 12:06:13 +1200 Subject: [PySide] PySide2 on OSX 12.5.1 not working? In-Reply-To: <07a701d8bc00$0c753760$255fa620$@dcsoft.com> References: <07a701d8bc00$0c753760$255fa620$@dcsoft.com> Message-ID: I'd prefer PySide2 as our industry is using that as the standard for all DCC apps which is what I am mostly developing things for. Will try PySide6 though just to see if that is the issue. Cheers, frank On Tue, Aug 30, 2022 at 11:36 AM David Ching wrote: > > Date: Sat, 27 Aug 2022 10:30:41 +1200 > > From: Frank Rueter > > Subject: [PySide] PySide2 on OSX 12.5.1 not working? > > > > Hi all, > > > > I just set up PySide2 on my laptop but when I run a simple test like the > below all I get is an empty window which freezes/beachballs straight away. > ... > > from PySide2 import QtWidgets > > Are you sure you want PySide2 and not PySide6? I did a test on OSX 12.5.1 > with Python 3.10 and it works with PySide6. > > Thanks, > David > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From frank at ohufx.com Tue Aug 30 07:48:19 2022 From: frank at ohufx.com (Frank Rueter) Date: Tue, 30 Aug 2022 17:48:19 +1200 Subject: [PySide] Can't override paintEvent on QTableWidget Message-ID: Hi all, I am trying to override the paintEvent in a QTableWidget to draw a custom progressbar into the table area until the table data is loaded. I have done this with other widgets in the past but the table widget won't let me do this. I am getting these errors: QWidget::paintEngine: Should no longer be called QPainter::begin: Paint device returned engine == 0, type: 1 QPainter::setBrush: Painter not active Here is a simple code snippet for testing: https://gist.github.com/frueter/a5b722926a847c291d1472a6fd145dbf When I inherit from QWidget it works fine. Is this sort of thing not possible with a QTableWidget? Cheers, frank -------------- next part -------------- An HTML attachment was scrubbed... URL: From Cristian.Maureira-Fredes at qt.io Tue Aug 30 09:21:08 2022 From: Cristian.Maureira-Fredes at qt.io (=?UTF-8?Q?Cristi=c3=a1n_Maureira-Fredes?=) Date: Tue, 30 Aug 2022 09:21:08 +0200 Subject: [PySide] signal connection only works with lambda In-Reply-To: References: Message-ID: <41b018a3-93a9-f5de-8581-1c785969763f@qt.io> On 8/30/22 00:08, Frank Rueter wrote: > Hi all, > Hey Frank, > probably a pre-coffee hiccup: > I have this weird issue where my signal connection only works when > utilising lambda, even though the data type sent by the signal is > exactly what the receiving slot needs. > This is my code: > > In a worker class (QRunnable) I emit this signal > *? ? tasks_data_available = QtCore.Signal(list) > * > Just a sanity check: That's declared inside a class, but not inside any method, right? > In my main widget I connect it like this: > *? ? ? ? worker.tasks_data_available.connect(self.__prep_task_data) > * > the slot looks like this: > *? ? def __prep_task_data(self, task_list): > * > *? ? ? ? print(task_list)* Is this method decorated with a `@Slot(list)` ? @Slot(list) def __prep_task_data(elf, task_list): ... > I have done this countless times, but for some reason?in this case the > code never calls the slot when the QRunnable emits task_list. > > When I do this it works though: > *? ? ? ? worker.tasks_data_available.connect(lambda t: > self.__prep_task_data(t)) > * This might be due to the lazy registration of the lambda as a Slot, without properly going through the Slot-registration process. > What am I missing? I should not have to use lambda in this case. It might be the missing @Slot, but let me know if that's not the case. > Cheers, > frank Cheers -- Dr. Cristi?n Maureira-Fredes Senior R&D Manager The Qt Company GmbH Erich-Thilo-Str. 10 D-12489 Berlin Gesch?ftsf?hrer: Mika P?lsi, Juha Varelius, Jouni Lintunen Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B From Cristian.Maureira-Fredes at qt.io Tue Aug 30 09:37:31 2022 From: Cristian.Maureira-Fredes at qt.io (=?UTF-8?Q?Cristi=c3=a1n_Maureira-Fredes?=) Date: Tue, 30 Aug 2022 09:37:31 +0200 Subject: [PySide] Can't override paintEvent on QTableWidget In-Reply-To: References: Message-ID: On 8/30/22 07:48, Frank Rueter wrote: > Hi all, Hey there, > I am trying to override the paintEvent in a QTableWidget to draw a > custom progressbar into the table area until the table data is loaded. I > have done this with other widgets in the past but the table widget won't > let me do this. > I am getting these errors: > QWidget::paintEngine: Should no longer be called > QPainter::begin: Paint device returned engine == 0, type: 1 > QPainter::setBrush: Painter not active > > Here is a simple code snippet for testing: > https://gist.github.com/frueter/a5b722926a847c291d1472a6fd145dbf > > > When I inherit from QWidget it works fine. > Is this sort of thing not possible with a QTableWidget? It's because QTableWidget is a subclass of QTableView (and that's one from QAbstractScrollArea), and AFAIK you need to open the painter based on the base viewport. https://doc.qt.io/qt-6/qabstractscrollarea.html#paintEvent and there you can see the hint to use the viewport. In your code, just replace: painter = QtGui.QPainter(self) by painter = QtGui.QPainter(self.viewport()) and it should work. At least locally, I can see the gradient. > Cheers, > frank > Cheers -- Dr. Cristi?n Maureira-Fredes Senior R&D Manager The Qt Company GmbH Erich-Thilo-Str. 10 D-12489 Berlin Gesch?ftsf?hrer: Mika P?lsi, Juha Varelius, Jouni Lintunen Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B From dc at dcsoft.com Tue Aug 30 17:53:50 2022 From: dc at dcsoft.com (David Ching) Date: Tue, 30 Aug 2022 08:53:50 -0700 Subject: [PySide] editing selected cells in QTabelWidget In-Reply-To: References: Message-ID: <086b01d8bc88$b34a6140$19df23c0$@dcsoft.com> Even if you got the right click to actually set focus to the combo box on one item, I am not sure the user would find that intuitive. Right-clicking usually brings up a context menu. On deeper thought, it seems to be a conflict of using the persistent editor with a selection of multiple items. It's not standard. I would instead propose: Insert a first column of checkmark controls. Selecting an item checks this checkbox. In the end, multiple selections will have checkmarks. Then you can single click a combo box as normal, change the selection, and have it apply to all the items with checkmarks. Would that work for you? Thanks, David > From: PySide On Behalf Of Frank Rueter > Sent: Friday, August 26, 2022 3:05 AM > Subject: Re: [PySide] editing selected cells in QTabelWidget > So I made some progress but am now having the problem that a right click > on a persistent editor (combo box) will lose the current table selection. > [...] From glk at uchicago.edu Wed Aug 31 00:58:30 2022 From: glk at uchicago.edu (Gordon L. Kindlmann) Date: Tue, 30 Aug 2022 17:58:30 -0500 Subject: [PySide] examples/explainers for event filters? Message-ID: <469963B3-1F3A-4BAE-8DEB-24FE9A099A33@uchicago.edu> Hello, I'm looking for simple examples or explainers on how to do event filtering in PySide6. A google search result for: pyside6 event filter examples has as first result: https://doc.qt.io/qtforpython/overviews/eventsandfilters.html#event-filters But I have the feeling that this content represents some incomplete translation of C++ code and its description (the code has opening braces "{" and the text refers to true/false instead of True/False), so I'm not sure how much to trust this material. I may be in the minority of PySide users in not having used Qt before, with only glancing interactions with C++, as I look to PySide as a better way to make guis for Python code. These documentation glitches make me think I'm missing some other resources that are more specifically about PySide6. Any advice? Thank you, Gordon From frank at ohufx.com Wed Aug 31 09:09:53 2022 From: frank at ohufx.com (Frank Rueter) Date: Wed, 31 Aug 2022 19:09:53 +1200 Subject: [PySide] editing selected cells in QTabelWidget In-Reply-To: <086b01d8bc88$b34a6140$19df23c0$@dcsoft.com> References: <086b01d8bc88$b34a6140$19df23c0$@dcsoft.com> Message-ID: Thanks, I solved that part by not using the persistent editor at all as that seemed to interrupt things. Instead I just use the mousePressEvent on the table to make single clicks edit the cells. Then I have the delegate's setModelData method deal with bulk editing selected rows. This seems to work really well and is quite transparent in the code so I am happy for now. Thanks for holding my hand! frank On Wed, Aug 31, 2022 at 3:54 AM David Ching wrote: > Even if you got the right click to actually set focus to the combo box on > one item, I am not sure the user would find that intuitive. Right-clicking > usually brings up a context menu. On deeper thought, it seems to be a > conflict of using the persistent editor with a selection of multiple items. > It's not standard. I would instead propose: > > Insert a first column of checkmark controls. Selecting an item checks this > checkbox. In the end, multiple selections will have checkmarks. Then you > can single click a combo box as normal, change the selection, and have it > apply to all the items with checkmarks. Would that work for you? > > Thanks, > David > > > > From: PySide On Behalf Of Frank Rueter > > Sent: Friday, August 26, 2022 3:05 AM > > Subject: Re: [PySide] editing selected cells in QTabelWidget > > > So I made some progress but am now having the problem that a right click > > on a persistent editor (combo box) will lose the current table > selection. > > > [...] > > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: From Cristian.Maureira-Fredes at qt.io Wed Aug 31 09:36:18 2022 From: Cristian.Maureira-Fredes at qt.io (=?UTF-8?Q?Cristi=c3=a1n_Maureira-Fredes?=) Date: Wed, 31 Aug 2022 09:36:18 +0200 Subject: [PySide] examples/explainers for event filters? In-Reply-To: <469963B3-1F3A-4BAE-8DEB-24FE9A099A33@uchicago.edu> References: <469963B3-1F3A-4BAE-8DEB-24FE9A099A33@uchicago.edu> Message-ID: <3dc981cd-bc62-a7ba-e258-9c8ba213e5e2@qt.io> On 8/31/22 00:58, Gordon L. Kindlmann wrote: > Hello, Hey! > I'm looking for simple examples or explainers on how to do event filtering in PySide6. A google search result for: > pyside6 event filter examples > has as first result: > https://doc.qt.io/qtforpython/overviews/eventsandfilters.html#event-filters You can check this example that implements eventFilter https://code.qt.io/cgit/pyside/pyside-setup.git/tree/examples/network/googlesuggest (see googlesuggest.py) > > But I have the feeling that this content represents some incomplete translation of C++ code and its description (the code has opening braces "{" and the text refers to true/false instead of True/False), so I'm not sure how much to trust this material. Yeah, indeed that's one of the wrongly translated snippets, because the process is automated. Could you please open a bug report to fix it? > I may be in the minority of PySide users in not having used Qt before, with only glancing interactions with C++, as I look to PySide as a better way to make guis for Python code. These documentation glitches make me think I'm missing some other resources that are more specifically about PySide6. Any advice? You are not missing out other material, personally, I always recommend people to check the 'examples' for learning purposes. The reason of having those mistranslated snippets is because before, that was a manual process, and due to the amount of snippets in Qt, it was never even 20% done. So the team decided to automatically translate the snippets, which can provide more context, but with a price of having some of them wrongly translated. For that, we require feedback (like the one you gave!) of which are the snippets that require a fix. > Thank you, > Gordon Regarding that page, you can find the C++ code as well: https://doc.qt.io/qt-6/eventsandfilters.html Once you file the bug report, we can do a manual translation and provide the proper code snippets in https://doc.qt.io/qtforpython/overviews/eventsandfilters.html#event-filters Cheers! -- Dr. Cristian Maureira-Fredes Senior R&D Manager The Qt Company GmbH Erich-Thilo-Str. 10 D-12489 Berlin Gesch?ftsf?hrer: Mika P?lsi, Juha Varelius, Mika Harjuaho Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B -- From dc at dcsoft.com Wed Aug 31 18:08:49 2022 From: dc at dcsoft.com (David Ching) Date: Wed, 31 Aug 2022 09:08:49 -0700 Subject: [PySide] editing selected cells in QTabelWidget In-Reply-To: References: <086b01d8bc88$b34a6140$19df23c0$@dcsoft.com> Message-ID: <099801d8bd53$f58a0cb0$e09e2610$@dcsoft.com> > From: Frank Rueter mailto:frank at ohufx.com > Thanks, I solved that part by not using the persistent editor at all as that seemed to interrupt things. > Instead I just use the mousePressEvent on the table to make single clicks edit the cells. Then I have > the delegate's setModelData method deal with bulk editing selected rows. > This seems to work really well and is quite transparent in the code so I am happy for now. > > Thanks for holding my hand! Great! I am glad to help, I wish continued traffic on the mailing list as I think the PySide community is really great, but you don?t get a sense of that. It seems most of the users are very niche so there is not some industry swell around any one thing about it. Cheers, David From glk at uchicago.edu Wed Aug 31 18:17:27 2022 From: glk at uchicago.edu (Gordon L. Kindlmann) Date: Wed, 31 Aug 2022 11:17:27 -0500 Subject: [PySide] examples/explainers for event filters? In-Reply-To: <3dc981cd-bc62-a7ba-e258-9c8ba213e5e2@qt.io> References: <469963B3-1F3A-4BAE-8DEB-24FE9A099A33@uchicago.edu> <3dc981cd-bc62-a7ba-e258-9c8ba213e5e2@qt.io> Message-ID: <76636588-8398-407F-908A-0DCB4E026E98@uchicago.edu> > On Aug 31, 2022, at 2:36 AM, Cristi?n Maureira-Fredes wrote: > > You can check this example > that implements eventFilter > https://code.qt.io/cgit/pyside/pyside-setup.git/tree/examples/network/googlesuggest (see googlesuggest.py) Thanks for that suggestion; that's more useful than the other example I ran across: https://forum.qt.io/topic/133106/installeventfilter-not-working-on-pyside6 which puts the event filter at the application level, rather than for a single widget. >> But I have the feeling that this content represents some incomplete translation of C++ code ... > > Yeah, indeed that's one of the wrongly translated snippets, > because the process is automated. Could you please open a bug report to fix it? Sure, can you point out how to open such a bug report? I didn't see any links on the documentation page in question. Thanks, Gordon From Cristian.Maureira-Fredes at qt.io Wed Aug 31 20:33:26 2022 From: Cristian.Maureira-Fredes at qt.io (=?UTF-8?Q?Cristi=c3=a1n_Maureira-Fredes?=) Date: Wed, 31 Aug 2022 20:33:26 +0200 Subject: [PySide] examples/explainers for event filters? In-Reply-To: <76636588-8398-407F-908A-0DCB4E026E98@uchicago.edu> References: <469963B3-1F3A-4BAE-8DEB-24FE9A099A33@uchicago.edu> <3dc981cd-bc62-a7ba-e258-9c8ba213e5e2@qt.io> <76636588-8398-407F-908A-0DCB4E026E98@uchicago.edu> Message-ID: On 8/31/22 18:17, Gordon L. Kindlmann wrote: > > >> On Aug 31, 2022, at 2:36 AM, Cristi?n Maureira-Fredes wrote: >> >> You can check this example >> that implements eventFilter >> https://code.qt.io/cgit/pyside/pyside-setup.git/tree/examples/network/googlesuggest (see googlesuggest.py) > > Thanks for that suggestion; that's more useful than the other example I ran across: > https://forum.qt.io/topic/133106/installeventfilter-not-working-on-pyside6 > which puts the event filter at the application level, rather than for a single widget. > >>> But I have the feeling that this content represents some incomplete translation of C++ code ... >> >> Yeah, indeed that's one of the wrongly translated snippets, >> because the process is automated. Could you please open a bug report to fix it? > > Sure, can you point out how to open such a bug report? > I didn't see any links on the documentation page in question. Usually we put the community-focused content on the Public Wiki, and we leave the documentation for tutorials, examples, and API comments. When you go to pyside.org you will reach the public wiki, where you can get: https://wiki.qt.io/Qt_for_Python/Reporting_Bugs > > Thanks, > Gordon Cheers! -- Dr. Cristi?n Maureira-Fredes Senior R&D Manager The Qt Company GmbH Erich-Thilo-Str. 10 D-12489 Berlin Gesch?ftsf?hrer: Mika P?lsi, Juha Varelius, Jouni Lintunen Sitz der Gesellschaft: Berlin, Registergericht: Amtsgericht Charlottenburg, HRB 144331 B