From 5c938c8bb30ded89431b94cc793013135a88fc98 Mon Sep 17 00:00:00 2001 From: zhang_tian_ze Date: Tue, 1 Nov 2022 14:48:14 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E6=A0=87?= =?UTF-8?q?=E6=B8=85=E6=99=B0=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UtilityFunction/utility.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/UtilityFunction/utility.cpp b/src/UtilityFunction/utility.cpp index 1873136..8af6b3f 100755 --- a/src/UtilityFunction/utility.cpp +++ b/src/UtilityFunction/utility.cpp @@ -109,7 +109,7 @@ QIcon getCurIcon(const QString &iconPath, bool autoSet) if (iconPath.endsWith("png")) { pixmap = QPixmap(iconPath); } else { - pixmap = loadSvg(iconPath, 16); + pixmap = loadSvg(iconPath, 26); } if (!autoSet) { From 104c9d149ade9afccd263dc38ae4fdc2dc559e22 Mon Sep 17 00:00:00 2001 From: lixueman Date: Fri, 4 Nov 2022 16:27:27 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=9C=80=E8=BF=91?= =?UTF-8?q?=E5=8C=BA=E5=9F=9F=E6=8F=90=E7=A4=BA=E5=BF=AB=E9=80=9F=E6=BB=91?= =?UTF-8?q?=E5=8A=A8=E9=97=AA=E7=83=81=E9=97=AE=E9=A2=98=EF=BC=9B=E5=85=B3?= =?UTF-8?q?=E6=9C=BA=E6=8C=89=E9=92=AE=E7=82=B9=E5=87=BB=E6=97=B6=E4=B8=BB?= =?UTF-8?q?=E5=8A=A8=E9=9A=90=E8=97=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UserInterface/ViewItem/itemdelegate.cpp | 4 ++-- src/UserInterface/Widget/full_commonuse_widget.cpp | 1 + src/UserInterface/Widget/full_function_widget.cpp | 1 + src/UserInterface/Widget/full_letter_widget.cpp | 1 + src/UserInterface/Widget/full_searchresult_widget.cpp | 1 + src/UserInterface/mainwindow.cpp | 1 + 6 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/UserInterface/ViewItem/itemdelegate.cpp b/src/UserInterface/ViewItem/itemdelegate.cpp index ba41cc7..1615b37 100755 --- a/src/UserInterface/ViewItem/itemdelegate.cpp +++ b/src/UserInterface/ViewItem/itemdelegate.cpp @@ -242,7 +242,7 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, painter->restore(); if ((option.state & QStyle::State_MouseOver) || (option.state & QStyle::State_HasFocus)) { - QToolTip::showText(QCursor::pos(), "为了刷新"); + QToolTip::hideText(); int len = fm.boundingRect(appname).width(); //富文本,tooltip可自动换行 QString tipString = QString(""); @@ -252,7 +252,7 @@ void ItemDelegate::paint(QPainter *painter, const QStyleOptionViewItem &option, tipString += tr("path:") + url; } tipString += QString(""); - QToolTip::showText(option.widget->mapToGlobal(QPoint(rect.right() + 20, rect.center().y())), tipString); + QToolTip::showText(option.widget->mapToGlobal(QPoint(rect.right(), rect.center().y())), tipString); } } else { QRect iconRect = QRect(rect.left() + 11, rect.y() + (rect.height() - 32) / 2, 32, 32); diff --git a/src/UserInterface/Widget/full_commonuse_widget.cpp b/src/UserInterface/Widget/full_commonuse_widget.cpp index adbce44..61c8da2 100755 --- a/src/UserInterface/Widget/full_commonuse_widget.cpp +++ b/src/UserInterface/Widget/full_commonuse_widget.cpp @@ -133,6 +133,7 @@ void FullCommonUseWidget::initVerticalScrollBar() void FullCommonUseWidget::on_powerOffButton_clicked() { QProcess::startDetached(QString("ukui-session-tools")); + Q_EMIT sendHideMainWindowSignal(); } void FullCommonUseWidget::on_powerOffButton_customContextMenuRequested(const QPoint &pos) diff --git a/src/UserInterface/Widget/full_function_widget.cpp b/src/UserInterface/Widget/full_function_widget.cpp index 6e95e13..d1a9f69 100755 --- a/src/UserInterface/Widget/full_function_widget.cpp +++ b/src/UserInterface/Widget/full_function_widget.cpp @@ -153,6 +153,7 @@ void FullFunctionWidget::initVerticalScrollBar() void FullFunctionWidget::on_powerOffButton_clicked() { QProcess::startDetached(QString("ukui-session-tools")); + Q_EMIT sendHideMainWindowSignal(); } void FullFunctionWidget::on_powerOffButton_customContextMenuRequested(const QPoint &pos) diff --git a/src/UserInterface/Widget/full_letter_widget.cpp b/src/UserInterface/Widget/full_letter_widget.cpp index 6bf48bb..7ffc770 100755 --- a/src/UserInterface/Widget/full_letter_widget.cpp +++ b/src/UserInterface/Widget/full_letter_widget.cpp @@ -148,6 +148,7 @@ void FullLetterWidget::initVerticalScrollBar() void FullLetterWidget::on_powerOffButton_clicked() { QProcess::startDetached(QString("ukui-session-tools")); + Q_EMIT sendHideMainWindowSignal(); } void FullLetterWidget::on_powerOffButton_customContextMenuRequested(const QPoint &pos) diff --git a/src/UserInterface/Widget/full_searchresult_widget.cpp b/src/UserInterface/Widget/full_searchresult_widget.cpp index 344add3..5b54614 100755 --- a/src/UserInterface/Widget/full_searchresult_widget.cpp +++ b/src/UserInterface/Widget/full_searchresult_widget.cpp @@ -122,6 +122,7 @@ void FullSearchResultWidget::initVerticalScrollBar() void FullSearchResultWidget::on_powerOffButton_clicked() { QProcess::startDetached(QString("ukui-session-tools")); + Q_EMIT sendHideMainWindowSignal(); } void FullSearchResultWidget::on_powerOffButton_customContextMenuRequested(const QPoint &pos) diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp index 42a5e78..feb225a 100755 --- a/src/UserInterface/mainwindow.cpp +++ b/src/UserInterface/mainwindow.cpp @@ -1426,6 +1426,7 @@ void MainWindow::showNormalWindowSlot() void MainWindow::on_powerOffButton_clicked() { QProcess::startDetached(QString("ukui-session-tools")); + hideWindow(); } void MainWindow::on_powerOffButton_customContextMenuRequested(const QPoint &pos) { From 42a09e95fd93f344a1c96ecbf24f4234a5549be5 Mon Sep 17 00:00:00 2001 From: lixueman Date: Mon, 21 Nov 2022 09:01:12 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E5=BC=80=E5=A7=8B=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E5=88=97=E8=A1=A8=E5=A2=9E=E5=8A=A0=E6=8B=96?= =?UTF-8?q?=E6=8B=BD=E5=88=B0=E4=BB=BB=E5=8A=A1=E6=A0=8F=E5=8A=9F=E8=83=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UserInterface/ListView/listview.cpp | 32 +++++++++++++++++++++++++ src/UserInterface/ListView/listview.h | 3 +++ 2 files changed, 35 insertions(+) diff --git a/src/UserInterface/ListView/listview.cpp b/src/UserInterface/ListView/listview.cpp index 89be87b..3ec9cd7 100755 --- a/src/UserInterface/ListView/listview.cpp +++ b/src/UserInterface/ListView/listview.cpp @@ -18,9 +18,11 @@ #include "listview.h" #include "function_button_widget.h" #include "utility.h" +#include "thumbnail.h" #include #include #include +#include ListView::ListView(QWidget *parent/*, int width, int height, int module*/): KListView(parent) @@ -29,6 +31,7 @@ ListView::ListView(QWidget *parent/*, int width, int height, int module*/): this->h = 540; this->module = 1; initWidget(); + setDragEnabled(true); setAttribute(Qt::WA_AcceptTouchEvents); m_listmodel = new QStandardItemModel(this); this->setModel(m_listmodel); @@ -47,6 +50,7 @@ ListView::~ListView() void ListView::initWidget() { setAttribute(Qt::WA_TranslucentBackground); + this->setAcceptDrops(true); viewport()->setAttribute(Qt::WA_TranslucentBackground); viewport()->setAutoFillBackground(false); this->setSelectionMode(QAbstractItemView::SingleSelection); @@ -70,6 +74,34 @@ void ListView::initWidget() connect(this, &ListView::clicked, this, &ListView::onClicked); } +void ListView::mouseMoveEvent(QMouseEvent *e) +{ + if (e->buttons() & Qt::LeftButton) { + if ((e->pos() - m_pressPos).manhattanLength() >= QApplication::startDragDistance()) { + myDebug() << "进入拖拽事件"; + QString desktopfp = m_pressApp.value().at(0); + QMimeData *mimeData = new QMimeData; + ThumbNail *dragImage = new ThumbNail; + QDrag *drag = new QDrag(this); + QList desktopUrlList; + desktopUrlList.append(QUrl(desktopfp)); + myDebug() << desktopUrlList; + mimeData->setUrls(desktopUrlList); + //设置拖拽时的缩略图 + dragImage->setupthumbnail(desktopfp); + QPixmap pixmap = dragImage->grab(); + pixmap = pixmap.scaled(QSize(32, 32), Qt::KeepAspectRatio); + myDebug() << mimeData; + drag->setMimeData(mimeData); + drag->setPixmap(pixmap); + drag->setHotSpot(QPoint(pixmap.width(), pixmap.height())); + drag->exec(Qt::MoveAction); + delete dragImage; + dragImage = nullptr; + } + } +} + void ListView::addData(QVector data, int module) { this->module = module; diff --git a/src/UserInterface/ListView/listview.h b/src/UserInterface/ListView/listview.h index f9125e8..6a26210 100755 --- a/src/UserInterface/ListView/listview.h +++ b/src/UserInterface/ListView/listview.h @@ -50,11 +50,14 @@ protected: void paintEvent(QPaintEvent *e) override; void keyPressEvent(QKeyEvent *e); bool event(QEvent *e); + void mouseMoveEvent(QMouseEvent *e); + private: int w = 0; int h = 0; int m_preRowCount; bool m_scrollbarState = true; + QPoint m_pressPos; private Q_SLOTS: From 90157f6306da90820183f1ca6ff73fb087d975ed Mon Sep 17 00:00:00 2001 From: lixueman Date: Mon, 21 Nov 2022 17:14:05 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E4=BF=AE=E6=94=B9pressPos=E6=9C=AA?= =?UTF-8?q?=E8=B5=8B=E5=80=BC=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UserInterface/ListView/klistview.cpp | 5 +++-- src/UserInterface/ListView/klistview.h | 1 + src/UserInterface/ListView/listview.cpp | 1 - src/UserInterface/ListView/listview.h | 2 -- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/UserInterface/ListView/klistview.cpp b/src/UserInterface/ListView/klistview.cpp index 91fbe08..28c83c2 100755 --- a/src/UserInterface/ListView/klistview.cpp +++ b/src/UserInterface/ListView/klistview.cpp @@ -92,8 +92,9 @@ void KListView::mouseMoveEvent(QMouseEvent *e) void KListView::mousePressEvent(QMouseEvent *event) { - if ((this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) { - m_pressApp = m_listmodel->data(this->indexAt(event->pos()), Qt::DisplayRole); + m_pressPos = event->pos(); + if ((this->indexAt(m_pressPos).isValid()) && event->button() == Qt::LeftButton) { + m_pressApp = m_listmodel->data(this->indexAt(m_pressPos), Qt::DisplayRole); } return QListView::mousePressEvent(event); } diff --git a/src/UserInterface/ListView/klistview.h b/src/UserInterface/ListView/klistview.h index 503997b..2ac6f3d 100755 --- a/src/UserInterface/ListView/klistview.h +++ b/src/UserInterface/ListView/klistview.h @@ -36,6 +36,7 @@ public: int module = 0; double m_transparency; QVariant m_pressApp; + QPoint m_pressPos; UkuiMenuInterface *m_ukuiMenuInterface = nullptr; protected: void paintEvent(QPaintEvent *e); diff --git a/src/UserInterface/ListView/listview.cpp b/src/UserInterface/ListView/listview.cpp index 3ec9cd7..a9a9ed2 100755 --- a/src/UserInterface/ListView/listview.cpp +++ b/src/UserInterface/ListView/listview.cpp @@ -50,7 +50,6 @@ ListView::~ListView() void ListView::initWidget() { setAttribute(Qt::WA_TranslucentBackground); - this->setAcceptDrops(true); viewport()->setAttribute(Qt::WA_TranslucentBackground); viewport()->setAutoFillBackground(false); this->setSelectionMode(QAbstractItemView::SingleSelection); diff --git a/src/UserInterface/ListView/listview.h b/src/UserInterface/ListView/listview.h index 6a26210..cfcfbf8 100755 --- a/src/UserInterface/ListView/listview.h +++ b/src/UserInterface/ListView/listview.h @@ -57,8 +57,6 @@ private: int h = 0; int m_preRowCount; bool m_scrollbarState = true; - QPoint m_pressPos; - private Q_SLOTS: void onClicked(QModelIndex index);//点击item From e4f9c154aadfbeceb5263850c3ee278b30d5807b Mon Sep 17 00:00:00 2001 From: lixueman Date: Thu, 24 Nov 2022 09:11:44 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E4=BB=BB=E5=8A=A1?= =?UTF-8?q?=E6=A0=8F=E4=BD=8D=E7=BD=AE=E8=B0=83=E6=95=B4=E5=90=8E=E5=85=A8?= =?UTF-8?q?=E5=B1=8F=E5=BC=80=E5=A7=8B=E8=8F=9C=E5=8D=95=E4=BD=8D=E7=BD=AE?= =?UTF-8?q?=E9=94=99=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/UserInterface/mainwindow.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UserInterface/mainwindow.cpp b/src/UserInterface/mainwindow.cpp index feb225a..18f538b 100755 --- a/src/UserInterface/mainwindow.cpp +++ b/src/UserInterface/mainwindow.cpp @@ -770,7 +770,6 @@ void MainWindow::minAnimationFinished() m_viewWidget->setFocus(); // m_collectPushButton->clicked(true); on_collectPushButton_clicked(); - QTimer::singleShot(200, [ = ]() { m_animationPage->hide(); }); @@ -791,6 +790,7 @@ void MainWindow::maxAnimationFinished() setMaxWindowPos(); m_fullWindow->activateWindow(); + QTimer::singleShot(200, [ = ]() { m_animationPage->hide(); }); @@ -1370,7 +1370,7 @@ void MainWindow::setMinWindowPos() void MainWindow::setMaxWindowPos() { if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) { - kdk::WindowManager::setGeometry(m_fullWindow->windowHandle(), QRect(0, 0, Style::m_availableScreenWidth, Style::m_availableScreenHeight)); + kdk::WindowManager::setGeometry(m_fullWindow->windowHandle(), QRect(Style::m_primaryScreenX, Style::m_primaryScreenY, Style::m_availableScreenWidth, Style::m_availableScreenHeight)); } }