mirror of
https://gitlab.linphone.org/BC/public/linphone-desktop.git
synced 2026-01-17 03:18:07 +00:00
Fix FPS Counter that take resources even if invisible
This commit is contained in:
parent
8ad4d8be1e
commit
e15186e63b
3 changed files with 8 additions and 13 deletions
|
|
@ -29,6 +29,8 @@
|
||||||
FPSCounter::FPSCounter(QQuickItem *parent) : QQuickPaintedItem(parent), _currentFPS(0), _cacheCount(0) {
|
FPSCounter::FPSCounter(QQuickItem *parent) : QQuickPaintedItem(parent), _currentFPS(0), _cacheCount(0) {
|
||||||
_times.clear();
|
_times.clear();
|
||||||
setFlag(QQuickItem::ItemHasContents);
|
setFlag(QQuickItem::ItemHasContents);
|
||||||
|
connect(this, &FPSCounter::visibleChanged, this,
|
||||||
|
[this]() { update(); }); // If not call at first, item will never call paint.
|
||||||
}
|
}
|
||||||
|
|
||||||
FPSCounter::~FPSCounter() {
|
FPSCounter::~FPSCounter() {
|
||||||
|
|
@ -56,15 +58,8 @@ int FPSCounter::fps() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FPSCounter::paint(QPainter *painter) {
|
void FPSCounter::paint(QPainter *painter) {
|
||||||
recalculateFPS();
|
if (isVisible()) {
|
||||||
// lDebug()<< __FUNCTION__;
|
recalculateFPS();
|
||||||
/*
|
update(); // Request next frame
|
||||||
QBrush brush(Qt::yellow);
|
}
|
||||||
|
|
||||||
painter->setBrush(brush);
|
|
||||||
painter->setPen(Qt::NoPen);
|
|
||||||
painter->setRenderHint(QPainter::Antialiasing);
|
|
||||||
painter->drawRoundedRect(0, 0, boundingRect().width(), boundingRect().height(), 0, 0);
|
|
||||||
*/
|
|
||||||
update();
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -26,7 +26,7 @@ class FPSCounter : public QQuickPaintedItem {
|
||||||
public:
|
public:
|
||||||
FPSCounter(QQuickItem *parent = 0);
|
FPSCounter(QQuickItem *parent = 0);
|
||||||
~FPSCounter();
|
~FPSCounter();
|
||||||
void paint(QPainter *);
|
virtual void paint(QPainter *) override;
|
||||||
Q_INVOKABLE int fps() const;
|
Q_INVOKABLE int fps() const;
|
||||||
|
|
||||||
signals:
|
signals:
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,7 @@ FormItemLayout {
|
||||||
id: textField
|
id: textField
|
||||||
Layout.preferredWidth: 360 * DefaultStyle.dp
|
Layout.preferredWidth: 360 * DefaultStyle.dp
|
||||||
placeholderText: useTitleAsPlaceHolder ? mainItem.title : mainItem.placeHolder
|
placeholderText: useTitleAsPlaceHolder ? mainItem.title : mainItem.placeHolder
|
||||||
initialText: mainItem.propertyOwner[mainItem.propertyName]
|
initialText: mainItem.propertyOwner[mainItem.propertyName] || ''
|
||||||
customWidth: mainItem.parent.width
|
customWidth: mainItem.parent.width
|
||||||
propertyName: mainItem.propertyName
|
propertyName: mainItem.propertyName
|
||||||
propertyOwner: mainItem.propertyOwner
|
propertyOwner: mainItem.propertyOwner
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue