mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-25 07:57:19 +00:00
update to the newest Qt
First it crashes with the newest Qt due to nan values in graphs. Second it produces several warnings
This commit is contained in:
parent
7ff1515c94
commit
7f665fef77
@ -25,7 +25,7 @@
|
|||||||
#include <QGraphicsView>
|
#include <QGraphicsView>
|
||||||
#include <QPixmap>
|
#include <QPixmap>
|
||||||
|
|
||||||
#include <math.h>
|
#include <cmath>
|
||||||
|
|
||||||
#include "awactions.h"
|
#include "awactions.h"
|
||||||
#include "awdebug.h"
|
#include "awdebug.h"
|
||||||
@ -35,8 +35,14 @@ AWDataAggregator::AWDataAggregator(QObject *parent)
|
|||||||
: QObject(parent)
|
: QObject(parent)
|
||||||
{
|
{
|
||||||
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
qCDebug(LOG_AW) << __PRETTY_FUNCTION__;
|
||||||
// required by signals
|
|
||||||
// qRegisterMetaType<QHash<QString, QString>>("QHash<QString, QString>");
|
boundaries[QString("cpuTooltip")] = 100.0;
|
||||||
|
boundaries[QString("cpuclTooltip")] = 4000.0;
|
||||||
|
boundaries[QString("memTooltip")] = 100.0;
|
||||||
|
boundaries[QString("swapTooltip")] = 100.0;
|
||||||
|
boundaries[QString("downkbTooltip")] = 1.0;
|
||||||
|
boundaries[QString("upkbTooltip")] = 1.0;
|
||||||
|
boundaries[QString("batTooltip")] = 100.0;
|
||||||
|
|
||||||
initScene();
|
initScene();
|
||||||
connect(this, SIGNAL(updateData(const QVariantHash &)), this,
|
connect(this, SIGNAL(updateData(const QVariantHash &)), this,
|
||||||
@ -92,14 +98,6 @@ void AWDataAggregator::setParameters(QVariantMap settings)
|
|||||||
// resize tooltip image
|
// resize tooltip image
|
||||||
toolTipView->resize(100 * counts, 105);
|
toolTipView->resize(100 * counts, 105);
|
||||||
|
|
||||||
boundaries[QString("cpuTooltip")] = 100.0;
|
|
||||||
boundaries[QString("cpuclTooltip")] = 4000.0;
|
|
||||||
boundaries[QString("memTooltip")] = 100.0;
|
|
||||||
boundaries[QString("swapTooltip")] = 100.0;
|
|
||||||
boundaries[QString("downkbTooltip")] = 1.0;
|
|
||||||
boundaries[QString("upkbTooltip")] = 1.0;
|
|
||||||
boundaries[QString("batTooltip")] = 100.0;
|
|
||||||
|
|
||||||
requiredKeys.clear();
|
requiredKeys.clear();
|
||||||
if (configuration[QString("cpuTooltip")].toBool())
|
if (configuration[QString("cpuTooltip")].toBool())
|
||||||
requiredKeys.append(QString("cpuTooltip"));
|
requiredKeys.append(QString("cpuTooltip"));
|
||||||
@ -302,6 +300,8 @@ void AWDataAggregator::setData(const QString &source, float value,
|
|||||||
if (source == QString("downkbTooltip")) {
|
if (source == QString("downkbTooltip")) {
|
||||||
QList<float> netValues
|
QList<float> netValues
|
||||||
= data[QString("downkbTooltip")] + data[QString("upkbTooltip")];
|
= data[QString("downkbTooltip")] + data[QString("upkbTooltip")];
|
||||||
|
// to avoid inf value of normY
|
||||||
|
netValues << 1.0;
|
||||||
boundaries[QString("downkbTooltip")]
|
boundaries[QString("downkbTooltip")]
|
||||||
= 1.2f * *std::max_element(netValues.cbegin(), netValues.cend());
|
= 1.2f * *std::max_element(netValues.cbegin(), netValues.cend());
|
||||||
boundaries[QString("upkbTooltip")]
|
boundaries[QString("upkbTooltip")]
|
||||||
|
@ -21,7 +21,7 @@
|
|||||||
#include <QGraphicsEllipseItem>
|
#include <QGraphicsEllipseItem>
|
||||||
#include <QGraphicsScene>
|
#include <QGraphicsScene>
|
||||||
|
|
||||||
#include <math.h>
|
#include <cmath>
|
||||||
|
|
||||||
#include "awdebug.h"
|
#include "awdebug.h"
|
||||||
|
|
||||||
@ -150,6 +150,9 @@ float GraphicalItemHelper::getPercents(const float &value, const float &min,
|
|||||||
const float &max)
|
const float &max)
|
||||||
{
|
{
|
||||||
qCDebug(LOG_LIB) << "Get percent value from" << value;
|
qCDebug(LOG_LIB) << "Get percent value from" << value;
|
||||||
|
// newest Qt crashes here if value is nan
|
||||||
|
if (isnan(value))
|
||||||
|
return 0.0;
|
||||||
|
|
||||||
return (value - min) / (max - min);
|
return (value - min) / (max - min);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user