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.


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
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.

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