Alias QPushButton::default to QPushButton::isDefault#13
Alias QPushButton::default to QPushButton::isDefault#13Znurre wants to merge 6 commits intoKDABLabs:masterfrom
Conversation
017613f to
4f4b99d
Compare
src/declarativepushbutton.cpp
Outdated
|
|
||
| This file is part of DeclarativeWidgets, library and tools for creating QtWidget UIs with QML. | ||
|
|
||
| Copyright (C) 2013-2017 Klarälvdalens Datakonsult AB, a KDAB Group company, info@kdab.com |
There was a problem hiding this comment.
Could you change the date in the copyright notices to 2018 please?
src/declarativepushbutton_p.h
Outdated
| class DeclarativePushButton : public QPushButton | ||
| { | ||
| Q_OBJECT | ||
| Q_PROPERTY(bool isDefault READ isDefault WRITE setDefault) |
There was a problem hiding this comment.
In general all properties of classes exposed to QML should either be CONSTANT or NOTIFYable to properly work as inputs into property bindings.
The QML engine will issue warnings for them accordingly.
Obviously this is a problem with lots of widget properties, as they were not designed with that in mind and the classes are way older than QML itself.
The DeclarativeWidgetExtension fixes that for some of the main ones as good as it can, maybe we should consider a derived extension for QAbstractButton and then one for QPushButton derived from that, with the goal to ideally fix them in Qt itself at some point
There was a problem hiding this comment.
Thanks for the feedback. I will have a look at doing this.
7bd4eb9 to
5739971
Compare
QPushButton has a property named "default" which cannot be used from QML since "default" is a reserved keyword.
This change adds an alias which allows the property to be accessed as "isDefault" from QML.