diff options
author | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-04-06 13:45:54 +0200 |
---|---|---|
committer | Shawn Rutledge <shawn.rutledge@qt.io> | 2022-04-20 02:36:55 +0200 |
commit | 8a636811fc2478c836988793766006b99b821ea4 (patch) | |
tree | 815a587dc69b5db91306409b5ab88e7653dc906e /src/pdfquick/+Universal | |
parent | 4ca817f60373576b54330161357efce099147bb0 (diff) |
QtPDF: Get styles working again; remove visible hyperlink adornments
Update to versionless imports. The color type comes from the QtQuick
import now. Add the styles to CMakeLists.txt so they get installed.
Use SystemPalette rather than instantiating a Control.
We'd probably better just assume that the PDF has hyperlinks decorated
however the author wanted, rather than risking redundant underlines.
Declare linkUnderscoreStrokeWidth: -1 since the ShapePath.strokeWidth
docs tell us "When set to a negative value, no stroking occurs."
But the user can turn them back on using a custom style.
Update the screenshot: avoid showing off how bad the underscores looked.
PdfPageView doesn't depend on Controls and doesn't import styles:
it simply loses the light-grey rectangles around links. The cursor
change still informs the user when the mouse is hovering a link.
Pick-to: 6.3
Fixes: QTBUG-102303
Change-Id: Ifa4f9982bfaaf0e2e46230e8dbe30a5db7c9f592
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src/pdfquick/+Universal')
-rw-r--r-- | src/pdfquick/+Universal/PdfStyle.qml | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/src/pdfquick/+Universal/PdfStyle.qml b/src/pdfquick/+Universal/PdfStyle.qml index 3c322359a..c2d044f1d 100644 --- a/src/pdfquick/+Universal/PdfStyle.qml +++ b/src/pdfquick/+Universal/PdfStyle.qml @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2020 The Qt Company Ltd. +** Copyright (C) 2022 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtPDF module of the Qt Toolkit. @@ -36,23 +36,21 @@ ** $QT_END_LICENSE$ ** ****************************************************************************/ -import QtQml 2.14 -import QtQuick 2.14 -import QtQuick.Controls 2.14 -import QtQuick.Controls.Universal 2.14 -import QtQuick.Shapes 1.14 +import QtQuick +import QtQuick.Controls.Universal +import QtQuick.Shapes QtObject { - property Control prototypeControl: Control { } + property SystemPalette palette: SystemPalette { } function withAlpha(color, alpha) { return Qt.hsla(color.hslHue, color.hslSaturation, color.hslLightness, alpha) } - property color selectionColor: withAlpha(prototypeControl.palette.highlight, 0.5) + property color selectionColor: withAlpha(palette.highlight, 0.5) property color pageSearchResultsColor: withAlpha(Qt.lighter(Universal.accent, 1.5), 0.5) property color currentSearchResultStrokeColor: Universal.accent property real currentSearchResultStrokeWidth: 2 - property color linkUnderscoreColor: prototypeControl.palette.link - property real linkUnderscoreStrokeWidth: 1 - property var linkUnderscoreStrokeStyle: ShapePath.DashLine + property color linkUnderscoreColor: palette.link + property real linkUnderscoreStrokeWidth: -1 // no underlines under hyperlinks + property int linkUnderscoreStrokeStyle: ShapePath.DashLine property var linkUnderscoreDashPattern: [ 1, 4 ] } |