feat(frontend): Reset geometry for ukui-search.
Description: 重新计算搜索主界面的显示位置 Log: 重新计算搜索主界面的显示位置
This commit is contained in:
parent
aefe8e958f
commit
449825c5f9
|
@ -6009,7 +6009,7 @@ zhòng 仲
|
||||||
pǐ,pí,bì 仳
|
pǐ,pí,bì 仳
|
||||||
wò 仴
|
wò 仴
|
||||||
wǔ 仵
|
wǔ 仵
|
||||||
jiàn,móu 件
|
jiàn 件
|
||||||
jià,jiè,jie 价
|
jià,jiè,jie 价
|
||||||
yǎo,fó 仸
|
yǎo,fó 仸
|
||||||
fēng 仹
|
fēng 仹
|
||||||
|
@ -11099,7 +11099,7 @@ tuō,chǐ 拖
|
||||||
jū,gōu,jǔ,jú 拘
|
jū,gōu,jǔ,jú 拘
|
||||||
zhuō 拙
|
zhuō 拙
|
||||||
pàn,biàn,fèn,fān,pīn 拚
|
pàn,biàn,fèn,fān,pīn 拚
|
||||||
zhāo,qiáo,sháo 招
|
zhāo 招
|
||||||
bài 拜
|
bài 拜
|
||||||
bài 拝
|
bài 拝
|
||||||
dǐ 拞
|
dǐ 拞
|
||||||
|
@ -12449,7 +12449,7 @@ guā,tiǎn,kuò 栝
|
||||||
kān 栞
|
kān 栞
|
||||||
bēn,bīng 栟
|
bēn,bīng 栟
|
||||||
rěn 栠
|
rěn 栠
|
||||||
xiào,jiào,jiǎo,qiāo 校
|
xiào,jiào,jiǎo 校
|
||||||
bǎi 栢
|
bǎi 栢
|
||||||
rěn 栣
|
rěn 栣
|
||||||
bìng 栤
|
bìng 栤
|
||||||
|
|
|
@ -6009,7 +6009,7 @@ zhong 仲
|
||||||
pi,bi 仳
|
pi,bi 仳
|
||||||
wo 仴
|
wo 仴
|
||||||
wu 仵
|
wu 仵
|
||||||
mou,jian 件
|
jian 件
|
||||||
jie,jia 价
|
jie,jia 价
|
||||||
fo,yao 仸
|
fo,yao 仸
|
||||||
feng 仹
|
feng 仹
|
||||||
|
@ -11099,7 +11099,7 @@ niu,yu,ao 拗
|
||||||
ju,gou 拘
|
ju,gou 拘
|
||||||
zhuo 拙
|
zhuo 拙
|
||||||
pin,fan,pan,fen,bian 拚
|
pin,fan,pan,fen,bian 拚
|
||||||
shao,qiao,zhao 招
|
zhao 招
|
||||||
bai 拜
|
bai 拜
|
||||||
bai 拝
|
bai 拝
|
||||||
di 拞
|
di 拞
|
||||||
|
@ -12449,7 +12449,7 @@ kuo,tian,gua 栝
|
||||||
kan 栞
|
kan 栞
|
||||||
bing,ben 栟
|
bing,ben 栟
|
||||||
ren 栠
|
ren 栠
|
||||||
jiao,qiao,xiao 校
|
jiao,xiao 校
|
||||||
bai 栢
|
bai 栢
|
||||||
ren 栣
|
ren 栣
|
||||||
bing 栤
|
bing 栤
|
||||||
|
|
|
@ -128,12 +128,20 @@ MainWindow::MainWindow(QWidget *parent) :
|
||||||
connect(m_sys_tray_icon,&QSystemTrayIcon::activated,this,[=](QSystemTrayIcon::ActivationReason reason){
|
connect(m_sys_tray_icon,&QSystemTrayIcon::activated,this,[=](QSystemTrayIcon::ActivationReason reason){
|
||||||
if(reason == QSystemTrayIcon::Trigger)
|
if(reason == QSystemTrayIcon::Trigger)
|
||||||
{
|
{
|
||||||
clearSearchResult();
|
if (!this->isVisible()) {
|
||||||
this->moveToPanel();
|
clearSearchResult();
|
||||||
this->show();
|
this->moveToPanel();
|
||||||
this->m_searchLayout->focusIn(); //打开主界面时输入框夺焦,可直接输入
|
this->show();
|
||||||
this->raise();
|
this->m_searchLayout->focusIn(); //打开主界面时输入框夺焦,可直接输入
|
||||||
this->activateWindow();
|
this->raise();
|
||||||
|
this->activateWindow();
|
||||||
|
} else {
|
||||||
|
this->hide();
|
||||||
|
m_contentFrame->closeWebView();
|
||||||
|
m_search_result_thread->requestInterruption();
|
||||||
|
m_search_result_thread->quit();
|
||||||
|
m_seach_app_thread->stop();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -334,12 +342,15 @@ void MainWindow::moveToPanel()
|
||||||
QDBusConnection::sessionBus());
|
QDBusConnection::sessionBus());
|
||||||
if (QDBusReply<int>(primaryScreenInterface.call("x")).isValid()) {
|
if (QDBusReply<int>(primaryScreenInterface.call("x")).isValid()) {
|
||||||
QDBusReply<int> x = primaryScreenInterface.call("x");
|
QDBusReply<int> x = primaryScreenInterface.call("x");
|
||||||
|
QDBusReply<int> y = primaryScreenInterface.call("y");
|
||||||
QDBusReply<int> width = primaryScreenInterface.call("width");
|
QDBusReply<int> width = primaryScreenInterface.call("width");
|
||||||
QDBusReply<int> height = primaryScreenInterface.call("height");
|
QDBusReply<int> height = primaryScreenInterface.call("height");
|
||||||
screenGeometry.setX(x);
|
screenGeometry.setX(x);
|
||||||
|
screenGeometry.setY(y);
|
||||||
screenGeometry.setWidth(width);
|
screenGeometry.setWidth(width);
|
||||||
screenGeometry.setHeight(height);
|
screenGeometry.setHeight(height);
|
||||||
availableGeometry.setX(x);
|
availableGeometry.setX(x);
|
||||||
|
availableGeometry.setY(y);
|
||||||
availableGeometry.setWidth(width);
|
availableGeometry.setWidth(width);
|
||||||
availableGeometry.setHeight(height);
|
availableGeometry.setHeight(height);
|
||||||
}
|
}
|
||||||
|
@ -354,29 +365,20 @@ void MainWindow::moveToPanel()
|
||||||
|
|
||||||
int position = QDBusReply<int>(interface.call("GetPanelPosition", "position"));
|
int position = QDBusReply<int>(interface.call("GetPanelPosition", "position"));
|
||||||
int height = QDBusReply<int>(interface.call("GetPanelPosition", "height"));
|
int height = QDBusReply<int>(interface.call("GetPanelPosition", "height"));
|
||||||
int d = 2; //窗口边沿到任务栏距离
|
int d = 8; //窗口边沿到任务栏距离
|
||||||
|
|
||||||
if (position == 0) {
|
if (position == 0) {
|
||||||
//任务栏在下侧
|
//任务栏在下侧
|
||||||
this->move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + availableGeometry.height() - this->height() - height - d);
|
this->move(availableGeometry.x() + availableGeometry.width() - this->width() - d, screenMainRect.y() + availableGeometry.height() - this->height() - height - d);
|
||||||
} else if(position == 1) {
|
} else if(position == 1) {
|
||||||
//任务栏在上侧
|
//任务栏在上侧
|
||||||
qDebug()<<"任务栏在上侧";
|
this->move(availableGeometry.x() + availableGeometry.width() - this->width() - d, screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + height + d);
|
||||||
this->move(availableGeometry.x() + availableGeometry.width() - this->width(), screenMainRect.y() + screenGeometry.height() - availableGeometry.height() + height + d);
|
|
||||||
} else if (position == 2) {
|
} else if (position == 2) {
|
||||||
//任务栏在左侧
|
//任务栏在左侧
|
||||||
if (screenGeometry.x() == 0) {//主屏在左侧
|
this->move(screenGeometry.x() + screenGeometry.width() - availableGeometry.width() + d, screenGeometry.y() + screenGeometry.height() - this->height() - d);
|
||||||
this->move(height + d, screenMainRect.y() + screenMainRect.height() - this->height());
|
|
||||||
} else {//主屏在右侧
|
|
||||||
this->move(screenMainRect.x() + height + d, screenMainRect.y() + screenMainRect.height() - this->height());
|
|
||||||
}
|
|
||||||
} else if (position == 3) {
|
} else if (position == 3) {
|
||||||
//任务栏在右侧
|
//任务栏在右侧
|
||||||
if (screenGeometry.x() == 0) {//主屏在左侧
|
this->move(screenGeometry.x() + availableGeometry.width() - this->width() - d, screenGeometry.y() + screenGeometry.height() - this->height() - d);
|
||||||
this->move(screenMainRect.width() - this->width() - height - d, screenMainRect.y() + screenMainRect.height() - this->height());
|
|
||||||
} else {//主屏在右侧
|
|
||||||
this->move(screenMainRect.x() + screenMainRect.width() - this->width() - height - d, screenMainRect.y() + screenMainRect.height() - this->height());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue