Removed redundant "numbers" field from Account model and database queries to simplify account structure. Introduced a TutorialWindow class for displaying application tutorials, integrated into the main window, and updated file paths accordingly. Improved string handling and logic in Payment routines and enhanced overall UI structure.
38 lines
1.3 KiB
C++
38 lines
1.3 KiB
C++
#include "DeviceWidget.h"
|
|
#include <QVBoxLayout>
|
|
#include <QLabel>
|
|
#include <QPixmap>
|
|
#include <QImage>
|
|
|
|
DeviceWidget::DeviceWidget(const DeviceInfo &device, QWidget *parent): QWidget(parent) {
|
|
auto *layout = new QVBoxLayout(this);
|
|
|
|
this->setStyleSheet("background-color: lightgray;padding: 10px;");
|
|
|
|
QImage img;
|
|
img.loadFromData(device.image, "JPG");
|
|
|
|
auto *imageLabel = new QLabel(this);
|
|
// qDebug() << "imageLabel" << img.width() ;
|
|
imageLabel->setPixmap(QPixmap::fromImage(img).scaled(200, 350, Qt::KeepAspectRatio, Qt::SmoothTransformation));
|
|
imageLabel->setAlignment(Qt::AlignCenter);
|
|
layout->addWidget(imageLabel);
|
|
|
|
const QString result = QString("%1, Android %2, battery %3% [%4x%5]")
|
|
.arg(device.name).arg(device.android).arg(device.battery).
|
|
arg(device.screenWidth).arg(device.screenHeight);
|
|
|
|
auto *statusLabel = new QLabel(result, this);
|
|
statusLabel->setAlignment(Qt::AlignCenter);
|
|
statusLabel->setMaximumWidth(200);
|
|
statusLabel->setWordWrap(true);
|
|
|
|
const QString styleSheet = QString("color: %1; font-weight: bold;")
|
|
.arg(device.status == "online" ? "green" : "red");
|
|
statusLabel->setStyleSheet(styleSheet);
|
|
|
|
// layout->setContentsMargins(10, 10, 10, 10);
|
|
layout->setSpacing(0);
|
|
layout->addWidget(statusLabel);
|
|
}
|