!32 修复全屏位置问题,增加拖拽固定到任务栏功能
Merge pull request !32 from lixueman/openkylin/yangtze
This commit is contained in:
commit
beb6f0dd85
|
@ -1,3 +1,10 @@
|
||||||
|
ukui-menu (3.1.1-ok4~1124) v101; urgency=medium
|
||||||
|
|
||||||
|
* close-cd #I5RF2N 开始菜单展开后没有置顶,也没有全屏
|
||||||
|
* 增加了列表应用拖拽固定到任务栏功能(需要任务栏同步更新)
|
||||||
|
|
||||||
|
-- lixueman <lixueman@kylinos.cn> Thu, 24 Nov 2022 09:29:48 +0800
|
||||||
|
|
||||||
ukui-menu (3.1.1-ok4~1104) yangtze; urgency=medium
|
ukui-menu (3.1.1-ok4~1104) yangtze; urgency=medium
|
||||||
|
|
||||||
*close-cd I5XN4B 【开始菜单】重启后点击开始菜单电源按钮,会话管理器界面自动弹出开始菜单,关闭开始菜单后不再自动弹出
|
*close-cd I5XN4B 【开始菜单】重启后点击开始菜单电源按钮,会话管理器界面自动弹出开始菜单,关闭开始菜单后不再自动弹出
|
||||||
|
|
|
@ -92,8 +92,9 @@ void KListView::mouseMoveEvent(QMouseEvent *e)
|
||||||
|
|
||||||
void KListView::mousePressEvent(QMouseEvent *event)
|
void KListView::mousePressEvent(QMouseEvent *event)
|
||||||
{
|
{
|
||||||
if ((this->indexAt(event->pos()).isValid()) && event->button() == Qt::LeftButton) {
|
m_pressPos = event->pos();
|
||||||
m_pressApp = m_listmodel->data(this->indexAt(event->pos()), Qt::DisplayRole);
|
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);
|
return QListView::mousePressEvent(event);
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,6 +36,7 @@ public:
|
||||||
int module = 0;
|
int module = 0;
|
||||||
double m_transparency;
|
double m_transparency;
|
||||||
QVariant m_pressApp;
|
QVariant m_pressApp;
|
||||||
|
QPoint m_pressPos;
|
||||||
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
|
UkuiMenuInterface *m_ukuiMenuInterface = nullptr;
|
||||||
protected:
|
protected:
|
||||||
void paintEvent(QPaintEvent *e);
|
void paintEvent(QPaintEvent *e);
|
||||||
|
|
|
@ -18,9 +18,11 @@
|
||||||
#include "listview.h"
|
#include "listview.h"
|
||||||
#include "function_button_widget.h"
|
#include "function_button_widget.h"
|
||||||
#include "utility.h"
|
#include "utility.h"
|
||||||
|
#include "thumbnail.h"
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QtConcurrent/QtConcurrent>
|
#include <QtConcurrent/QtConcurrent>
|
||||||
|
#include <QDrag>
|
||||||
|
|
||||||
ListView::ListView(QWidget *parent/*, int width, int height, int module*/):
|
ListView::ListView(QWidget *parent/*, int width, int height, int module*/):
|
||||||
KListView(parent)
|
KListView(parent)
|
||||||
|
@ -29,6 +31,7 @@ ListView::ListView(QWidget *parent/*, int width, int height, int module*/):
|
||||||
this->h = 540;
|
this->h = 540;
|
||||||
this->module = 1;
|
this->module = 1;
|
||||||
initWidget();
|
initWidget();
|
||||||
|
setDragEnabled(true);
|
||||||
setAttribute(Qt::WA_AcceptTouchEvents);
|
setAttribute(Qt::WA_AcceptTouchEvents);
|
||||||
m_listmodel = new QStandardItemModel(this);
|
m_listmodel = new QStandardItemModel(this);
|
||||||
this->setModel(m_listmodel);
|
this->setModel(m_listmodel);
|
||||||
|
@ -70,6 +73,34 @@ void ListView::initWidget()
|
||||||
connect(this, &ListView::clicked, this, &ListView::onClicked);
|
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<QStringList>().at(0);
|
||||||
|
QMimeData *mimeData = new QMimeData;
|
||||||
|
ThumbNail *dragImage = new ThumbNail;
|
||||||
|
QDrag *drag = new QDrag(this);
|
||||||
|
QList<QUrl> 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<QStringList> data, int module)
|
void ListView::addData(QVector<QStringList> data, int module)
|
||||||
{
|
{
|
||||||
this->module = module;
|
this->module = module;
|
||||||
|
|
|
@ -50,13 +50,14 @@ protected:
|
||||||
void paintEvent(QPaintEvent *e) override;
|
void paintEvent(QPaintEvent *e) override;
|
||||||
void keyPressEvent(QKeyEvent *e);
|
void keyPressEvent(QKeyEvent *e);
|
||||||
bool event(QEvent *e);
|
bool event(QEvent *e);
|
||||||
|
void mouseMoveEvent(QMouseEvent *e);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
int w = 0;
|
int w = 0;
|
||||||
int h = 0;
|
int h = 0;
|
||||||
int m_preRowCount;
|
int m_preRowCount;
|
||||||
bool m_scrollbarState = true;
|
bool m_scrollbarState = true;
|
||||||
|
|
||||||
|
|
||||||
private Q_SLOTS:
|
private Q_SLOTS:
|
||||||
void onClicked(QModelIndex index);//点击item
|
void onClicked(QModelIndex index);//点击item
|
||||||
// void rightClickedSlot(const QPoint &pos);//右键菜单
|
// void rightClickedSlot(const QPoint &pos);//右键菜单
|
||||||
|
|
|
@ -770,7 +770,6 @@ void MainWindow::minAnimationFinished()
|
||||||
m_viewWidget->setFocus();
|
m_viewWidget->setFocus();
|
||||||
// m_collectPushButton->clicked(true);
|
// m_collectPushButton->clicked(true);
|
||||||
on_collectPushButton_clicked();
|
on_collectPushButton_clicked();
|
||||||
|
|
||||||
QTimer::singleShot(200, [ = ]() {
|
QTimer::singleShot(200, [ = ]() {
|
||||||
m_animationPage->hide();
|
m_animationPage->hide();
|
||||||
});
|
});
|
||||||
|
@ -791,6 +790,7 @@ void MainWindow::maxAnimationFinished()
|
||||||
setMaxWindowPos();
|
setMaxWindowPos();
|
||||||
m_fullWindow->activateWindow();
|
m_fullWindow->activateWindow();
|
||||||
|
|
||||||
|
|
||||||
QTimer::singleShot(200, [ = ]() {
|
QTimer::singleShot(200, [ = ]() {
|
||||||
m_animationPage->hide();
|
m_animationPage->hide();
|
||||||
});
|
});
|
||||||
|
@ -1370,7 +1370,7 @@ void MainWindow::setMinWindowPos()
|
||||||
void MainWindow::setMaxWindowPos()
|
void MainWindow::setMaxWindowPos()
|
||||||
{
|
{
|
||||||
if (g_platform.startsWith(QLatin1String("wayland"), Qt::CaseInsensitive)) {
|
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));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue