frontend: Refactor Idian widgets - #13765
Conversation
3374529 to
0734aa1
Compare
0734aa1 to
20a6b01
Compare
The idian widgets were built when we had a much lower understanding of how Qt expects you to build custom complex widgets and without a direct use-case. They were also built far too rigid for what every attempted use of them thus far has necessitated. These changes break them into simpler 'pieces' and provide getters for internals that are intended to be accessed.
20a6b01 to
f73364f
Compare
| namespace idian { | ||
| ExpandButton::ExpandButton(QWidget *parent) : InlineButton(parent) | ||
| { | ||
| widgetUtils = new Utils(this); |
There was a problem hiding this comment.
What's the reason not to use smart pointers here? It doesn't seem that Utils needs to use Qt's parent-owner ownership model (which has been outdated for over a decade) and we should not perpetuate it in unrelated code.
The only place parent-owner ownership is permitted is for widgets and Qt objects, anything else needs to use smart pointers with clear lifetime and ownership rules.
There was a problem hiding this comment.
No good catch. Originally I wrote the Utils class as a QObject, but then had to convert it to a normal class to be able to use it for multiple inheritance (Qt only allows a class to inherit from a single QObject with multi inheritance).
These new Utils calls technically all leak that object since they're no longer cleaned up by Qt. I will convert them to smart pointers.
| #include <QStyleOptionButton> | ||
| #include <QPainter> |
There was a problem hiding this comment.
| #include <QStyleOptionButton> | |
| #include <QPainter> | |
| #include <QPainter> | |
| #include <QStyleOptionButton> |
| // Convenience function to add a widget to the rows layout. | ||
| void addWidget(QWidget *widget) { layout()->addWidget(widget); } | ||
|
|
||
| // Convenience function to add a widget to the rows layout and then set it as the buddy. |
There was a problem hiding this comment.
| // Convenience function to add a widget to the rows layout and then set it as the buddy. | |
| // Convenience function to add a widget to the row's layout and then set it as the buddy. |
| #include <Idian/RowList.hpp> | ||
| #include <Idian/RowInfo.hpp> |
There was a problem hiding this comment.
| #include <Idian/RowList.hpp> | |
| #include <Idian/RowInfo.hpp> | |
| #include <Idian/RowInfo.hpp> | |
| #include <Idian/RowList.hpp> |
Description
Refactors the Idian widgets based after some slight usage in other PRs.
This has been extracted out from #13433
Motivation and Context
The idian widgets were built when we had a much lower understanding of how Qt expects you to build custom complex widgets and without a direct use-case.
They were also built far too rigid for what every attempted use of them thus far has necessitated. These changes break them into simpler 'pieces' and provide getters for internals that are intended to be accessed.
How Has This Been Tested?
Included in #13433
Types of changes
Checklist: