🐞 fix(UI模块): 添加最大化选项悬浮提示

https://gitee.com/openkylin/kylin-connectivity/issues/I7260C
This commit is contained in:
huheng@kylinos.cn 2023-05-16 15:18:21 +08:00
parent b20c80a157
commit 71903ac4e3
4 changed files with 63 additions and 44 deletions

View File

@ -731,40 +731,45 @@
<context>
<name>Titlebar</name>
<message>
<location filename="../ui/view/titlebar.cpp" line="182"/>
<location filename="../ui/view/titlebar.cpp" line="186"/>
<source>Menu</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="42"/>
<location filename="../ui/view/titlebar.cpp" line="44"/>
<source>kylin-connectivity</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="54"/>
<location filename="../ui/view/titlebar.cpp" line="56"/>
<source>Minimize</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="72"/>
<location filename="../ui/view/titlebar.cpp" line="66"/>
<source>Maximize</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="76"/>
<source>Close</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="199"/>
<location filename="../ui/view/titlebar.cpp" line="239"/>
<location filename="../ui/view/titlebar.cpp" line="203"/>
<location filename="../ui/view/titlebar.cpp" line="243"/>
<source>Help</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="200"/>
<location filename="../ui/view/titlebar.cpp" line="241"/>
<location filename="../ui/view/titlebar.cpp" line="204"/>
<location filename="../ui/view/titlebar.cpp" line="245"/>
<source>About</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="201"/>
<location filename="../ui/view/titlebar.cpp" line="243"/>
<location filename="../ui/view/titlebar.cpp" line="205"/>
<location filename="../ui/view/titlebar.cpp" line="247"/>
<source>Quit</source>
<translation></translation>
</message>

View File

@ -1134,40 +1134,45 @@
<translation type="vanished">Search</translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="182"/>
<location filename="../ui/view/titlebar.cpp" line="186"/>
<source>Menu</source>
<translation>Menu</translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="42"/>
<location filename="../ui/view/titlebar.cpp" line="44"/>
<source>kylin-connectivity</source>
<translation>kylin-connectivity</translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="54"/>
<location filename="../ui/view/titlebar.cpp" line="56"/>
<source>Minimize</source>
<translation>Minimize</translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="72"/>
<location filename="../ui/view/titlebar.cpp" line="66"/>
<source>Maximize</source>
<translation>Maximize</translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="76"/>
<source>Close</source>
<translation>Close</translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="199"/>
<location filename="../ui/view/titlebar.cpp" line="239"/>
<location filename="../ui/view/titlebar.cpp" line="203"/>
<location filename="../ui/view/titlebar.cpp" line="243"/>
<source>Help</source>
<translation>Help</translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="200"/>
<location filename="../ui/view/titlebar.cpp" line="241"/>
<location filename="../ui/view/titlebar.cpp" line="204"/>
<location filename="../ui/view/titlebar.cpp" line="245"/>
<source>About</source>
<translation>About</translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="201"/>
<location filename="../ui/view/titlebar.cpp" line="243"/>
<location filename="../ui/view/titlebar.cpp" line="205"/>
<location filename="../ui/view/titlebar.cpp" line="247"/>
<source>Quit</source>
<translation>Quit</translation>
</message>

View File

@ -1097,40 +1097,45 @@
<translation type="vanished"></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="182"/>
<location filename="../ui/view/titlebar.cpp" line="186"/>
<source>Menu</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="42"/>
<location filename="../ui/view/titlebar.cpp" line="44"/>
<source>kylin-connectivity</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="54"/>
<location filename="../ui/view/titlebar.cpp" line="56"/>
<source>Minimize</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="72"/>
<location filename="../ui/view/titlebar.cpp" line="66"/>
<source>Maximize</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="76"/>
<source>Close</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="199"/>
<location filename="../ui/view/titlebar.cpp" line="239"/>
<location filename="../ui/view/titlebar.cpp" line="203"/>
<location filename="../ui/view/titlebar.cpp" line="243"/>
<source>Help</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="200"/>
<location filename="../ui/view/titlebar.cpp" line="241"/>
<location filename="../ui/view/titlebar.cpp" line="204"/>
<location filename="../ui/view/titlebar.cpp" line="245"/>
<source>About</source>
<translation></translation>
</message>
<message>
<location filename="../ui/view/titlebar.cpp" line="201"/>
<location filename="../ui/view/titlebar.cpp" line="243"/>
<location filename="../ui/view/titlebar.cpp" line="205"/>
<location filename="../ui/view/titlebar.cpp" line="247"/>
<source>Quit</source>
<translation>退</translation>
</message>

View File

@ -18,7 +18,9 @@ Titlebar::Titlebar(QWidget *parent) : QWidget(parent)
connectInit();
}
Titlebar::~Titlebar() {}
Titlebar::~Titlebar()
{
}
void Titlebar::initUI()
{
@ -36,7 +38,7 @@ void Titlebar::initUI()
m_titleIcon->setContentsMargins(8, 8, 8, 8);
m_minBtn = new QPushButton(this);
m_maxBtn = new QPushButton();
m_maxBtn = new QPushButton(this);
m_closeBtn = new QPushButton(this);
m_titleNameLab->setText(tr("kylin-connectivity"));
@ -60,6 +62,8 @@ void Titlebar::initUI()
m_maxBtn->setProperty("useIconHighlightEffect", 0x2);
m_maxBtn->setFlat(true);
m_maxBtn->setContentsMargins(4, 0, 4, 0);
m_maxBtn->setFocusPolicy(Qt::NoFocus);
m_maxBtn->setToolTip(tr("Maximize"));
// 关闭按钮
m_closeBtn->setIcon(QIcon::fromTheme("window-close-symbolic"));
m_closeBtn->setFixedSize(BTN_SIZE, BTN_SIZE);
@ -118,12 +122,12 @@ void Titlebar::setTheme(PublicAttributes::Theme theme)
m_theme = theme;
if (m_isDefault) {
switch (m_theme) {
case PublicAttributes::Theme::Light: {
setStyleSheet("QWidget#titlebar{background-color: #FFFFFF;}");
} break;
case PublicAttributes::Theme::Dark: {
setStyleSheet("QWidget#titlebar{background-color: #1D1D1D;}");
} break;
case PublicAttributes::Theme::Light: {
setStyleSheet("QWidget#titlebar{background-color: #FFFFFF;}");
} break;
case PublicAttributes::Theme::Dark: {
setStyleSheet("QWidget#titlebar{background-color: #1D1D1D;}");
} break;
}
}
}
@ -133,12 +137,12 @@ void Titlebar::setBackground(bool isDefault)
m_isDefault = isDefault;
if (isDefault) {
switch (m_theme) {
case PublicAttributes::Theme::Light: {
setStyleSheet("QWidget#titlebar{background-color: #FFFFFF;}");
} break;
case PublicAttributes::Theme::Dark: {
setStyleSheet("QWidget#titlebar{background-color: #1D1D1D;}");
} break;
case PublicAttributes::Theme::Light: {
setStyleSheet("QWidget#titlebar{background-color: #FFFFFF;}");
} break;
case PublicAttributes::Theme::Dark: {
setStyleSheet("QWidget#titlebar{background-color: #1D1D1D;}");
} break;
}
} else {
setAttribute(Qt::WA_StyledBackground);