1 Star 0 Fork 0

Xin/weplayer_xin

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
dlgoption.cpp 2.27 KB
一键复制 编辑 原始数据 按行查看 历史
zhangxin 提交于 2022-04-02 22:19 . 增加联系信息及文档联系地址
#include "dlgoption.h"
#include "ui_dlgoption.h"
#include <QMouseEvent>
#include <QDesktopServices>
#if _MSC_VER >= 1600
#pragma execution_character_set("utf-8")
#endif
DlgOption::DlgOption(QWidget *parent) :
QDialog(parent),
ui(new Ui::DlgOption)
{
ui->setupUi(this);
setWindowFlags(Qt::FramelessWindowHint);
ui->tabOptions->setTabPosition(QTabWidget::West);
ui->tabOptions->tabBar()->setStyle(new CustomTabStyle);
ui->tabOptions->setStyleSheet("QTabWidget::pane { border: 0; }");
ui->lblTitle->setAttribute(Qt::WA_TranslucentBackground, true);
ui->lblTitle->setAttribute(Qt::WA_TransparentForMouseEvents, true);
this->installEventFilter(this);
m_retCode = 0;
}
DlgOption::~DlgOption()
{
delete ui;
}
bool DlgOption::eventFilter(QObject *watched, QEvent *event)
{
if (event->type() == QEvent::MouseButtonPress)
{
QMouseEvent *mouseEvent = (QMouseEvent *)event;
QPoint p = mouseEvent->pos();
if (mouseEvent->button() == Qt::LeftButton)
{
m_WindowMove.m_move = true;
m_WindowMove.m_startPoint = mouseEvent->globalPos();
m_WindowMove.m_windowPoint = this->frameGeometry().topLeft();
}
}
else if (event->type() == QEvent::MouseMove)
{
QMouseEvent *mouseEvent = (QMouseEvent *)event;
if (m_WindowMove.m_move)
{
QPoint relativePos = mouseEvent->globalPos() - m_WindowMove.m_startPoint;
this->move(m_WindowMove.m_windowPoint + relativePos);
}
}
else if (event->type() == QEvent::MouseButtonRelease)
{
m_WindowMove.m_move = false;
}
return QWidget::eventFilter(watched, event);
}
void DlgOption::on_btnClose_clicked()
{
this->done(0);
}
void DlgOption::on_btnSaveTabPlayer_clicked()
{
m_retCode = 1;
this->done(m_retCode);
}
int DlgOption::SetHardAccelMode(int mode)
{
if (mode == 0)
{
ui->chkHardAccel->setChecked(false);
}
else
{
ui->chkHardAccel->setChecked(true);
}
return 0;
}
int DlgOption::GetHardAccelMode()
{
if (ui->chkHardAccel->isChecked() == true)
{
return 1;
}
return 0;
}
void DlgOption::on_lblSourceCode_linkActivated(const QString &link)
{
QDesktopServices::openUrl(QUrl(link));
}
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/xindev/weplayer_xin.git
git@gitee.com:xindev/weplayer_xin.git
xindev
weplayer_xin
weplayer_xin
main

搜索帮助