42 lines
1.2 KiB
C++
42 lines
1.2 KiB
C++
#include "aboutbox.h"
|
|
#include "ui_aboutbox.h"
|
|
|
|
AboutBox::AboutBox(QWidget *parent) :
|
|
QDialog(parent),
|
|
ui(new Ui::AboutBox)
|
|
{
|
|
ui->setupUi(this);
|
|
this->setWindowFlags(Qt::Dialog | Qt::FramelessWindowHint);
|
|
xmax = ui->frame->x() + ui->frame->width();
|
|
xmin = ui->frame->x();
|
|
ymax = ui->frame->x() + ui->frame->height();
|
|
ymin = ui->frame->y();
|
|
ui->systemLabel->setText(QString("Built on %1 %2 (%3)").arg(APP_OS, APP_OS_VERSION, APP_ARCH));
|
|
ui->versionLabel->setText(QString("Version: %1").arg(APP_VERSION));
|
|
}
|
|
|
|
AboutBox::~AboutBox()
|
|
{
|
|
delete ui;
|
|
}
|
|
|
|
void AboutBox::mousePressEvent(QMouseEvent *event) {
|
|
m_nMouseClick_X_Coordinate = event->position().rx();
|
|
m_nMouseClick_Y_Coordinate = event->position().ry();
|
|
}
|
|
|
|
void AboutBox::mouseMoveEvent(QMouseEvent *event) {
|
|
if (isWidgetIsTitleBar()) {
|
|
move(event->globalPosition().rx() - m_nMouseClick_X_Coordinate ,
|
|
event->globalPosition().ry() - m_nMouseClick_Y_Coordinate);
|
|
}
|
|
|
|
}
|
|
|
|
bool AboutBox::isWidgetIsTitleBar() {
|
|
return (m_nMouseClick_X_Coordinate >= xmin &&
|
|
m_nMouseClick_X_Coordinate < xmax &&
|
|
m_nMouseClick_Y_Coordinate >= ymin &&
|
|
m_nMouseClick_Y_Coordinate < ymax);
|
|
}
|