Moved everything associated with executing and explaining queries to querytab.
It is now possible to create multiple independent query tabs. However somethings are currently a bit broken.
This commit is contained in:
parent
6c268bd774
commit
7f379f3b80
13 changed files with 668 additions and 634 deletions
49
util.cpp
Normal file
49
util.cpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#include "util.h"
|
||||
|
||||
// Supported range from microseconds to seconds
|
||||
// min:sec to hours::min::sec
|
||||
QString msfloatToHumanReadableString(float ms)
|
||||
{
|
||||
QString unit;
|
||||
float val;
|
||||
int deci = 2;
|
||||
if (ms < 1.0f) {
|
||||
val = ms * 1000.f;
|
||||
//result = QString::asprintf("%0.3f", ms * 1000.0f);
|
||||
unit = u8"μs";
|
||||
}
|
||||
else if (ms >= 1000.0) {
|
||||
val = ms / 1000.0f;
|
||||
unit = "s";
|
||||
if (val >= 60.0) {
|
||||
int secs = val;
|
||||
int min = secs / 60.0;
|
||||
secs -= min * 60;
|
||||
if (min >= 60) {
|
||||
int hour = min / 60;
|
||||
min -= hour * 60;
|
||||
return QString::asprintf("%d:%02d:%02d", hour, min, secs);
|
||||
}
|
||||
else {
|
||||
return QString::asprintf("%02d:%02d", min, secs);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
val = ms;
|
||||
unit = "ms";
|
||||
}
|
||||
|
||||
// if (val >= 1000.f) {
|
||||
// deci = 0;
|
||||
// }
|
||||
// else
|
||||
if (val >= 100.f) {
|
||||
deci = 0;
|
||||
}
|
||||
else if (val >= 10.f) {
|
||||
deci = 1;
|
||||
}
|
||||
QString result = QString::asprintf("%0.*f", deci, val);
|
||||
return result + unit;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue