修复无边框窗口鼠标问题

修复默认地址斜杠问题
部分qwdiget增加鼠标追踪解决BUG
This commit is contained in:
JackLee_CN 2024-11-09 13:33:18 +08:00
parent db02113c2a
commit bb6266fd1b
5 changed files with 14 additions and 8 deletions

View File

@ -4,7 +4,8 @@ sui::sui(QWidget *parent)
m_layout(new QVBoxLayout), m_layout(new QVBoxLayout),
m_widget(new QWidget), m_widget(new QWidget),
m_press(false), m_press(false),
m_border_width(5) m_border_width(2),
ori(NONE)
{ {
m_title = new sui_title(this); m_title = new sui_title(this);
setObjectName(tr("m_widget")); setObjectName(tr("m_widget"));
@ -23,10 +24,14 @@ sui::sui(QWidget *parent)
sui::~sui() sui::~sui()
{ {
} }
void sui::showEvent(QShowEvent *event) void sui::showEvent(QShowEvent *event)
{ {
this->setAttribute(Qt::WA_Mapped); this->setAttribute(Qt::WA_Mapped);
QWidget::showEvent(event); QWidget::showEvent(event);
QSize oldSize = this->size();
resize(oldSize + QSize(10, 10));
resize(oldSize);
} }
void sui::paintEvent(QPaintEvent *event) void sui::paintEvent(QPaintEvent *event)
@ -52,7 +57,6 @@ void sui::region(const QPoint &currentGlobalPoint)
// 当前鼠标的坐标 // 当前鼠标的坐标
int x = currentGlobalPoint.x(); int x = currentGlobalPoint.x();
int y = currentGlobalPoint.y(); int y = currentGlobalPoint.y();
if (((topLeft.x() + m_border_width >= x) && (topLeft.x() <= x)) && ((topLeft.y() + m_border_width >= y) && (topLeft.y() <= y))) if (((topLeft.x() + m_border_width >= x) && (topLeft.x() <= x)) && ((topLeft.y() + m_border_width >= y) && (topLeft.y() <= y)))
{ {
// 左上角 // 左上角

View File

@ -35,7 +35,7 @@ private:
sui_title *m_title; sui_title *m_title;
protected: protected:
void paintEvent(QPaintEvent *event); void paintEvent(QPaintEvent *event);
void showEvent(QShowEvent *event); void showEvent(QShowEvent *event);
void mouseMoveEvent(QMouseEvent *event); void mouseMoveEvent(QMouseEvent *event);
void mousePressEvent(QMouseEvent *event); void mousePressEvent(QMouseEvent *event);
void mouseReleaseEvent(QMouseEvent *event); void mouseReleaseEvent(QMouseEvent *event);

View File

@ -35,6 +35,7 @@ sui_title::sui_title(QWidget *parent)
m_layout->addWidget(m_btn_vectors[3]); m_layout->addWidget(m_btn_vectors[3]);
m_layout->setSpacing(5); m_layout->setSpacing(5);
m_layout->setContentsMargins(5, 0, 5, 0); m_layout->setContentsMargins(5, 0, 5, 0);
setMouseTracking(true);
setFixedHeight(40); setFixedHeight(40);
setLayout(m_layout); setLayout(m_layout);
connect_slots(); connect_slots();
@ -158,8 +159,8 @@ void sui_title::slots_style_system()
} }
void sui_title::set_font_style() void sui_title::set_font_style()
{ {
slots_set_style_change();
slots_set_font_change(); slots_set_font_change();
slots_set_style_change();
} }
void sui_title::slots_set_style_change() void sui_title::slots_set_style_change()
{ {

View File

@ -378,8 +378,8 @@ void xsteam_data_unserialize()
_data.x_config.steam_dir = (settings.value("SteamPath", "").toString()).toStdString(); _data.x_config.steam_dir = (settings.value("SteamPath", "").toString()).toStdString();
_data.x_config.steam_api_url = "https://store.steampowered.com/api/appdetails/?appids="; _data.x_config.steam_api_url = "https://store.steampowered.com/api/appdetails/?appids=";
_data.x_config.steam_logo_url = "https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/"; _data.x_config.steam_logo_url = "https://shared.cloudflare.steamstatic.com/store_item_assets/steam/apps/";
_data.x_config.steamtools_dir = _data.x_config.steam_dir + "/config/stUI/"; _data.x_config.steamtools_dir = _data.x_config.steam_dir + "/config/stUI";
_data.x_config.steamtools_st_dir = _data.x_config.steam_dir + "/config/stplug-in/"; _data.x_config.steamtools_st_dir = _data.x_config.steam_dir + "/config/stplug-in";
} }
} }
// 序列化全局变量中需要保存在data.json目录下的数据 // 序列化全局变量中需要保存在data.json目录下的数据
@ -458,7 +458,7 @@ bool xsteam_lua_to_com(UidData u_data)
// 文件路径的设定和检测 // 文件路径的设定和检测
QString lua_file = ex_base_exe_ex + QString::fromStdString(u_data.uid) + ".lua"; QString lua_file = ex_base_exe_ex + QString::fromStdString(u_data.uid) + ".lua";
QString lua_packa_file = ex_base_exe_ex + "luapacka.exe"; QString lua_packa_file = ex_base_exe_ex + "luapacka.exe";
QString lua_to_steam_st = QString::fromStdString(_data.x_config.steamtools_st_dir) + QString::fromStdString(u_data.uid) + ".st"; QString lua_to_steam_st = QString::fromStdString(_data.x_config.steamtools_st_dir) +"/" +QString::fromStdString(u_data.uid) + ".st";
QFile _lua_file(lua_file); QFile _lua_file(lua_file);
QFile _lua_packa_file(lua_packa_file); QFile _lua_packa_file(lua_packa_file);
if (_lua_file.exists()) if (_lua_file.exists())
@ -613,7 +613,7 @@ void xsteam_delete_uid_st(std::string uid)
{ {
if (it->uid == uid) if (it->uid == uid)
{ {
QFile st(QString::fromStdString(_data.x_config.steamtools_st_dir + uid + ".st")); QFile st(QString::fromStdString(_data.x_config.steamtools_st_dir +"/"+ uid + ".st"));
if (st.exists()) if (st.exists())
{ {
st.remove(); st.remove();

View File

@ -48,6 +48,7 @@ void xsteam_ui::xsteam_init_mind_layout()
{ {
title()->set_title(tr("XSteam")); title()->set_title(tr("XSteam"));
mind_widget = new QWidget(); mind_widget = new QWidget();
mind_widget->setMouseTracking(true);
mind_layout = new QVBoxLayout(); mind_layout = new QVBoxLayout();
server_layout = new QHBoxLayout(); server_layout = new QHBoxLayout();
server_tag = new QLabel(tr("源数据:")); server_tag = new QLabel(tr("源数据:"));