refactor/pure-qt-ui #3

Merged
gaozheng merged 56 commits from refactor/pure-qt-ui into main 2026-06-10 18:41:53 +08:00
2 changed files with 6 additions and 7 deletions
Showing only changes of commit c5393e8ac3 - Show all commits

View File

@ -233,7 +233,7 @@ void TopBar::setWorkspaces(const std::vector<data::Workspace>& list, const QStri
group->addAction(a); group->addAction(a);
if (id == currentId) currentName = name; if (id == currentId) currentName = name;
QObject::connect(a, &QAction::triggered, this, [this, id, name]() { QObject::connect(a, &QAction::triggered, this, [this, id, name]() {
wsBtn_->setText(name + QStringLiteral("")); // 立即反馈 wsBtn_->setText(name); // 立即反馈(下拉箭头由 ElaToolButton 自绘)
emit workspaceSwitchRequested(id); emit workspaceSwitchRequested(id);
}); });
} }
@ -242,8 +242,7 @@ void TopBar::setWorkspaces(const std::vector<data::Workspace>& list, const QStri
none->setEnabled(false); none->setEnabled(false);
} }
wsBtn_->setMenu(menu); wsBtn_->setMenu(menu);
wsBtn_->setText((currentName.isEmpty() ? QStringLiteral("选择空间") : currentName) + wsBtn_->setText(currentName.isEmpty() ? QStringLiteral("选择空间") : currentName);
QStringLiteral(""));
} }
void TopBar::setProjects(const std::vector<data::ProjectSummary>& list, const QString& currentId, void TopBar::setProjects(const std::vector<data::ProjectSummary>& list, const QString& currentId,
@ -264,7 +263,7 @@ void TopBar::setProjects(const std::vector<data::ProjectSummary>& list, const QS
group->addAction(a); group->addAction(a);
if (id == currentId) currentName = name; if (id == currentId) currentName = name;
QObject::connect(a, &QAction::triggered, this, [this, id, name]() { QObject::connect(a, &QAction::triggered, this, [this, id, name]() {
projBtn_->setText(name + QStringLiteral("")); projBtn_->setText(name);
emit projectSwitchRequested(id); emit projectSwitchRequested(id);
}); });
} }
@ -278,12 +277,11 @@ void TopBar::setProjects(const std::vector<data::ProjectSummary>& list, const QS
QObject::connect(all, &QAction::triggered, this, [this]() { emit allProjectsRequested(); }); QObject::connect(all, &QAction::triggered, this, [this]() { emit allProjectsRequested(); });
} }
projBtn_->setMenu(menu); projBtn_->setMenu(menu);
projBtn_->setText((currentName.isEmpty() ? QStringLiteral("选择项目") : currentName) + projBtn_->setText(currentName.isEmpty() ? QStringLiteral("选择项目") : currentName);
QStringLiteral(""));
} }
void TopBar::setProjectButtonText(const QString& name) { void TopBar::setProjectButtonText(const QString& name) {
projBtn_->setText(name + QStringLiteral("")); projBtn_->setText(name);
} }
} // namespace geopro::app } // namespace geopro::app

View File

@ -1095,6 +1095,7 @@ int main(int argc, char* argv[])
ela->resize(1280, 800); ela->resize(1280, 800);
ela->setMinimumSize(1024, 680); ela->setMinimumSize(1024, 680);
ela->setIsNavigationBarEnable(false); // 纯中心内容,不显示左侧导航栏 ela->setIsNavigationBarEnable(false); // 纯中心内容,不显示左侧导航栏
ela->setAppBarHeight(38); // 默认 45 偏大,收紧标题栏更接近原生
auto* inner = new QMainWindow(ela); // 以 ela 为父,避免无父期调色板/DPI 抖动(review H3) auto* inner = new QMainWindow(ela); // 以 ela 为父,避免无父期调色板/DPI 抖动(review H3)
buildWorkbench(*inner, repo, projectRepo, nav); buildWorkbench(*inner, repo, projectRepo, nav);
// 用 addPageNode 把工作台作为唯一页面放进中心页栈(填满到底边)。 // 用 addPageNode 把工作台作为唯一页面放进中心页栈(填满到底边)。