current revision
This commit is contained in:
@@ -3,12 +3,18 @@
|
||||
|
||||
#include <QPainter>
|
||||
#include <QStaticText>
|
||||
#include "../UIHelper.h"
|
||||
|
||||
PlotWiFiScan::PlotWiFiScan(QWidget *parent) : QWidget(parent) {
|
||||
|
||||
setMinimumWidth(96);
|
||||
setMinimumHeight(96);
|
||||
|
||||
|
||||
//setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
||||
// setMaximumHeight(300);
|
||||
// sets
|
||||
//setAutoFillBackground(false);
|
||||
|
||||
}
|
||||
@@ -24,13 +30,15 @@ void PlotWiFiScan::paintEvent(QPaintEvent* evt) {
|
||||
(void) evt;
|
||||
QPainter p(this);
|
||||
|
||||
const int x0 = 4; const int xw = 150;
|
||||
const int x0 = 4; const int xw = UIHelper::getWifiLabelDistX(this->parent());
|
||||
const int y0 = 3;
|
||||
const int lh = 13;
|
||||
const int lh = UIHelper::getWifiLabelDistY(this->parent());
|
||||
|
||||
int x = x0;
|
||||
int y = y0;
|
||||
|
||||
int w = width();
|
||||
int h = height();
|
||||
|
||||
p.fillRect(0,0,width(),height(),QColor(255,255,255,192));
|
||||
p.setPen(Qt::black);
|
||||
@@ -45,7 +53,7 @@ void PlotWiFiScan::paintEvent(QPaintEvent* evt) {
|
||||
std::string str = mac + ": " + std::to_string((int)m.getRSSI());
|
||||
p.drawStaticText(x, y, QStaticText(str.c_str()));
|
||||
y += lh;
|
||||
if (y > 90) {y = y0; x += xw;}
|
||||
if (y > this->height()-10) {y = y0; x += xw;}
|
||||
}
|
||||
|
||||
p.end();
|
||||
|
||||
Reference in New Issue
Block a user