增加字体粗细选项
This commit is contained in:
parent
73b255ae96
commit
f69f4fb27d
@ -110,12 +110,12 @@ SET(PROJECT_SOURCES
|
|||||||
${src}
|
${src}
|
||||||
)
|
)
|
||||||
# 设置消息策略为qFatal来禁用qDebug信息
|
# 设置消息策略为qFatal来禁用qDebug信息
|
||||||
LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT")
|
#LIST(APPEND CMAKE_CXX_FLAGS "-DQT_NO_DEBUG_OUTPUT")
|
||||||
|
|
||||||
#资源文件
|
#资源文件
|
||||||
QT6_ADD_RESOURCES(RCFILES res.qrc)
|
QT6_ADD_RESOURCES(RCFILES res.qrc)
|
||||||
#WIN32
|
#WIN32
|
||||||
add_executable(${PROJECT_NAME} WIN32 ${PROJECT_SOURCES} ${RCFILES} xsteam.rc)
|
add_executable(${PROJECT_NAME} ${PROJECT_SOURCES} ${RCFILES} xsteam.rc)
|
||||||
|
|
||||||
#安全编译
|
#安全编译
|
||||||
#关闭RPATH特性
|
#关闭RPATH特性
|
||||||
|
@ -113,6 +113,18 @@ void sui_title::slots_ico_menu()
|
|||||||
connect(f_Action,SIGNAL(triggered (bool)),this,SLOT(slots_set_font_change()));
|
connect(f_Action,SIGNAL(triggered (bool)),this,SLOT(slots_set_font_change()));
|
||||||
f_menu->addAction(f_Action);
|
f_menu->addAction(f_Action);
|
||||||
}
|
}
|
||||||
|
QAction *separator = new QAction(nullptr);
|
||||||
|
separator->setSeparator(true);
|
||||||
|
f_menu->addAction(separator);
|
||||||
|
QActionGroup* b_QGroup = new QActionGroup(this);
|
||||||
|
QAction* b_Action=new QAction("字体加粗",b_QGroup);
|
||||||
|
b_Action->setObjectName("font_bold");
|
||||||
|
b_Action->setCheckable(true);
|
||||||
|
if(_data.x_config.font_bold){
|
||||||
|
b_Action->setChecked(true);
|
||||||
|
}
|
||||||
|
connect(b_Action,SIGNAL(triggered (bool)),this,SLOT(slots_set_font_change()));
|
||||||
|
f_menu->addAction(b_Action);
|
||||||
}
|
}
|
||||||
m_menu->addMenu(s_menu);
|
m_menu->addMenu(s_menu);
|
||||||
m_menu->addMenu(f_menu);
|
m_menu->addMenu(f_menu);
|
||||||
@ -130,13 +142,25 @@ void sui_title::slots_set_style_change()
|
|||||||
void sui_title::slots_set_font_change()
|
void sui_title::slots_set_font_change()
|
||||||
{
|
{
|
||||||
if(sender()!=nullptr){
|
if(sender()!=nullptr){
|
||||||
_data.x_config.font=sender()->objectName().toInt();
|
if(sender()->objectName()=="font_bold"){
|
||||||
|
if(_data.x_config.font_bold){
|
||||||
|
_data.x_config.font_bold=0;
|
||||||
|
}else{
|
||||||
|
_data.x_config.font_bold=1;
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
_data.x_config.font=sender()->objectName().toInt();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
QFont font;
|
QFont font;
|
||||||
if(!font_table[_data.x_config.font].isEmpty()){
|
if(!font_table[_data.x_config.font].isEmpty()){
|
||||||
font.setFamily(font_table[_data.x_config.font]);
|
font.setFamily(font_table[_data.x_config.font]);
|
||||||
font.setPointSize(10);
|
font.setPointSize(10);
|
||||||
font.setBold(true);
|
if( _data.x_config.font_bold){
|
||||||
|
font.setBold(true);
|
||||||
|
}else{
|
||||||
|
font.setBold(false);
|
||||||
|
}
|
||||||
QApplication::setFont(font);
|
QApplication::setFont(font);
|
||||||
}else {
|
}else {
|
||||||
qDebug()<<"Failed to load font.";
|
qDebug()<<"Failed to load font.";
|
||||||
|
@ -45,7 +45,7 @@ private:
|
|||||||
QPushButton *m_max_button; //最大化/还原按钮
|
QPushButton *m_max_button; //最大化/还原按钮
|
||||||
QPushButton *m_close_button; //关闭按钮
|
QPushButton *m_close_button; //关闭按钮
|
||||||
QSpacerItem *sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
|
QSpacerItem *sparcer_item = new QSpacerItem(0,0,QSizePolicy::Expanding,QSizePolicy::Fixed);
|
||||||
QMenu *m_menu;
|
QMenu* m_menu;
|
||||||
QMenu* s_menu;
|
QMenu* s_menu;
|
||||||
QMenu* f_menu;
|
QMenu* f_menu;
|
||||||
QStringList style_table;
|
QStringList style_table;
|
||||||
|
@ -56,6 +56,7 @@ typedef struct
|
|||||||
{
|
{
|
||||||
int style = 0;
|
int style = 0;
|
||||||
int font = 0;
|
int font = 0;
|
||||||
|
int font_bold=0;
|
||||||
std::string steam_dir={};
|
std::string steam_dir={};
|
||||||
std::string steamtools_dir={};
|
std::string steamtools_dir={};
|
||||||
std::string steamtools_st_dir={};
|
std::string steamtools_st_dir={};
|
||||||
|
@ -348,6 +348,7 @@ void xsteam_save_data_read()
|
|||||||
}
|
}
|
||||||
_data.x_config.style = j3.at("xsteam_sets").at("style");
|
_data.x_config.style = j3.at("xsteam_sets").at("style");
|
||||||
_data.x_config.font = j3.at("xsteam_sets").at("font");
|
_data.x_config.font = j3.at("xsteam_sets").at("font");
|
||||||
|
_data.x_config.font_bold = j3.at("xsteam_sets").at("font_bold");
|
||||||
_data.x_config.steam_dir = j3.at("xsteam_sets").at("steam_dir");
|
_data.x_config.steam_dir = j3.at("xsteam_sets").at("steam_dir");
|
||||||
_data.x_config.steamtools_dir = j3.at("xsteam_sets").at("steamtools_dir");
|
_data.x_config.steamtools_dir = j3.at("xsteam_sets").at("steamtools_dir");
|
||||||
_data.x_config.steamtools_st_dir = j3.at("xsteam_sets").at("steamtools_st_dir");
|
_data.x_config.steamtools_st_dir = j3.at("xsteam_sets").at("steamtools_st_dir");
|
||||||
@ -365,6 +366,7 @@ void xsteam_save_data_read()
|
|||||||
_data.s_data.push_back(_src_data);
|
_data.s_data.push_back(_src_data);
|
||||||
// 默认配置
|
// 默认配置
|
||||||
_data.x_config.font = 0;
|
_data.x_config.font = 0;
|
||||||
|
_data.x_config.font_bold=0;
|
||||||
_data.x_config.style = 1;
|
_data.x_config.style = 1;
|
||||||
QSettings settings("HKEY_CURRENT_USER\\Software\\Valve\\Steam", QSettings::NativeFormat);
|
QSettings settings("HKEY_CURRENT_USER\\Software\\Valve\\Steam", QSettings::NativeFormat);
|
||||||
_data.x_config.steam_dir = (settings.value("SteamPath", "").toString()).toStdString();
|
_data.x_config.steam_dir = (settings.value("SteamPath", "").toString()).toStdString();
|
||||||
@ -425,6 +427,7 @@ json xsteam_data_serialize(json jsonData)
|
|||||||
}
|
}
|
||||||
jsonData[toStr(xsteam_sets)][toStr(style)] = _data.x_config.style;
|
jsonData[toStr(xsteam_sets)][toStr(style)] = _data.x_config.style;
|
||||||
jsonData[toStr(xsteam_sets)][toStr(font)] = _data.x_config.font;
|
jsonData[toStr(xsteam_sets)][toStr(font)] = _data.x_config.font;
|
||||||
|
jsonData[toStr(xsteam_sets)][toStr(font_bold)] = _data.x_config.font_bold;
|
||||||
jsonData[toStr(xsteam_sets)][toStr(steam_dir)] = _data.x_config.steam_dir;
|
jsonData[toStr(xsteam_sets)][toStr(steam_dir)] = _data.x_config.steam_dir;
|
||||||
jsonData[toStr(xsteam_sets)][toStr(steamtools_dir)] = _data.x_config.steamtools_dir;
|
jsonData[toStr(xsteam_sets)][toStr(steamtools_dir)] = _data.x_config.steamtools_dir;
|
||||||
jsonData[toStr(xsteam_sets)][toStr(steamtools_st_dir)] = _data.x_config.steamtools_st_dir;
|
jsonData[toStr(xsteam_sets)][toStr(steamtools_st_dir)] = _data.x_config.steamtools_st_dir;
|
||||||
|
Loading…
Reference in New Issue
Block a user