Commit 608243e0 authored by Laurent Montel's avatar Laurent Montel 😁

Fix relative position with qt5.7

parent d142e171
...@@ -652,7 +652,7 @@ public: ...@@ -652,7 +652,7 @@ public:
in printMsg() and slotPrintMsg() since mHtmlWriter points only to abstract non-QObject class. */ in printMsg() and slotPrintMsg() since mHtmlWriter points only to abstract non-QObject class. */
QPointer<WebEnginePartHtmlWriter> mPartHtmlWriter; QPointer<WebEnginePartHtmlWriter> mPartHtmlWriter;
float mSavedRelativePosition; qreal mSavedRelativePosition;
int mLevelQuote; int mLevelQuote;
bool mDecrytMessageOverwrite; bool mDecrytMessageOverwrite;
bool mShowSignatureDetails; bool mShowSignatureDetails;
......
...@@ -302,14 +302,16 @@ bool MailWebEngineView::isAttachmentInjectionPoint(const QPoint &globalPos) cons ...@@ -302,14 +302,16 @@ bool MailWebEngineView::isAttachmentInjectionPoint(const QPoint &globalPos) cons
return false; return false;
} }
void MailWebEngineView::scrollToRelativePosition(double pos) void MailWebEngineView::scrollToRelativePosition(qreal pos)
{ {
page()->runJavaScript(WebEngineViewer::WebEngineScript::scrollToRelativePosition(pos)); page()->runJavaScript(WebEngineViewer::WebEngineScript::scrollToRelativePosition(pos));
} }
double MailWebEngineView::relativePosition() const qreal MailWebEngineView::relativePosition() const
{ {
#if QT_VERSION >= 0x050700
return page()->scrollPosition().toPoint().y();
#endif
qDebug() << "double MailWebEngineView::relativePosition() const not implemented"; qDebug() << "double MailWebEngineView::relativePosition() const not implemented";
//TODO //TODO
return {}; return {};
......
...@@ -55,8 +55,8 @@ public: ...@@ -55,8 +55,8 @@ public:
bool hasVerticalScrollBar() const; bool hasVerticalScrollBar() const;
bool isAttachmentInjectionPoint(const QPoint &globalPos) const; bool isAttachmentInjectionPoint(const QPoint &globalPos) const;
void scrollToRelativePosition(double pos); void scrollToRelativePosition(qreal pos);
double relativePosition() const; qreal relativePosition() const;
QUrl linkOrImageUrlAt(const QPoint &global) const; QUrl linkOrImageUrlAt(const QPoint &global) const;
void setAllowExternalContent(bool b); void setAllowExternalContent(bool b);
......
...@@ -174,7 +174,7 @@ QString WebEngineScript::setStyleToElement(const QString &elementStr, const QStr ...@@ -174,7 +174,7 @@ QString WebEngineScript::setStyleToElement(const QString &elementStr, const QStr
return source; return source;
} }
QString WebEngineScript::scrollToRelativePosition(int pos) QString WebEngineScript::scrollToRelativePosition(qreal pos)
{ {
//TODO verify it //TODO verify it
const QString source = QString::fromLatin1("window.scrollTo(window.scrollX, %1); [window.scrollX, window.scrollY];").arg(pos); const QString source = QString::fromLatin1("window.scrollTo(window.scrollX, %1); [window.scrollX, window.scrollY];").arg(pos);
......
...@@ -36,7 +36,7 @@ WEBENGINEVIEWER_EXPORT QString setStyleToElement(const QString &elementStr, cons ...@@ -36,7 +36,7 @@ WEBENGINEVIEWER_EXPORT QString setStyleToElement(const QString &elementStr, cons
WEBENGINEVIEWER_EXPORT QString scrollDown(int pixel); WEBENGINEVIEWER_EXPORT QString scrollDown(int pixel);
WEBENGINEVIEWER_EXPORT QString scrollUp(int pixel); WEBENGINEVIEWER_EXPORT QString scrollUp(int pixel);
WEBENGINEVIEWER_EXPORT QString scrollPercentage(int percent); WEBENGINEVIEWER_EXPORT QString scrollPercentage(int percent);
WEBENGINEVIEWER_EXPORT QString scrollToRelativePosition(int pos); WEBENGINEVIEWER_EXPORT QString scrollToRelativePosition(qreal pos);
WEBENGINEVIEWER_EXPORT QString removeStyleToElement(const QString &element); WEBENGINEVIEWER_EXPORT QString removeStyleToElement(const QString &element);
WEBENGINEVIEWER_EXPORT QString clearSelection(); WEBENGINEVIEWER_EXPORT QString clearSelection();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment