Skip to content

Conversation

@jevinskie
Copy link

@jevinskie jevinskie commented Feb 3, 2022

jevinskie and others added 2 commits February 2, 2022 19:57
Copy link
Owner

@robertknight robertknight left a comment

Choose a reason for hiding this comment

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

I think this is a good idea for a feature. I found a bug where the flash effect can remain on if you click the button a second time while the sequence is running. There is also a problem that the effect is not always visible depending on how stylesheets interact with the widget's own drawing. It might work better to place an overlay above the part of the window where the flashed widget is and apply styling in that. This would need to be done from the injected library rather than the inspector.


QTimer::singleShot(500, [=]() { object->writeProperty("styleSheet", origStyle); });
QTimer::singleShot(1000, [=]() { object->writeProperty("styleSheet", newStyle); });
QTimer::singleShot(1500, [=]() { object->writeProperty("styleSheet", origStyle); });
Copy link
Owner

@robertknight robertknight Feb 3, 2022

Choose a reason for hiding this comment

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

I added a version check around these calls, as support for functor arguments to QTimer::singleShot was added only in Qt 5.4. The project ostensibly still supports Qt 4, although I think that support could probably be ended now.

QString origStyle;
for (const auto &property : object->properties())
{
if (property.name == "styleSheet")
Copy link
Owner

Choose a reason for hiding this comment

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

If the widget is in the middle of an earlier flash sequence when the button is clicked, this loop may capture the flashed stylesheet. The result is that the flash effect remains on at the end of the sequence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants