This commit is contained in:
2025-10-27 13:49:44 +08:00
parent 351dfdc29b
commit 30780ae655
2 changed files with 49 additions and 30 deletions
+48 -26
View File
@@ -234,7 +234,7 @@ public:
padding: 0 10px 0 10px;
}
)");
QVBoxLayout* consoleMainLayout = new QVBoxLayout(consoleGroupBox);
consoleMainLayout->setContentsMargins(15, 15, 15, 15);
consoleMainLayout->setSpacing(10);
@@ -248,7 +248,7 @@ public:
QHBoxLayout* consoletLayout = new QHBoxLayout();
consoletLayout->setSpacing(15);
fancyButtonText* showConsoleBtn = new fancyButtonText(QString::fromStdString(Translation::getInstance().translate("showConsole")), 120, 35, "");
showConsoleBtn->setStyleSheet(R"(
fancyButtonText {
@@ -263,7 +263,7 @@ public:
stop:0 rgb(100, 200, 100), stop:1 rgb(80, 160, 80));
}
)");
fancyButtonText* hideConsoleBtn = new fancyButtonText(QString::fromStdString(Translation::getInstance().translate("hideConsole")), 120, 35, "");
hideConsoleBtn->setStyleSheet(R"(
fancyButtonText {
@@ -279,7 +279,7 @@ public:
}
)");
fancyButtonText* setResolutionBtn = new fancyButtonText( u8"设置1920x1040");
fancyButtonText* setResolutionBtn = new fancyButtonText(u8"设置1920x1040");
setResolutionBtn->setStyleSheet(R"(
fancyButtonText {
background: qlineargradient(x1:0, y1:0, x2:0, y2:1,
@@ -303,33 +303,55 @@ public:
connect(showConsoleBtn, &QPushButton::clicked, [=]() {
ShowWindow(_config->consoleHandle, SW_SHOW);
});
});
connect(hideConsoleBtn, &QPushButton::clicked, [=]() {
ShowWindow(_config->consoleHandle, SW_HIDE);
});
});
connect(setResolutionBtn, &QPushButton::clicked, [=]() {
// 获取当前窗口的顶级窗口
QWidget* topWidget = this;
while (topWidget->parentWidget()) {
topWidget = topWidget->parentWidget();
}
// 设置窗口大小为1920x1080
topWidget->resize(1920, 1080);
// 可选:将窗口居中显示
QScreen* screen = QApplication::primaryScreen();
if (screen) {
QRect screenGeometry = screen->geometry();
int x = (screenGeometry.width() - 1920) / 2;
int y = (screenGeometry.height() - 1080) / 2;
if (x >= 0 && y >= 0) {
topWidget->move(x, y);
connect(setResolutionBtn, &QPushButton::clicked, [=]() {
// 获取当前窗口的顶级窗口
QWidget* topWidget = this;
while (topWidget->parentWidget()) {
topWidget = topWidget->parentWidget();
}
}
}); m_layout->addWidget(consoleGroupBox);
// 设置窗口大小为1920x1080
topWidget->resize(1920, 1080);
// 可选:将窗口居中显示
QScreen* screen = QApplication::primaryScreen();
if (screen) {
QRect screenGeometry = screen->geometry();
int x = (screenGeometry.width() - 1920) / 2;
int y = (screenGeometry.height() - 1080) / 2;
if (x >= 0 && y >= 0) {
topWidget->move(x, y);
}
}
}); m_layout->addWidget(consoleGroupBox);
}
//杂项
{
QGroupBox* consoleGroupBox = new QGroupBox("杂项");
consoleGroupBox->setObjectName("toolsGroupBox");
consoleGroupBox->setStyleSheet(R"(
QGroupBox#consoleGroupBox {
background: rgb(50, 55, 60);
border-radius: 10px;
font-family: "微软雅黑";
font-size: 14px;
font-weight: bold;
color: white;
padding-top: 20px;
}
QGroupBox#consoleGroupBox::title {
subcontrol-origin: margin;
left: 10px;
padding: 0 10px 0 10px;
}
)");
QHboxLayout hLayout = new QHboxLayout(consoleGroupBox);
}
// 硬件信息区域
{
+1 -4
View File
@@ -31,7 +31,7 @@
//行数上限
const int MAX_LOGWIDGET_LINES = 1000;
//内存中存储的消息数量上限
const int MAX_STORED_MESSAGES = 8000;
const int MAX_STORED_MESSAGES = 5000;
//批量处理延迟时间(毫秒)
const int BATCH_UPDATE_DELAY = 300;
@@ -129,9 +129,6 @@ public:
btnPtr->toDefault();
btn->pressed();
widgets->setCurrentIndex(index);
// 切换页面时应用过滤器以显示最新内容
applyFilters(index);
});
QWidget* widget = new QWidget();