View Issue Details

IDProjectCategoryView StatusLast Update
0004576FreeCADBugpublic2021-08-27 02:59
ReporterStefanBruens Assigned To 
PrioritynormalSeverityminorReproducibilityhave not tried
Status newResolutionopen 
Summary0004576: Prefer new-style/functor QObject::connect over string based
DescriptionNew-style or functor based connects allow compile-time checking of signal/slot arguments.

Usage of small lambdas often also allows to get rid of small helper slots/functions.

E.g. (src/Gui/Filedialog.cpp):


    connect(this, SIGNAL(filterSelected(const QString&)),
            this, SLOT(onSelectedFilter(const QString&)));
becomes

    connect(this, &Filedialog::filterSelected,
            this, &Filedialog::onSelectedFilter);
Additional Informationhttps://doc.qt.io/qt-5/signalsandslots-syntaxes.html

https://wiki.qt.io/New_Signal_Slot_Syntax

TagsQt
FreeCAD InformationOS: openSUSE Tumbleweed (KDE//usr/share/xsessions/plasma5)
Word size of OS: 64-bit
Word size of FreeCAD: 64-bit
Version: 0.19.Unknown
Build type: Release
Python version: 3.8.7
Qt version: 5.15.2
Coin version: 3.1.3
OCC version: 7.5.1
Locale: English/United States (en_US)

Activities

wmayer

2021-02-28 07:07

administrator   ~0015456

With v0.19 we still support Qt4 (and Py2) which doesn't support the offered method. Now with the started development of v0.20 we will drop Qt4/Py2 support and can start to use the new stuff.

Kunda1

2021-03-28 11:44

administrator   ~0015564

@wmayer should we do this before or after Toponaming patch (@realthunder is planning to submit a patch by the end of the month, is what he mentioned to me)

chennes

2021-08-27 02:59

developer   ~0015874

This is not really a bug, more of a "going forward we should code like this" -- while I agree with the sentiment, and my recent PRs have followed this practice, I don't think it's something we want to go back through the whole codebase and replace. We can just update over time as the code gets modified.

Issue History

Date Modified Username Field Change
2021-02-27 15:12 StefanBruens New Issue
2021-02-27 15:21 StefanBruens Tag Attached: Qt
2021-02-28 07:07 wmayer Note Added: 0015456
2021-03-28 11:42 Kunda1 Description Updated
2021-03-28 11:44 Kunda1 Note Added: 0015564
2021-08-27 02:59 chennes Note Added: 0015874