Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions deepin-devicemanager/src/MacroDefinition.h
Original file line number Diff line number Diff line change
Expand Up @@ -215,6 +215,11 @@
#define WIDGET_MARGIN 2 // 页边距
#define BOTTOM_MARGIN 11 // 下边距
#define LABEL_MARGIN 12 // 页面标签的上下边距

// 触摸屏滚动参数
#define SCROLLER_OVERSHOOT_DISTANCE_FACTOR 0.3 // 超出滚动距离系数
#define SCROLLER_OVERSHOOT_DRAG_RESIST_FACTOR 0.3 // 超出拖拽阻力系数
#define SCROLLER_DRAG_VELOCITY_SMOOTH_FACTOR 0.6 // 拖拽速度平滑系数
#define HORSCROLL_WIDTH 11 // TreeWidget 横向滚动条高度
#define MIN_NUM 5 // num

Expand Down
11 changes: 11 additions & 0 deletions deepin-devicemanager/src/Page/PageDetail.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,11 @@
#include <QPalette>
#include <QLoggingCategory>
#include <QScrollBar>
#include <QAction>

Check warning on line 25 in deepin-devicemanager/src/Page/PageDetail.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QAction> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 25 in deepin-devicemanager/src/Page/PageDetail.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QAction> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QClipboard>

Check warning on line 26 in deepin-devicemanager/src/Page/PageDetail.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QClipboard> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 26 in deepin-devicemanager/src/Page/PageDetail.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QClipboard> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QPainterPath>

Check warning on line 27 in deepin-devicemanager/src/Page/PageDetail.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QPainterPath> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 27 in deepin-devicemanager/src/Page/PageDetail.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QPainterPath> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QScroller>

Check warning on line 28 in deepin-devicemanager/src/Page/PageDetail.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QScroller> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 28 in deepin-devicemanager/src/Page/PageDetail.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QScroller> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QScrollerProperties>

Check warning on line 29 in deepin-devicemanager/src/Page/PageDetail.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QScrollerProperties> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 29 in deepin-devicemanager/src/Page/PageDetail.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QScrollerProperties> not found. Please note: Cppcheck does not need standard library headers to get proper results.

// 宏定义
#define SPACE_HEIGHT 0 //
Expand Down Expand Up @@ -180,6 +182,15 @@
// 设置ScrollArea里面的widget,这个widget是必须要的
mp_ScrollWidget->setContentsMargins(15, 0, 0, 0);
mp_ScrollArea->setWidget(mp_ScrollWidget);

// 启用触摸屏滚动支持
QScroller::grabGesture(mp_ScrollArea, QScroller::LeftMouseButtonGesture);
QScrollerProperties sp;
sp.setScrollMetric(QScrollerProperties::OvershootScrollDistanceFactor, SCROLLER_OVERSHOOT_DISTANCE_FACTOR);
sp.setScrollMetric(QScrollerProperties::OvershootDragResistanceFactor, SCROLLER_OVERSHOOT_DRAG_RESIST_FACTOR);
sp.setScrollMetric(QScrollerProperties::DragVelocitySmoothingFactor, SCROLLER_DRAG_VELOCITY_SMOOTH_FACTOR);
QScroller::scroller(mp_ScrollArea)->setScrollerProperties(sp);

hLayout->addWidget(mp_ScrollArea);
setLayout(hLayout);

Expand Down
13 changes: 12 additions & 1 deletion deepin-devicemanager/src/Page/PageDriverInstallInfo.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
// SPDX-FileCopyrightText: 2023 UnionTech Software Technology Co., Ltd.
// SPDX-FileCopyrightText: 2023 - 2026 UnionTech Software Technology Co., Ltd.
//
// SPDX-License-Identifier: GPL-3.0-or-later

#include <QBoxLayout>

Check warning on line 5 in deepin-devicemanager/src/Page/PageDriverInstallInfo.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QBoxLayout> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 5 in deepin-devicemanager/src/Page/PageDriverInstallInfo.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QBoxLayout> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include <QScroller>

Check warning on line 7 in deepin-devicemanager/src/Page/PageDriverInstallInfo.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QScroller> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 7 in deepin-devicemanager/src/Page/PageDriverInstallInfo.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QScroller> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <QScrollerProperties>

Check warning on line 8 in deepin-devicemanager/src/Page/PageDriverInstallInfo.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <QScrollerProperties> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 8 in deepin-devicemanager/src/Page/PageDriverInstallInfo.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <QScrollerProperties> not found. Please note: Cppcheck does not need standard library headers to get proper results.
#include <DScrollArea>

Check warning on line 9 in deepin-devicemanager/src/Page/PageDriverInstallInfo.cpp

View workflow job for this annotation

GitHub Actions / cppcheck

Include file: <DScrollArea> not found. Please note: Cppcheck does not need standard library headers to get proper results.

Check warning on line 9 in deepin-devicemanager/src/Page/PageDriverInstallInfo.cpp

View workflow job for this annotation

GitHub Actions / static-check / static-check

Include file: <DScrollArea> not found. Please note: Cppcheck does not need standard library headers to get proper results.

#include "PageDriverInstallInfo.h"
#include "DetectedStatusWidget.h"
Expand Down Expand Up @@ -58,6 +60,15 @@
area->setMinimumHeight(10);
area->setFrameShape(QFrame::NoFrame);
area->setWidgetResizable(true);

// 启用触摸屏滚动支持
QScroller::grabGesture(area, QScroller::LeftMouseButtonGesture);
QScrollerProperties sp;
sp.setScrollMetric(QScrollerProperties::OvershootScrollDistanceFactor, SCROLLER_OVERSHOOT_DISTANCE_FACTOR);
sp.setScrollMetric(QScrollerProperties::OvershootDragResistanceFactor, SCROLLER_OVERSHOOT_DRAG_RESIST_FACTOR);
sp.setScrollMetric(QScrollerProperties::DragVelocitySmoothingFactor, SCROLLER_DRAG_VELOCITY_SMOOTH_FACTOR);
QScroller::scroller(area)->setScrollerProperties(sp);

DWidget *frame = new DWidget(this);
frame->setContentsMargins(0, 0, 0, 0);
QVBoxLayout *frameLayout = new QVBoxLayout();
Expand Down
Loading