Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
PIM
PIM Messagelib
Commits
7e36e64c
Commit
7e36e64c
authored
Mar 27, 2016
by
Laurent Montel
😁
Browse files
Start to implement scroll percentage
parent
b51a413f
Changes
4
Hide whitespace changes
Inline
Side-by-side
messageviewer/src/viewer/webengine/mailwebengineview.cpp
View file @
7e36e64c
...
...
@@ -200,3 +200,25 @@ void MailWebEngineView::handleScrollToAnchor(const QVariant &result)
}
}
}
void
MailWebEngineView
::
scrollPageDown
(
int
percent
)
{
#if 0
const qint64 height = page()->viewportSize().height();
const qint64 current = page()->mainFrame()->scrollBarValue(Qt::Vertical);
// do arithmetic in higher precision, and check for overflow:
const qint64 newPosition = current + height * percent / 100;
if (newPosition > std::numeric_limits<int>::max()) {
qCWarning(MESSAGEVIEWER_LOG) << "new position" << newPosition << "exceeds range of 'int'!";
}
page()->mainFrame()->setScrollBarValue(Qt::Vertical, newPosition);
#endif
}
void
MailWebEngineView
::
scrollPageUp
(
int
percent
)
{
#if 0
scrollPageDown(-percent);
#endif
}
messageviewer/src/viewer/webengine/mailwebengineview.h
View file @
7e36e64c
...
...
@@ -44,6 +44,8 @@ public:
bool
removeAttachmentMarking
(
const
QString
&
id
);
void
markAttachment
(
const
QString
&
id
,
const
QString
&
style
);
void
scrollToAnchor
(
const
QString
&
anchor
);
void
scrollPageDown
(
int
percent
);
void
scrollPageUp
(
int
percent
);
public
Q_SLOTS
:
void
slotZoomChanged
(
qreal
zoom
);
...
...
messageviewer/src/webengine/webenginescript.cpp
View file @
7e36e64c
...
...
@@ -124,6 +124,12 @@ QString WebEngineScript::searchElementPosition(const QString &elementStr)
return
source
;
}
QString
WebEngineScript
::
scrollPercentage
(
int
percent
)
{
//TODO
return
QString
();
}
QString
WebEngineScript
::
scrollUp
(
int
pixel
)
{
const
QString
source
=
QString
::
fromLatin1
(
"window.scrollBy(0, %1);"
).
arg
(
-
pixel
);
...
...
messageviewer/src/webengine/webenginescript.h
View file @
7e36e64c
...
...
@@ -35,6 +35,7 @@ MESSAGEVIEWER_EXPORT QString setElementByIdVisible(const QString &elementStr, bo
MESSAGEVIEWER_EXPORT
QString
setStyleToElement
(
const
QString
&
elementStr
,
const
QString
&
style
);
MESSAGEVIEWER_EXPORT
QString
scrollDown
(
int
pixel
);
MESSAGEVIEWER_EXPORT
QString
scrollUp
(
int
pixel
);
MESSAGEVIEWER_EXPORT
QString
scrollPercentage
(
int
percent
);
}
}
#endif // WEBENGINESCRIPT_H
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment