wayland适配
This commit is contained in:
parent
494a1bae20
commit
f2dadaaf7a
|
@ -167,7 +167,7 @@ void LanListItem::onInfoButtonClicked()
|
|||
}
|
||||
|
||||
netDetail = new NetDetail(m_deviceName, m_lanConnectItem.m_connectName,
|
||||
m_lanConnectItem.m_connectUuid, isActivated,false, false, this);
|
||||
m_lanConnectItem.m_connectUuid, isActivated,false, false);
|
||||
|
||||
connect(netDetail, &NetDetail::destroyed, [&](){
|
||||
if (netDetail != nullptr) {
|
||||
|
|
|
@ -402,7 +402,7 @@ void WlanListItem::onInfoButtonClicked()
|
|||
|
||||
netDetail = new NetDetail(m_wlanDevice, m_wirelessNetItem.m_NetSsid,
|
||||
m_wirelessNetItem.m_connectUuid, isActive, true,
|
||||
!m_wirelessNetItem.m_isConfigured, this);
|
||||
!m_wirelessNetItem.m_isConfigured);
|
||||
connect(netDetail, &NetDetail::destroyed, [&](){
|
||||
if (netDetail != nullptr) {
|
||||
netDetail = nullptr;
|
||||
|
@ -441,7 +441,7 @@ void WlanListItem::onNetButtonClicked()
|
|||
KWindowSystem::raiseWindow(enterpriseWlanDialog->winId());
|
||||
return;
|
||||
} else {
|
||||
enterpriseWlanDialog = new EnterpriseWlanDialog(m_wirelessNetItem, m_wlanDevice, this);
|
||||
enterpriseWlanDialog = new EnterpriseWlanDialog(m_wirelessNetItem, m_wlanDevice);
|
||||
connect(enterpriseWlanDialog, &EnterpriseWlanDialog::enterpriseWlanDialogClose, this, &WlanListItem::onEnterpriseWlanDialogClose);
|
||||
enterpriseWlanDialog->show();
|
||||
isEnterpriseWlanDialogShow = true;
|
||||
|
|
|
@ -47,9 +47,13 @@ void MainWindow::showMainwindow()
|
|||
/**
|
||||
* 设置主界面跳过任务栏和分页器的属性,隐藏再次展示有可能辉冲刷掉该属性,需要展示时重新设置
|
||||
*/
|
||||
const KWindowInfo info(this->winId(), NET::WMState);
|
||||
if (!info.hasState(NET::SkipTaskbar) || !info.hasState(NET::SkipPager)) {
|
||||
KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||
QString platform = QGuiApplication::platformName();
|
||||
if(!platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive))
|
||||
{
|
||||
const KWindowInfo info(this->winId(), NET::WMState);
|
||||
if (!info.hasState(NET::SkipTaskbar) || !info.hasState(NET::SkipPager)) {
|
||||
KWindowSystem::setState(this->winId(), NET::SkipTaskbar | NET::SkipPager);
|
||||
}
|
||||
}
|
||||
|
||||
this->showByWaylandHelper();
|
||||
|
@ -166,11 +170,15 @@ void MainWindow::initWindowProperties()
|
|||
this->setAttribute(Qt::WA_TranslucentBackground, true); //透明
|
||||
this->setFocusPolicy(Qt::NoFocus);
|
||||
|
||||
QPainterPath path;
|
||||
auto rect = this->rect();
|
||||
// path.addRoundedRect(rect, 12, 12);
|
||||
path.addRect(rect);
|
||||
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); //背景模糊
|
||||
QString platform = QGuiApplication::platformName();
|
||||
if(!platform.startsWith(QLatin1String("wayland"),Qt::CaseInsensitive))
|
||||
{
|
||||
QPainterPath path;
|
||||
auto rect = this->rect();
|
||||
// path.addRoundedRect(rect, 12, 12);
|
||||
path.addRect(rect);
|
||||
KWindowEffects::enableBlurBehind(this->winId(), true, QRegion(path.toFillPolygon().toPolygon())); //背景模糊
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::paintEvent(QPaintEvent *event)
|
||||
|
|
|
@ -11,6 +11,8 @@
|
|||
#include <QMenu>
|
||||
#include <QToolTip>
|
||||
|
||||
#include "windowmanager/windowmanager.h"
|
||||
|
||||
#define WINDOW_WIDTH 520
|
||||
#define WINDOW_HEIGHT 590
|
||||
#define BUTTON_SIZE 30
|
||||
|
@ -195,6 +197,10 @@ void NetDetail::centerToScreen()
|
|||
int x = this->width();
|
||||
int y = this->height();
|
||||
this->move(desk_x / 2 - x / 2 + desk_rect.left(), desk_y / 2 - y / 2 + desk_rect.top());
|
||||
// kdk::WindowManager::setGeometry(this->windowHandle(), QRect(desk_x / 2 - x / 2 + desk_rect.left(),
|
||||
// desk_y / 2 - y / 2 + desk_rect.top(),
|
||||
// this->width(),
|
||||
// this->height()));
|
||||
}
|
||||
|
||||
void NetDetail::initUI()
|
||||
|
|
|
@ -1239,7 +1239,7 @@ void LanPage::showDetailPage(QString devName, QString uuid)
|
|||
return;
|
||||
}
|
||||
|
||||
NetDetail *netDetail = new NetDetail(devName, p_item->m_connectName, uuid, isActive, false, false, this);
|
||||
NetDetail *netDetail = new NetDetail(devName, p_item->m_connectName, uuid, isActive, false, false);
|
||||
netDetail->show();
|
||||
|
||||
delete p_item;
|
||||
|
|
|
@ -996,7 +996,7 @@ void WlanPage::requestScan()
|
|||
void WlanPage::onHiddenWlanClicked()
|
||||
{
|
||||
qDebug() << "[wlanPage] AddHideWifi Clicked! " << Q_FUNC_INFO << __LINE__ ;
|
||||
NetDetail *netDetail = new NetDetail(m_currentDevice, "", "", false, true, true, this);
|
||||
NetDetail *netDetail = new NetDetail(m_currentDevice, "", "", false, true, true);
|
||||
netDetail->show();
|
||||
}
|
||||
|
||||
|
@ -1363,7 +1363,7 @@ void WlanPage::showDetailPage(QString devName, QString ssid)
|
|||
|
||||
bool isActive = m_connectResource->isActivatedConnection(wirelessNetItem.m_connectUuid);
|
||||
|
||||
NetDetail *netDetail = new NetDetail(devName, ssid, wirelessNetItem.m_connectUuid, isActive, true, !wirelessNetItem.m_isConfigured, this);
|
||||
NetDetail *netDetail = new NetDetail(devName, ssid, wirelessNetItem.m_connectUuid, isActive, true, !wirelessNetItem.m_isConfigured);
|
||||
netDetail->show();
|
||||
|
||||
return;
|
||||
|
|
10
src/main.cpp
10
src/main.cpp
|
@ -153,11 +153,11 @@ int main(int argc, char *argv[])
|
|||
w.setProperty("useStyleWindowManager", false); //禁用拖动
|
||||
//设置窗口无边框,阴影
|
||||
|
||||
MotifWmHints window_hints;
|
||||
window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||
window_hints.functions = MWM_FUNC_ALL;
|
||||
window_hints.decorations = MWM_DECOR_BORDER;
|
||||
XAtomHelper::getInstance()->setWindowMotifHint(w.winId(), window_hints);
|
||||
// MotifWmHints window_hints;
|
||||
// window_hints.flags = MWM_HINTS_FUNCTIONS | MWM_HINTS_DECORATIONS;
|
||||
// window_hints.functions = MWM_FUNC_ALL;
|
||||
// window_hints.decorations = MWM_DECOR_BORDER;
|
||||
// XAtomHelper::getInstance()->setWindowMotifHint(w.winId(), window_hints);
|
||||
|
||||
// w.setWindowFlags(Qt::CustomizeWindowHint | Qt::FramelessWindowHint | Qt::X11BypassWindowManagerHint);
|
||||
|
||||
|
|
Loading…
Reference in New Issue