mirror of
https://github.com/arcan1s/awesome-widgets.git
synced 2025-04-24 23:47:20 +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 <QPixmap>
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "awactions.h"
|
||||
#include "awdebug.h"
|
||||
@ -35,8 +35,14 @@ AWDataAggregator::AWDataAggregator(QObject *parent)
|
||||
: QObject(parent)
|
||||
{
|
||||
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();
|
||||
connect(this, SIGNAL(updateData(const QVariantHash &)), this,
|
||||
@ -92,14 +98,6 @@ void AWDataAggregator::setParameters(QVariantMap settings)
|
||||
// resize tooltip image
|
||||
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();
|
||||
if (configuration[QString("cpuTooltip")].toBool())
|
||||
requiredKeys.append(QString("cpuTooltip"));
|
||||
@ -302,6 +300,8 @@ void AWDataAggregator::setData(const QString &source, float value,
|
||||
if (source == QString("downkbTooltip")) {
|
||||
QList<float> netValues
|
||||
= data[QString("downkbTooltip")] + data[QString("upkbTooltip")];
|
||||
// to avoid inf value of normY
|
||||
netValues << 1.0;
|
||||
boundaries[QString("downkbTooltip")]
|
||||
= 1.2f * *std::max_element(netValues.cbegin(), netValues.cend());
|
||||
boundaries[QString("upkbTooltip")]
|
||||
|
@ -21,7 +21,7 @@
|
||||
#include <QGraphicsEllipseItem>
|
||||
#include <QGraphicsScene>
|
||||
|
||||
#include <math.h>
|
||||
#include <cmath>
|
||||
|
||||
#include "awdebug.h"
|
||||
|
||||
@ -150,6 +150,9 @@ float GraphicalItemHelper::getPercents(const float &value, const float &min,
|
||||
const float &max)
|
||||
{
|
||||
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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user