Minor improvements.

Signed-off-by: Yuhang Zhao <2546789017@qq.com>
This commit is contained in:
Yuhang Zhao 2020-05-23 21:52:40 +08:00
parent a4b50d3136
commit 8ec1cfcf35
2 changed files with 13 additions and 9 deletions

View File

@ -522,9 +522,17 @@ bool FramelessHelper::eventFilter(QObject *object, QEvent *event) {
&isResizePermitted](const QPointF &globalPoint, const QPointF &point,
QObject *const window) -> bool {
if (window) {
return ((point.y() <= m_titleBarHeight) &&
isInDraggableAreas(point, window) &&
isInDraggableObjects(globalPoint, window) &&
const bool customDragAreas = !getDraggableAreas(window).isEmpty();
#if defined(QT_WIDGETS_LIB) || defined(QT_QUICK_LIB)
const bool customDragObjects =
!getDraggableObjects(window).isEmpty();
#else
const bool customDragObjects = false;
#endif
const bool customDrag = customDragAreas || customDragObjects;
return ((customDrag ? (isInDraggableAreas(point, window) &&
isInDraggableObjects(globalPoint, window))
: (point.y() <= m_titleBarHeight)) &&
isResizePermitted(globalPoint, point, window) &&
getTitleBarEnabled(window));
}

View File

@ -688,18 +688,14 @@ qreal GetPreferedNumber(const qreal num) {
} else {
if (in < (m_defaultDotsPerInch * 1.5)) {
return m_defaultDotsPerInch;
} else if (in == (m_defaultDotsPerInch * 1.5)) {
return m_defaultDotsPerInch * 1.5;
} else if (in < (m_defaultDotsPerInch * 2.5)) {
return m_defaultDotsPerInch * 2;
} else if (in == (m_defaultDotsPerInch * 2.5)) {
return m_defaultDotsPerInch * 2.5;
} else if (in < (m_defaultDotsPerInch * 3.5)) {
return m_defaultDotsPerInch * 3;
} else if (in == (m_defaultDotsPerInch * 3.5)) {
return m_defaultDotsPerInch * 3.5;
} else if (in < (m_defaultDotsPerInch * 4.5)) {
return m_defaultDotsPerInch * 4;
} else if (in < (m_defaultDotsPerInch * 5.5)) {
return m_defaultDotsPerInch * 5;
} else {
qWarning().noquote()
<< "DPI too large:" << static_cast<int>(in);