Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Alias QPushButton::default to QPushButton::isDefault #13

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

Znurre
Copy link
Contributor

@Znurre Znurre commented Feb 18, 2018

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.

@Znurre Znurre force-pushed the PushButtonDefaultAlias branch from 017613f to 4f4b99d Compare March 23, 2018 17:54
@0x6e 0x6e requested review from krake-kdab and 0x6e March 26, 2018 09:52

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, [email protected]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you change the date in the copyright notices to 2018 please?

class DeclarativePushButton : public QPushButton
{
Q_OBJECT
Q_PROPERTY(bool isDefault READ isDefault WRITE setDefault)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the feedback. I will have a look at doing this.

@Znurre Znurre force-pushed the PushButtonDefaultAlias branch from 7bd4eb9 to 5739971 Compare March 29, 2018 15:34
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants