代码拉取完成,页面将自动刷新
同步操作将从 孙木锋/QT_ArcGis 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
#include "frmmain.h"
#include "ui_frmmain.h"
#include "iconhelper.h"
#include "myhelper.h"
frmMain::frmMain(QWidget *parent) :
QDialog(parent),
ui(new Ui::frmMain)
{
ui->setupUi(this);
myHelper::FormInCenter(this);
this->InitStyle();
}
frmMain::~frmMain()
{
delete ui;
}
void frmMain::InitStyle()
{
//设置窗体标题栏隐藏
this->setWindowFlags(Qt::FramelessWindowHint | Qt::WindowSystemMenuHint | Qt::WindowMinMaxButtonsHint);
location = this->geometry();
max = false;
mousePressed = false;
//安装事件监听器,让标题栏识别鼠标双击
ui->lab_Title->installEventFilter(this);
IconHelper::Instance()->SetIcon(ui->btnMenu_Close, QChar(0xf00d), 10);
IconHelper::Instance()->SetIcon(ui->btnMenu_Max, QChar(0xf096), 10);
IconHelper::Instance()->SetIcon(ui->btnMenu_Min, QChar(0xf068), 10);
IconHelper::Instance()->SetIcon(ui->btnMenu, QChar(0xf0c9), 10);
IconHelper::Instance()->SetIcon(ui->lab_Ico, QChar(0xf015), 12);
}
bool frmMain::eventFilter(QObject *obj, QEvent *event)
{
if (event->type() == QEvent::MouseButtonDblClick) {
this->on_btnMenu_Max_clicked();
return true;
}
return QObject::eventFilter(obj, event);
}
void frmMain::mouseMoveEvent(QMouseEvent *e)
{
if (mousePressed && (e->buttons() && Qt::LeftButton) && !max) {
this->move(e->globalPos() - mousePoint);
e->accept();
}
}
void frmMain::mousePressEvent(QMouseEvent *e)
{
if (e->button() == Qt::LeftButton) {
mousePressed = true;
mousePoint = e->globalPos() - this->pos();
e->accept();
}
}
void frmMain::mouseReleaseEvent(QMouseEvent *)
{
mousePressed = false;
}
void frmMain::on_btnMenu_Close_clicked()
{
this->close();
}
void frmMain::on_btnMenu_Max_clicked()
{
if (max) {
this->setGeometry(location);
IconHelper::Instance()->SetIcon(ui->btnMenu_Max, QChar(0xf096), 10);
ui->btnMenu_Max->setToolTip("最大化");
} else {
location = this->geometry();
this->setGeometry(qApp->desktop()->availableGeometry());
IconHelper::Instance()->SetIcon(ui->btnMenu_Max, QChar(0xf079), 10);
ui->btnMenu_Max->setToolTip("还原");
}
max = !max;
}
void frmMain::on_btnMenu_Min_clicked()
{
this->showMinimized();
}
void frmMain::on_pushButton_clicked()
{
myHelper::ShowMessageBoxInfo("这是一个测试!");
}
void frmMain::on_pushButton_2_clicked()
{
int result = myHelper::ShowMessageBoxQuesion("这是一个测试?");
if (result == 1) {
myHelper::ShowMessageBoxInfo("这是一个测试!");
} else {
myHelper::ShowMessageBoxInfo("这是一个测试!");
}
}
void frmMain::on_pushButton_3_clicked()
{
myHelper::ShowMessageBoxError("这是一个测试!");
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。