@wmayerwmayer wrote: ↑Sun Aug 20, 2017 9:11 pm FYI, in Qt any sub-class of QObject can re-implement the (in C++ virtual) method eventFilter() and can be installed to any other QObject-dervied instance to observe or filter the events it gets.
In C++ the class name of the About dialog including name spaces is called Gui::Dialog::AboutDialog and the class name of a QObject can be determined by its meta object. So, the event filter only looks for About dialogs and as event it uses the polish event which is called before the dialog is shown.
The name of the method of the dialog that is invoked when pressing the Copy button is called on_copyButton_clicked() and is marked as a slot function (for more information refer to the Qt docs to see what a slot function exactly is) and this allows it to allow to call it over its meta object.
By calling on_copyButton_clicked all the needed information is copied to the clipboard and the dialog can be closed again. Thus, a close event is posted to the dialog class.
The four lines at the end are needed to install the event filter to the global application object, invoke the Std_About command which internally creates the About dialog and removing the event filter again.
Code: Select all
Traceback (most recent call last): File "/Users/cb/panhard/coupe/sanssoupapes/copyToClipboard.FCMacro", line 2, in <module> from PySide import QtOpenGL <class 'ImportError'>: cannot import name 'QtOpenGL' from 'PySide' (/Users/cb/Desktop/FreeCAD.app/Contents/Resources/Ext/PySide/__init__.py)
Code: Select all
from PySide2.QtOpenGL import *
Any progress on this?
Sorry for being late: It works! Thank you.