Rework MessageDelegate in cpp
Rework MessageDelegate to be mostly a cpp class. This allows us to only load the components that are actually needed saving memory. In testing using memtest it saved ~30% versus the current implementation.
This commit is contained in:
@@ -84,7 +84,7 @@ class DelegateSizeHelper : public QObject
|
||||
*
|
||||
* @sa parentWidth, startBreakpoint, endBreakpoint
|
||||
*/
|
||||
Q_PROPERTY(int availablePercentageWidth READ availablePercentageWidth NOTIFY availablePercentageWidthChanged)
|
||||
Q_PROPERTY(int availablePercentageWidth READ availablePercentageWidth NOTIFY availableWidthChanged)
|
||||
|
||||
/**
|
||||
* @brief The width (in px) of the component at the current parentWidth.
|
||||
@@ -124,6 +124,16 @@ public:
|
||||
int availablePercentageWidth() const;
|
||||
qreal availableWidth() const;
|
||||
|
||||
/**
|
||||
* @brief The left x position of the content column.
|
||||
*/
|
||||
qreal leftX() const;
|
||||
|
||||
/**
|
||||
* @brief The right x position of the content column.
|
||||
*/
|
||||
qreal rightX() const;
|
||||
|
||||
Q_SIGNALS:
|
||||
void parentItemChanged();
|
||||
void leftPaddingChanged();
|
||||
@@ -148,5 +158,7 @@ private:
|
||||
int m_endPercentWidth = 85;
|
||||
std::optional<qreal> m_maxWidth = std::nullopt;
|
||||
|
||||
void calcWidthsChanged();
|
||||
|
||||
int calculateAvailablePercentageWidth() const;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user