From ed36dd3868639ebcafdf166419624fa0bf1c1abf Mon Sep 17 00:00:00 2001 From: lixueman Date: Mon, 24 Oct 2022 16:17:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=BF=E6=8D=A2=E4=BB=BB=E5=8A=A1=E6=A0=8F?= =?UTF-8?q?=E9=AB=98=E5=BA=A6=E8=8E=B7=E5=8F=96=E6=8E=A5=E5=8F=A3;?= =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=85=A8=E5=B1=8F=E5=BC=80=E5=A7=8B=E8=8F=9C?= =?UTF-8?q?=E5=8D=95=E5=AE=9A=E4=BD=8D=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Widget/full_commonuse_widget.cpp | 4 +++- src/UserInterface/mainwindow.cpp | 8 ++++++- src/UtilityFunction/utility.cpp | 23 ++++++++++--------- 3 files changed, 22 insertions(+), 13 deletions(-) diff --git a/src/UserInterface/Widget/full_commonuse_widget.cpp b/src/UserInterface/Widget/full_commonuse_widget.cpp index 6adab1a..adbce44 100755 --- a/src/UserInterface/Widget/full_commonuse_widget.cpp +++ b/src/UserInterface/Widget/full_commonuse_widget.cpp @@ -170,7 +170,7 @@ void FullCommonUseWidget::resizeScrollAreaControls() rowcount = listview->model()->rowCount() / dividend; } - listview->setFixedSize(m_listView->width(), listview->gridSize().height() * rowcount); + listview->setFixedSize(Style::m_applistAreaWidth, listview->gridSize().height() * rowcount); m_scrollArea->widget()->setFixedSize(listview->size()); } @@ -275,11 +275,13 @@ void FullCommonUseWidget::updateListView() void FullCommonUseWidget::repaintWidget() { m_scrollArea->setFixedSize(Style::m_applistAreaWidth, Style::m_applistWidHeight); + m_scrollArea->setWidgetResizable(true); m_scrollAreaWidLayout->removeWidget(m_listView); m_listView->setParent(nullptr); delete m_listView; initAppListWidget(); fillAppList(); + m_scrollAreaWid->adjustSize(); m_scrollAreaWidHeight = m_scrollAreaWid->height(); initVerticalScrollBar(); on_setAreaScrollBarValue(0); diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp index 0c07b15..42a5e78 100755 --- a/src/UserInterface/mainwindow.cpp +++ b/src/UserInterface/mainwindow.cpp @@ -1382,8 +1382,14 @@ void MainWindow::repaintWidget() int y = Style::m_primaryScreenY; int width = Style::m_availableScreenWidth; int height = Style::m_availableScreenHeight; + setMinWindowPos(); - m_fullWindow->move(x, y); + + if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { + kdk::WindowManager::setGeometry(m_fullWindow->windowHandle(), QRect(x, y, width, height)); + } else { + m_fullWindow->move(x, y); + } m_fullWindow->setFixedSize(width, height); m_fullWindow->repaintWidget(); } diff --git a/src/UtilityFunction/utility.cpp b/src/UtilityFunction/utility.cpp index c7b63e7..1873136 100755 --- a/src/UtilityFunction/utility.cpp +++ b/src/UtilityFunction/utility.cpp @@ -138,23 +138,24 @@ QVariantList getScreenGeometryList() QRect rect; rect = qApp->primaryScreen()->geometry(); int panelSize = 0; - int position = 0; + int panelPosition = 0; QVariantList list; list.clear(); - QDBusInterface iface(DBUS_NAME, - DBUS_PATH, - DBUS_INTERFACE, - QDBusConnection::sessionBus()); - QDBusReply reply = iface.call("GetPrimaryScreenPhysicalGeometry"); - if (reply.isValid()) { - panelSize = reply.value().at(4).toInt(); - position = reply.value().at(5).toInt(); + if (QGSettings::isSchemaInstalled(QString("org.ukui.panel.settings").toLocal8Bit())) { + QGSettings gsetting(QString("org.ukui.panel.settings").toLocal8Bit()); + if (gsetting.keys().contains("panelposition")) { + panelPosition = gsetting.get("panelposition").toInt(); + } + + if (gsetting.keys().contains("panelsize")) { + panelSize = gsetting.get("panelsize").toInt(); + } } QList posIndex; - switch (position) { + switch (panelPosition) { case BOTTOM: posIndex = {0, 0, 0, -1}; break; @@ -173,7 +174,7 @@ QVariantList getScreenGeometryList() list.append(rect.width() + posIndex[2] * panelSize); list.append(rect.height() + posIndex[3] * panelSize); list.append(panelSize); - list.append(position); + list.append(panelPosition); return list; }