Push layered Qt host source files
This commit is contained in:
@@ -7,11 +7,6 @@ namespace APP {
|
||||
|
||||
QPalette APP_Theme::App_Func_GetPalette()
|
||||
{
|
||||
/*
|
||||
* 不用样式表时,Qt 最稳妥的统一美化方式就是调色板:
|
||||
* 1. 先选 Fusion 风格
|
||||
* 2. 再给标准控件一组统一颜色
|
||||
*/
|
||||
QPalette Palette;
|
||||
|
||||
const QColor WindowColor(20, 25, 33);
|
||||
@@ -45,13 +40,140 @@ QPalette APP_Theme::App_Func_GetPalette()
|
||||
Palette.setColor(QPalette::Disabled, QPalette::WindowText, DimTextColor);
|
||||
Palette.setColor(QPalette::Disabled, QPalette::Text, DimTextColor);
|
||||
Palette.setColor(QPalette::Disabled, QPalette::ButtonText, DimTextColor);
|
||||
Palette.setColor(QPalette::Disabled, QPalette::Base, QColor(30, 35, 43));
|
||||
Palette.setColor(QPalette::Disabled, QPalette::Button, QColor(34, 40, 49));
|
||||
Palette.setColor(QPalette::Disabled, QPalette::Window, QColor(24, 29, 36));
|
||||
Palette.setColor(QPalette::Disabled, QPalette::Highlight, QColor(60, 68, 78));
|
||||
Palette.setColor(QPalette::Disabled, QPalette::HighlightedText, DimTextColor);
|
||||
|
||||
return Palette;
|
||||
}
|
||||
|
||||
QString APP_Theme::App_Func_GetStyleSheet()
|
||||
{
|
||||
return QStringLiteral(R"(
|
||||
QWidget {
|
||||
color: #eef2f7;
|
||||
background-color: transparent;
|
||||
}
|
||||
QTabWidget::pane {
|
||||
border: 0;
|
||||
background: transparent;
|
||||
}
|
||||
QTabBar::tab {
|
||||
background: rgba(56, 64, 76, 0.78);
|
||||
color: #b9c3cf;
|
||||
border: 1px solid #5d6a78;
|
||||
border-bottom: none;
|
||||
border-top-left-radius: 10px;
|
||||
border-top-right-radius: 10px;
|
||||
padding: 8px 18px;
|
||||
margin-right: 6px;
|
||||
min-width: 92px;
|
||||
}
|
||||
QTabBar::tab:selected {
|
||||
background: #2d3742;
|
||||
color: #f7fbff;
|
||||
}
|
||||
QTabBar::tab:hover:!selected {
|
||||
background: #394553;
|
||||
color: #eff4f8;
|
||||
}
|
||||
QPushButton {
|
||||
background: #303947;
|
||||
color: #eff4f8;
|
||||
border: 1px solid #667587;
|
||||
border-radius: 8px;
|
||||
padding: 8px 14px;
|
||||
min-height: 18px;
|
||||
}
|
||||
QPushButton:hover {
|
||||
background: #384354;
|
||||
border-color: #7b8da1;
|
||||
}
|
||||
QPushButton:pressed {
|
||||
background: #25303b;
|
||||
}
|
||||
QPushButton:disabled {
|
||||
background: #252c35;
|
||||
color: #7d8794;
|
||||
border-color: #414b58;
|
||||
}
|
||||
QLineEdit,
|
||||
QPlainTextEdit,
|
||||
QTableWidget,
|
||||
QComboBox,
|
||||
QSpinBox {
|
||||
background: #1d242d;
|
||||
color: #edf3f8;
|
||||
border: 1px solid #4f5d6d;
|
||||
border-radius: 8px;
|
||||
selection-background-color: #48b8a2;
|
||||
selection-color: #102022;
|
||||
}
|
||||
QLineEdit,
|
||||
QComboBox,
|
||||
QSpinBox {
|
||||
padding: 6px 8px;
|
||||
}
|
||||
QPlainTextEdit,
|
||||
QTableWidget {
|
||||
border-radius: 10px;
|
||||
}
|
||||
QHeaderView::section {
|
||||
background: #313b49;
|
||||
color: #d8e0e8;
|
||||
border: none;
|
||||
border-bottom: 1px solid #4f5d6d;
|
||||
padding: 7px 8px;
|
||||
}
|
||||
QTableCornerButton::section {
|
||||
background: #313b49;
|
||||
border: none;
|
||||
border-bottom: 1px solid #4f5d6d;
|
||||
}
|
||||
QTableWidget {
|
||||
alternate-background-color: #232b35;
|
||||
gridline-color: #2f3945;
|
||||
}
|
||||
QTableWidget::item {
|
||||
padding: 4px 6px;
|
||||
}
|
||||
QScrollBar:vertical {
|
||||
background: transparent;
|
||||
width: 10px;
|
||||
margin: 4px 0 4px 0;
|
||||
}
|
||||
QScrollBar::handle:vertical {
|
||||
background: #53606f;
|
||||
min-height: 28px;
|
||||
border-radius: 5px;
|
||||
}
|
||||
QScrollBar::add-line:vertical,
|
||||
QScrollBar::sub-line:vertical,
|
||||
QScrollBar::add-page:vertical,
|
||||
QScrollBar::sub-page:vertical {
|
||||
background: transparent;
|
||||
height: 0;
|
||||
}
|
||||
QMenu {
|
||||
background: #1f262f;
|
||||
color: #eef2f7;
|
||||
border: 1px solid #53606f;
|
||||
padding: 6px;
|
||||
}
|
||||
QMenu::item {
|
||||
padding: 7px 14px;
|
||||
border-radius: 6px;
|
||||
}
|
||||
QMenu::item:selected {
|
||||
background: #33404d;
|
||||
}
|
||||
)");
|
||||
}
|
||||
|
||||
QFont APP_Theme::App_Func_GetBodyFont()
|
||||
{
|
||||
// 正文用相对稳妥、系统常见的字体候选。
|
||||
QFont Font(App_Func_PickFontFamily(QStringList()
|
||||
<< QStringLiteral("Segoe UI Variable Text")
|
||||
<< QStringLiteral("Microsoft YaHei UI")
|
||||
@@ -62,21 +184,8 @@ QFont APP_Theme::App_Func_GetBodyFont()
|
||||
return Font;
|
||||
}
|
||||
|
||||
QFont APP_Theme::App_Func_GetTitleFont()
|
||||
{
|
||||
// 页面标题字号更大、字重更高。
|
||||
QFont Font(App_Func_PickFontFamily(QStringList()
|
||||
<< QStringLiteral("Segoe UI Variable Display Semibold")
|
||||
<< QStringLiteral("Microsoft YaHei UI")
|
||||
<< QStringLiteral("Bahnschrift SemiBold")));
|
||||
Font.setPointSize(21);
|
||||
Font.setWeight(QFont::DemiBold);
|
||||
return Font;
|
||||
}
|
||||
|
||||
QFont APP_Theme::App_Func_GetMetricFont()
|
||||
{
|
||||
// 指标类标题用比正文更有力度的字重。
|
||||
QFont Font(App_Func_PickFontFamily(QStringList()
|
||||
<< QStringLiteral("Bahnschrift SemiBold")
|
||||
<< QStringLiteral("Segoe UI Semibold")
|
||||
@@ -88,7 +197,6 @@ QFont APP_Theme::App_Func_GetMetricFont()
|
||||
|
||||
QFont APP_Theme::App_Func_GetKeyLabelFont()
|
||||
{
|
||||
// 按键主文字字号较大,保证小键盘一眼能看清。
|
||||
QFont Font(App_Func_PickFontFamily(QStringList()
|
||||
<< QStringLiteral("Bahnschrift SemiBold")
|
||||
<< QStringLiteral("Segoe UI Semibold")
|
||||
@@ -99,7 +207,6 @@ QFont APP_Theme::App_Func_GetKeyLabelFont()
|
||||
|
||||
QFont APP_Theme::App_Func_GetKeyHintFont()
|
||||
{
|
||||
// 按键 hint 放左上角,所以字号更小。
|
||||
QFont Font(App_Func_PickFontFamily(QStringList()
|
||||
<< QStringLiteral("Segoe UI Semibold")
|
||||
<< QStringLiteral("Bahnschrift SemiBold")
|
||||
@@ -111,20 +218,17 @@ QFont APP_Theme::App_Func_GetKeyHintFont()
|
||||
|
||||
QString APP_Theme::App_Func_PickFontFamily(const QStringList& FamilyList)
|
||||
{
|
||||
// 从候选字体里依次挑选系统真实存在的字体。
|
||||
const QFontDatabase Database;
|
||||
const QStringList AvailableFamilyList = Database.families();
|
||||
|
||||
for (int Index = 0; Index < FamilyList.size(); ++Index)
|
||||
for (const QString& Family : FamilyList)
|
||||
{
|
||||
const QString& Family = FamilyList.at(Index);
|
||||
if (AvailableFamilyList.contains(Family))
|
||||
{
|
||||
return Family;
|
||||
}
|
||||
}
|
||||
|
||||
// 如果都不存在,就退回 Qt 当前默认字体。
|
||||
return QApplication::font().family();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user