diff --git a/examples/webengine/customdialogs/WebView.qml b/examples/webengine/customdialogs/WebView.qml index 0d3fdfacc8d1ace0caf51ca33a61c5678c9ce783..0715bc70978054ea0ea090442e06b92b9282e90b 100644 --- a/examples/webengine/customdialogs/WebView.qml +++ b/examples/webengine/customdialogs/WebView.qml @@ -108,28 +108,4 @@ WebEngineView { properties: {"request": request}}); } - - onFormValidationMessageRequested: function(request) { - switch (request.type) { - case FormValidationMessageRequest.Show: - if (useDefaultDialogs) - return; - - request.accepted = true; - validationMessage.text = request.text; - validationMessage.y = request.anchor.y + request.anchor.height + 10; - validationMessage.visible = true; - break; - case FormValidationMessageRequest.Move: - break; - case FormValidationMessageRequest.Hide: - validationMessage.visible = false; - break; - } - } - - MessageRectangle { - id: validationMessage - z: 1 - } } diff --git a/examples/webengine/customdialogs/doc/images/customdialogs-validation1.png b/examples/webengine/customdialogs/doc/images/customdialogs-validation1.png deleted file mode 100644 index 38fa86235553b6ea9f88e54403efe1580f734fc7..0000000000000000000000000000000000000000 Binary files a/examples/webengine/customdialogs/doc/images/customdialogs-validation1.png and /dev/null differ diff --git a/examples/webengine/customdialogs/doc/images/customdialogs-validation2.png b/examples/webengine/customdialogs/doc/images/customdialogs-validation2.png deleted file mode 100644 index 247d2711b319ab3fa8177edf107f60a45e870a03..0000000000000000000000000000000000000000 Binary files a/examples/webengine/customdialogs/doc/images/customdialogs-validation2.png and /dev/null differ diff --git a/examples/webengine/customdialogs/doc/src/customdialogs.qdoc b/examples/webengine/customdialogs/doc/src/customdialogs.qdoc index df955ee614b0355a6171df3327a429a32e630748..ecbe36c787b2c842f9e02f452c2722665268ee55 100644 --- a/examples/webengine/customdialogs/doc/src/customdialogs.qdoc +++ b/examples/webengine/customdialogs/doc/src/customdialogs.qdoc @@ -53,7 +53,6 @@ \li JavaScript Alert, Confirm, and Prompt Dialogs \li Color Picker Dialog \li File Picker Dialog - \li Form Validation Message \endlist \section1 Triggering Dialogs @@ -103,7 +102,6 @@ \li JavaScriptDialogRequest \li ColorDialogRequest \li FileDialogRequest - \li FormValidationMessageRequest \endlist \section2 Context Menu Requests @@ -122,9 +120,8 @@ \printuntil } \printuntil } \dots 4 - \skipuntil onFormValidationMessageRequested - \skipuntil } - \skipuntil } + \skipuntil onFileDialogRequested + \skipuntil }}); \skipuntil } \skipto } \printline } @@ -158,9 +155,8 @@ \printuntil } \printuntil } \dots 4 - \skipuntil onFormValidationMessageRequested - \skipuntil } - \skipuntil } + \skipuntil onFileDialogRequested + \skipuntil }}); \skipuntil } \skipto } \printline } @@ -200,9 +196,8 @@ \printuntil } \printuntil } \dots 4 - \skipuntil onFormValidationMessageRequested - \skipuntil } - \skipuntil } + \skipuntil onFileDialogRequested + \skipuntil }}); \skipuntil } \skipto } \printline } @@ -240,9 +235,8 @@ \printuntil } \printuntil } \dots 4 - \skipuntil onFormValidationMessageRequested - \skipuntil } - \skipuntil } + \skipuntil onFileDialogRequested + \skipuntil }}); \skipuntil } \skipto } \printline } @@ -281,13 +275,7 @@ \skipto onFileDialogRequested \printuntil } \printuntil } - \dots 4 - \skipuntil onFormValidationMessageRequested - \skipuntil } - \skipuntil } - \skipuntil } - \skipto } - \printline } + \printuntil } We use the \c onFileDialogRequested signal handler to check whether we should use the default color picker dialog. If not, we accept the request @@ -311,28 +299,4 @@ file and clicks \c OK, we pass the selected file to the \c dialogAccept method. - \section2 Form Validation Message Requests - - \image customdialogs-validation1.png - - \l [QML]{FormValidationMessageRequest} is a request object that is passed as a - parameter of the WebEngineView::formValidationMessageRequested signal: - - \quotefromfile webengine/customdialogs/WebView.qml - \skipto WebEngineView - \printuntil url - \dots 4 - \skipto onFormValidationMessageRequested - \printuntil } - \printuntil } - \printuntil } - \skipto } - \printline } - - We use the \c onFormValidationMessageRequested signal handler to check - whether we should use the default message bubble. If not, we accept the - request and customize \c validationMessage. Depending on the type of the - request, we show, move, or hide the message. - - \image customdialogs-validation2.png */ diff --git a/examples/webengine/customdialogs/index.html b/examples/webengine/customdialogs/index.html index 43a2dbb675bbbf95b5296db1c4adb7bbac2ebbd7..490dd79fd6b35a87519fecec581af3174740dcd5 100644 --- a/examples/webengine/customdialogs/index.html +++ b/examples/webengine/customdialogs/index.html @@ -38,14 +38,6 @@ <td><button class="button" onclick="document.getElementById('filepicker').click()"> Open File Dialog</button></td> </tr> - <tr> - <td> - <form><table> - <tr><td><button class="button" type="submit">Open Message Bubble</button></td></tr> - <tr><td><input class="input" placeholder="For this field we open message bubble..." required/></td></tr> - </table></form> - </td> - </tr> </table> <input type="color" id="colorpicker" value="#ff0000" style="visibility:hidden"/> <input type="file" id="filepicker" accept=".cpp, .html, .h, .png, .qdoc, .qml" style="visibility:hidden"/> diff --git a/src/core/web_contents_adapter_client.h b/src/core/web_contents_adapter_client.h index 495be3d843a3d6705b668119baea27befb2a03a7..899678e560a442ffb016cd2d4a940c46ec7cfcc8 100644 --- a/src/core/web_contents_adapter_client.h +++ b/src/core/web_contents_adapter_client.h @@ -440,9 +440,6 @@ public: virtual void runQuotaPermissionRequest(QSharedPointer<QuotaPermissionController>) = 0; virtual void runRegisterProtocolHandlerPermissionRequest(QSharedPointer<RegisterProtocolHandlerPermissionController>) = 0; virtual WebEngineSettings *webEngineSettings() const = 0; - virtual void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) = 0; - virtual void hideValidationMessage() = 0; - virtual void moveValidationMessage(const QRect &anchor) = 0; RenderProcessTerminationStatus renderProcessExitStatus(int); virtual void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) = 0; virtual void requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) = 0; diff --git a/src/core/web_contents_delegate_qt.cpp b/src/core/web_contents_delegate_qt.cpp index ed406977f4177b12ab3cd1ac2547014cf0ca229b..a88f7665e67f0c84e1c8b677ec47b9cfcd7cc736 100644 --- a/src/core/web_contents_delegate_qt.cpp +++ b/src/core/web_contents_delegate_qt.cpp @@ -85,16 +85,6 @@ namespace QtWebEngineCore { -static gfx::Rect rootViewToScreenRect(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) -{ - RenderWidgetHostViewQt *rwhv = static_cast<RenderWidgetHostViewQt *>(web_contents->GetRenderWidgetHostView()); - if (!rwhv) - return gfx::Rect(); - content::ScreenInfo screenInfo; - rwhv->GetScreenInfo(&screenInfo); - return gfx::ScaleToEnclosingRect(anchor_in_root_view, 1 / screenInfo.device_scale_factor); -} - // Maps the LogSeverity defines in base/logging.h to the web engines message levels. static WebContentsAdapterClient::JavaScriptConsoleMessageLevel mapToJavascriptConsoleMessageLevel(int32_t messageLevel) { if (messageLevel < 1) @@ -602,28 +592,6 @@ void WebContentsDelegateQt::launchExternalURL(const QUrl &url, ui::PageTransitio } } -void WebContentsDelegateQt::ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text) -{ - gfx::Rect anchor = rootViewToScreenRect(web_contents, anchor_in_root_view); - if (anchor.IsEmpty()) - return; - m_viewClient->showValidationMessage(toQt(anchor), toQt(main_text), toQt(sub_text)); -} - -void WebContentsDelegateQt::HideValidationMessage(content::WebContents *web_contents) -{ - Q_UNUSED(web_contents); - m_viewClient->hideValidationMessage(); -} - -void WebContentsDelegateQt::MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) -{ - gfx::Rect anchor = rootViewToScreenRect(web_contents, anchor_in_root_view); - if (anchor.IsEmpty()) - return; - m_viewClient->moveValidationMessage(toQt(anchor)); -} - void WebContentsDelegateQt::BeforeUnloadFired(content::WebContents *tab, bool proceed, bool *proceed_to_fire_unload) { Q_UNUSED(tab); diff --git a/src/core/web_contents_delegate_qt.h b/src/core/web_contents_delegate_qt.h index 3dcbf9cd812d23e50f8871eed7befd8be37be112..2ef87ccd8f81eceabb04220ff5f5c1f4e8b25828 100644 --- a/src/core/web_contents_delegate_qt.h +++ b/src/core/web_contents_delegate_qt.h @@ -123,9 +123,6 @@ public: bool IsPopupOrPanel(const content::WebContents *source) const override; void UpdateTargetURL(content::WebContents* source, const GURL& url) override; void RequestToLockMouse(content::WebContents *web_contents, bool user_gesture, bool last_unlocked_by_target) override; - void ShowValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view, const base::string16 &main_text, const base::string16 &sub_text) override; - void HideValidationMessage(content::WebContents *web_contents) override; - void MoveValidationMessage(content::WebContents *web_contents, const gfx::Rect &anchor_in_root_view) override; void BeforeUnloadFired(content::WebContents* tab, bool proceed, bool* proceed_to_fire_unload) override; bool CheckMediaAccessPermission(content::WebContents *web_contents, const GURL& security_origin, content::MediaStreamType type) override; void RegisterProtocolHandler(content::WebContents* web_contents, const std::string& protocol, const GURL& url, bool user_gesture) override; diff --git a/src/core/web_engine_context.cpp b/src/core/web_engine_context.cpp index 57248a27f11899d9ac2ea224b564b2c449cac82f..79584f55de22a8ec27c18b51d518e88ec641723a 100644 --- a/src/core/web_engine_context.cpp +++ b/src/core/web_engine_context.cpp @@ -383,7 +383,6 @@ WebEngineContext::WebEngineContext() // get rid of the warnings. parsedCommandLine->AppendSwitch(switches::kDisableES3GLContext); #endif - // Needed to allow navigations within pages that were set using setHtml(). One example is // tst_QWebEnginePage::acceptNavigationRequest. // This is deprecated behavior, and will be removed in a future Chromium version, as per @@ -394,9 +393,6 @@ WebEngineContext::WebEngineContext() // Scroll latching expects phases on all wheel events when it really only makes sense for simulated ones. appendToFeatureSwitch(parsedCommandLine, switches::kDisableFeatures, features::kTouchpadAndWheelScrollLatching.name); - // If the renderer renders the validation messages, we no longer get the callbacks we have in the API. - parsedCommandLine->AppendSwitchASCII(switches::kDisableBlinkFeatures, "ValidationBubbleInRenderer"); - if (useEmbeddedSwitches) { appendToFeatureSwitch(parsedCommandLine, switches::kEnableFeatures, features::kOverlayScrollbar.name); if (!parsedCommandLine->HasSwitch(switches::kDisablePinch)) diff --git a/src/webengine/api/qquickwebenginedialogrequests.cpp b/src/webengine/api/qquickwebenginedialogrequests.cpp index c57f4c76f43cf23f37697d0263970317e9b2c10b..b1f52a6b1b622f221323b4f01ce28a140a50f90f 100644 --- a/src/webengine/api/qquickwebenginedialogrequests.cpp +++ b/src/webengine/api/qquickwebenginedialogrequests.cpp @@ -716,40 +716,11 @@ void QQuickWebEngineFileDialogRequest::dialogReject() \instantiates QQuickWebEngineFormValidationMessageRequest \inqmlmodule QtWebEngine \since QtWebEngine 1.4 + \obsolete \brief A request for showing a HTML5 form validation message to the user. - A FormValidationMessageRequest is passed as an argument of the - WebEngineView::formValidationMessageRequested signal. It is generated when - the handling of the validation message is requested. - - The \l accepted property of the request indicates whether the request - is handled by the user code or the default message should be displayed. - - The following code uses a custom message to handle the request: - - \code - WebEngineView { - // ... - onFormValidationMessageRequested: function(request) { - request.accepted = true; - switch (request.type) { - case FormValidationMessageRequest.Show: - validationMessage.text = request.text; - validationMessage.x = request.x; - validationMessage.y = request.y - validationMessage.visible = true; - break; - case FormValidationMessageRequest.Move: - break; - case FormValidationMessageRequest.Hide: - validationMessage.visible = false; - break; - } - } - // ... - } - \endcode + No longer used since 5.11, as Blink now renders Validation messages internally. */ QQuickWebEngineFormValidationMessageRequest::QQuickWebEngineFormValidationMessageRequest( diff --git a/src/webengine/api/qquickwebengineview.cpp b/src/webengine/api/qquickwebengineview.cpp index 5e11a1c0415fe67b9080d3d8fc50366a3be9ec75..2fe146d4cf0db7618725cdf007278e1f5be1badb 100644 --- a/src/webengine/api/qquickwebengineview.cpp +++ b/src/webengine/api/qquickwebengineview.cpp @@ -116,7 +116,6 @@ QQuickWebEngineViewPrivate::QQuickWebEngineViewPrivate() , m_fullscreenMode(false) , isLoading(false) , m_activeFocusOnPress(true) - , m_validationShowing(false) , devicePixelRatio(QGuiApplication::primaryScreen()->devicePixelRatio()) , m_webChannel(0) , m_webChannelWorld(0) @@ -995,49 +994,6 @@ void QQuickWebEngineViewPrivate::didPrintPageToPdf(const QString &filePath, bool Q_EMIT q->pdfPrintingFinished(filePath, success); } -void QQuickWebEngineViewPrivate::showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) -{ - Q_Q(QQuickWebEngineView); - QQuickWebEngineFormValidationMessageRequest *request; - request = new QQuickWebEngineFormValidationMessageRequest(QQuickWebEngineFormValidationMessageRequest::Show, - anchor,mainText,subText); - m_validationShowing = true; - // mark the object for gc by creating temporary jsvalue - qmlEngine(q)->newQObject(request); - Q_EMIT q->formValidationMessageRequested(request); - if (!request->isAccepted()) - ui()->showMessageBubble(anchor, mainText, subText); -} - -void QQuickWebEngineViewPrivate::hideValidationMessage() -{ - Q_Q(QQuickWebEngineView); - // Suppress the initial hide message before any show messages (Since 61-based) - if (!m_validationShowing) - return; - QQuickWebEngineFormValidationMessageRequest *request; - request = new QQuickWebEngineFormValidationMessageRequest(QQuickWebEngineFormValidationMessageRequest::Hide); - m_validationShowing = false; - // mark the object for gc by creating temporary jsvalue - qmlEngine(q)->newQObject(request); - Q_EMIT q->formValidationMessageRequested(request); - if (!request->isAccepted()) - ui()->hideMessageBubble(); -} - -void QQuickWebEngineViewPrivate::moveValidationMessage(const QRect &anchor) -{ - Q_Q(QQuickWebEngineView); - QQuickWebEngineFormValidationMessageRequest *request; - request = new QQuickWebEngineFormValidationMessageRequest(QQuickWebEngineFormValidationMessageRequest::Move, - anchor); - // mark the object for gc by creating temporary jsvalue - qmlEngine(q)->newQObject(request); - Q_EMIT q->formValidationMessageRequested(request); - if (!request->isAccepted()) - ui()->moveMessageBubble(anchor); -} - void QQuickWebEngineViewPrivate::updateScrollPosition(const QPointF &position) { Q_Q(QQuickWebEngineView); diff --git a/src/webengine/api/qquickwebengineview_p_p.h b/src/webengine/api/qquickwebengineview_p_p.h index 19cdffdea989b33253871581cfe7d80504eff4e5..4b8617749dbcbad78ded5366f458330e23904a2f 100644 --- a/src/webengine/api/qquickwebengineview_p_p.h +++ b/src/webengine/api/qquickwebengineview_p_p.h @@ -137,9 +137,6 @@ public: QtWebEngineCore::WebEngineSettings *webEngineSettings() const override; void allowCertificateError(const QSharedPointer<CertificateErrorController> &errorController) override; void runGeolocationPermissionRequest(QUrl const&) override; - void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) override; - void hideValidationMessage() override; - void moveValidationMessage(const QRect &anchor) override; void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) override; void requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) override; void updateScrollPosition(const QPointF &position) override; @@ -181,7 +178,6 @@ public: bool isLoading; bool m_activeFocusOnPress; bool m_navigationActionTriggered; - bool m_validationShowing; qreal devicePixelRatio; QMap<quint64, QJSValue> m_callbacks; QList<QSharedPointer<CertificateErrorController> > m_certificateErrorControllers; diff --git a/src/webengine/doc/src/webengineview_lgpl.qdoc b/src/webengine/doc/src/webengineview_lgpl.qdoc index 761eb2a2c8b9766047c53312f8d1910240c478be..1621d0821a6b226be29adad6a523180d7563dbbe 100644 --- a/src/webengine/doc/src/webengineview_lgpl.qdoc +++ b/src/webengine/doc/src/webengineview_lgpl.qdoc @@ -1271,14 +1271,9 @@ /*! \qmlsignal WebEngineView::formValidationMessageRequested(FormValidationMessageRequest request) \since QtWebEngine 1.4 + \obsolete - This signal is emitted when a validation message is requested. - - The request can be handled by using the methods of the FormValidationMessageRequest - type. - - \note Signal handlers need to call \c{request.accepted = true} to prevent a - default dialog from showing up. + No longer used since 5.11, as Blink now renders Validation messages internally. */ /*! diff --git a/src/webengine/ui/MessageBubble.qml b/src/webengine/ui/MessageBubble.qml deleted file mode 100644 index 056aac1fe412dfc2f55403a8f5980e9822df2643..0000000000000000000000000000000000000000 --- a/src/webengine/ui/MessageBubble.qml +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.5 - -Item { - id: bubble - - width: 1 - height: 1 - - property int maxWidth: 0 - property string mainText: "" - property string subText: "" - - property int border: 1 - - property int arrowWidth: 18 - property int arrowHeight: 18 - property int arrowOffset: 18 - - property int marginLeft: border + 8 - property int marginTop: border + arrowHeight + 6 - property int marginRight: border + 8 - property int marginBottom: border + 6 - - Column { - id: messageColumn - - x: bubble.marginLeft - y: bubble.marginTop - z: 1 - - spacing: 5 - - Text { - id: message - width: bubble.maxWidth - - wrapMode: Text.WordWrap - elide: Text.ElideNone - clip: true - - font.pointSize: subMessage.font.pointSize + 4 - - text: bubble.mainText - } - - Text { - id: subMessage - width: bubble.maxWidth - - wrapMode: Text.WordWrap - elide: Text.ElideNone - clip: true - - text: bubble.subText - } - } - - Canvas { - id: bubbleCanvas - - property int textWidth: Math.min(bubble.maxWidth, Math.max(message.paintedWidth, subMessage.paintedWidth)) - property int textHeight: message.paintedHeight + (subMessage.paintedWidth > 0 ? (messageColumn.spacing + subMessage.paintedHeight) : 0) - - width: textWidth + bubble.marginLeft + bubble.marginRight - height: textHeight + bubble.marginTop + bubble.marginBottom - - property int cornerRadius: 7 - - property int messageBoxLeft: 0 - property int messageBoxTop: bubble.arrowHeight - property int messageBoxRight: width - border - property int messageBoxBottom: height - border - - onPaint: { - var ctx = getContext("2d"); - - ctx.lineWidth = bubble.border; - ctx.strokeStyle = "#555"; - ctx.fillStyle = "#ffffe1"; - - ctx.beginPath(); - - ctx.moveTo(messageBoxLeft + cornerRadius, messageBoxTop); - - // Arrow - ctx.lineTo(messageBoxLeft + bubble.arrowOffset, messageBoxTop); - ctx.lineTo(messageBoxLeft + bubble.arrowOffset, messageBoxTop - bubble.arrowHeight); - ctx.lineTo(messageBoxLeft + bubble.arrowOffset + bubble.arrowWidth, messageBoxTop); - - // Message Box - ctx.lineTo(messageBoxRight - cornerRadius, messageBoxTop); - ctx.quadraticCurveTo(messageBoxRight, messageBoxTop, messageBoxRight, messageBoxTop + cornerRadius); - ctx.lineTo(messageBoxRight, messageBoxBottom - cornerRadius); - ctx.quadraticCurveTo(messageBoxRight, messageBoxBottom, messageBoxRight - cornerRadius, messageBoxBottom); - ctx.lineTo(messageBoxLeft + cornerRadius, messageBoxBottom); - ctx.quadraticCurveTo(messageBoxLeft, messageBoxBottom, messageBoxLeft, messageBoxBottom - cornerRadius); - ctx.lineTo(messageBoxLeft, messageBoxTop + cornerRadius); - ctx.quadraticCurveTo(messageBoxLeft, messageBoxTop, messageBoxLeft + cornerRadius, messageBoxTop); - - ctx.closePath(); - - ctx.fill(); - ctx.stroke(); - } - - onPainted: { - bubble.width = bubbleCanvas.width; - bubble.height = bubbleCanvas.height; - } - } -} diff --git a/src/webengine/ui/ui.pro b/src/webengine/ui/ui.pro index bce03cc0cfbd2f868d9a1f0617cf7a0b8a7a4664..eb6bf435c9ab304fde4ee259a9460f859ca74a33 100644 --- a/src/webengine/ui/ui.pro +++ b/src/webengine/ui/ui.pro @@ -13,8 +13,6 @@ QML_FILES += \ Menu.qml \ MenuItem.qml \ MenuSeparator.qml \ - # Message Bubble - MessageBubble.qml \ ToolTip.qml load(qml_module) diff --git a/src/webengine/ui_delegates_manager.cpp b/src/webengine/ui_delegates_manager.cpp index 046affbf4afd805eba42798521072db1289036a1..12474a1f18645298749fcfdc06147891c68cafb5 100644 --- a/src/webengine/ui_delegates_manager.cpp +++ b/src/webengine/ui_delegates_manager.cpp @@ -129,7 +129,6 @@ MenuItemHandler::MenuItemHandler(QObject *parent) UIDelegatesManager::UIDelegatesManager(QQuickWebEngineView *view) : m_view(view) - , m_messageBubbleItem(0) , m_toolTip(nullptr) FOR_EACH_COMPONENT_TYPE(COMPONENT_MEMBER_INIT, NO_SEPARATOR) { @@ -535,39 +534,6 @@ void UIDelegatesManager::showMenu(QObject *menu) QMetaObject::invokeMethod(menu, "popup"); } -void UIDelegatesManager::showMessageBubble(const QRect &anchor, const QString &mainText, const QString &subText) -{ - if (!ensureComponentLoaded(MessageBubble)) - return; - - Q_ASSERT(m_messageBubbleItem.isNull()); - - QQmlContext *context = qmlContext(m_view); - m_messageBubbleItem.reset(qobject_cast<QQuickItem *>(messageBubbleComponent->beginCreate(context))); - m_messageBubbleItem->setParentItem(m_view); - messageBubbleComponent->completeCreate(); - - QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("maxWidth")).write(anchor.size().width()); - QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("mainText")).write(mainText); - QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("subText")).write(subText); - QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("x")).write(anchor.x()); - QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("y")).write(anchor.y() + anchor.size().height()); -} - -void UIDelegatesManager::hideMessageBubble() -{ - m_messageBubbleItem.reset(); -} - -void UIDelegatesManager::moveMessageBubble(const QRect &anchor) -{ - if (m_messageBubbleItem.isNull()) - return; - - QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("x")).write(anchor.x()); - QQmlProperty(m_messageBubbleItem.data(), QStringLiteral("y")).write(anchor.y() + anchor.size().height()); -} - void UIDelegatesManager::showToolTip(const QString &text) { if (!ensureComponentLoaded(ToolTip)) diff --git a/src/webengine/ui_delegates_manager.h b/src/webengine/ui_delegates_manager.h index 54ecf098633a0ba7f07efd3182a0accf6cfd997b..1cbf2ad281d5cee45d8e66ccffcfb7c8d1d52cfd 100644 --- a/src/webengine/ui_delegates_manager.h +++ b/src/webengine/ui_delegates_manager.h @@ -58,7 +58,6 @@ F(ConfirmDialog, confirmDialog) SEPARATOR \ F(PromptDialog, promptDialog) SEPARATOR \ F(FilePicker, filePicker) SEPARATOR \ - F(MessageBubble, messageBubble) SEPARATOR \ F(AuthenticationDialog, authenticationDialog) SEPARATOR \ F(ToolTip, toolTip) SEPARATOR \ @@ -120,17 +119,12 @@ public: void showDialog(QSharedPointer<AuthenticationDialogController>); void showFilePicker(QSharedPointer<FilePickerController>); virtual void showMenu(QObject *menu); - void showMessageBubble(const QRect &anchor, const QString &mainText, - const QString &subText); - void hideMessageBubble(); - void moveMessageBubble(const QRect &anchor); void showToolTip(const QString &text); protected: bool ensureComponentLoaded(ComponentType); QQuickWebEngineView *m_view; - QScopedPointer<QQuickItem> m_messageBubbleItem; QScopedPointer<QObject> m_toolTip; QStringList m_importDirs; diff --git a/src/webenginewidgets/api/qwebenginepage.cpp b/src/webenginewidgets/api/qwebenginepage.cpp index 0d5f83bbad9253df19afe73a8721b426266762d6..30ccf26f2bea67c2337e06f9bbd38c3731c151e1 100644 --- a/src/webenginewidgets/api/qwebenginepage.cpp +++ b/src/webenginewidgets/api/qwebenginepage.cpp @@ -64,10 +64,6 @@ #include "web_engine_settings.h" #include "qwebenginescript.h" -#ifdef QT_UI_DELEGATES -#include "ui/messagebubblewidget_p.h" -#endif - #include <QAction> #include <QApplication> #include <QAuthenticator> @@ -1604,27 +1600,6 @@ void QWebEnginePagePrivate::javaScriptConsoleMessage(JavaScriptConsoleMessageLev q->javaScriptConsoleMessage(static_cast<QWebEnginePage::JavaScriptConsoleMessageLevel>(level), message, lineNumber, sourceID); } -void QWebEnginePagePrivate::showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) -{ -#ifdef QT_UI_DELEGATES - QtWebEngineWidgetUI::MessageBubbleWidget::showBubble(view, anchor, mainText, subText); -#endif -} - -void QWebEnginePagePrivate::hideValidationMessage() -{ -#ifdef QT_UI_DELEGATES - QtWebEngineWidgetUI::MessageBubbleWidget::hideBubble(); -#endif -} - -void QWebEnginePagePrivate::moveValidationMessage(const QRect &anchor) -{ -#ifdef QT_UI_DELEGATES - QtWebEngineWidgetUI::MessageBubbleWidget::moveBubble(view, anchor); -#endif -} - void QWebEnginePagePrivate::renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) { diff --git a/src/webenginewidgets/api/qwebenginepage_p.h b/src/webenginewidgets/api/qwebenginepage_p.h index 61092fa6aeb5a3777fd3abeca7fec8ed875dafbe..81caaf4157c3e2ede51e655832efbc863b0e6b7c 100644 --- a/src/webenginewidgets/api/qwebenginepage_p.h +++ b/src/webenginewidgets/api/qwebenginepage_p.h @@ -134,9 +134,6 @@ public: QObject *accessibilityParentObject() override; QtWebEngineCore::WebEngineSettings *webEngineSettings() const override; void allowCertificateError(const QSharedPointer<CertificateErrorController> &controller) override; - void showValidationMessage(const QRect &anchor, const QString &mainText, const QString &subText) override; - void hideValidationMessage() override; - void moveValidationMessage(const QRect &anchor) override; void renderProcessTerminated(RenderProcessTerminationStatus terminationStatus, int exitCode) override; void requestGeometryChange(const QRect &geometry, const QRect &frameGeometry) override; void updateScrollPosition(const QPointF &position) override; diff --git a/src/webenginewidgets/api/qwebengineview.cpp b/src/webenginewidgets/api/qwebengineview.cpp index 7ea451fc5b6f08662af437f8a49a8f8cb74bb408..27b0a6017969bc2e9f603ffb47f4552fe76028d3 100644 --- a/src/webenginewidgets/api/qwebengineview.cpp +++ b/src/webenginewidgets/api/qwebengineview.cpp @@ -43,10 +43,6 @@ #include "qwebenginepage_p.h" #include "web_contents_adapter.h" -#ifdef QT_UI_DELEGATES -#include "ui/messagebubblewidget_p.h" -#endif - #include <QAction> #include <QMenu> #include <QContextMenuEvent> @@ -149,10 +145,6 @@ QWebEngineView::~QWebEngineView() { Q_D(QWebEngineView); QWebEngineViewPrivate::bind(0, d->page); - -#ifdef QT_UI_DELEGATES - QtWebEngineWidgetUI::MessageBubbleWidget::hideBubble(); -#endif } QWebEnginePage* QWebEngineView::page() const diff --git a/src/webenginewidgets/ui/messagebubblewidget.cpp b/src/webenginewidgets/ui/messagebubblewidget.cpp deleted file mode 100644 index 70dada0c4cde887d692e2d82f44975f332910244..0000000000000000000000000000000000000000 --- a/src/webenginewidgets/ui/messagebubblewidget.cpp +++ /dev/null @@ -1,225 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#include "messagebubblewidget_p.h" - -#include "api/qwebengineview.h" - -#include <qglobal.h> -#include <QBitmap> -#include <QHBoxLayout> -#include <QIcon> -#include <QLabel> -#include <QStyle> - -namespace QtWebEngineWidgetUI { - -Q_GLOBAL_STATIC(MessageBubbleWidget, bubbleInstance) - -void MessageBubbleWidget::showBubble(QWebEngineView *view, const QRect &anchor, const QString &mainText, const QString &subText) -{ - hideBubble(); - if (mainText.isEmpty()) - return; - - bubbleInstance->createBubble(anchor.size().width(), mainText, subText); - bubbleInstance->moveToAnchor(view, anchor); -} - -void MessageBubbleWidget::hideBubble() -{ - bubbleInstance->hide(); -} - -void MessageBubbleWidget::moveBubble(QWebEngineView *view, const QRect &anchor) -{ - bubbleInstance->moveToAnchor(view, anchor); -} - -MessageBubbleWidget::MessageBubbleWidget() - : QWidget(0, Qt::ToolTip) - , m_mainLabel(new QLabel) - , m_subLabel(new QLabel) -{ - QHBoxLayout *hLayout = new QHBoxLayout; - hLayout->setAlignment(Qt::AlignTop); - hLayout->setSizeConstraint(QLayout::SetFixedSize); - hLayout->setMargin(3); - - const int iconSize = 18; - QIcon si = style()->standardIcon(QStyle::SP_MessageBoxWarning); - - if (!si.isNull()) { - QLabel *iconLabel = new QLabel(this); - iconLabel->setPixmap(si.pixmap(iconSize, iconSize)); - iconLabel->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed); - iconLabel->setMargin(2); - hLayout->addWidget(iconLabel, 0, Qt::AlignTop); - } - - QVBoxLayout *vLayout = new QVBoxLayout; - - m_mainLabel->installEventFilter(this); - m_mainLabel->setWordWrap(true); - m_mainLabel->setTextFormat(Qt::PlainText); - m_mainLabel->setAlignment(Qt::AlignTop | Qt::AlignLeft); - vLayout->addWidget(m_mainLabel.data()); - - QFont mainFont = m_mainLabel->font(); - mainFont.setPointSize(mainFont.pointSize() + 4); - m_mainLabel->setFont(mainFont); - - m_subLabel->installEventFilter(this); - m_subLabel->setWordWrap(true); - m_subLabel->setTextFormat(Qt::PlainText); - m_subLabel->setAlignment(Qt::AlignBottom | Qt::AlignLeft); - vLayout->addWidget(m_subLabel.data()); - - hLayout->addLayout(vLayout); - setLayout(hLayout); - - QPalette pal = palette(); - pal.setColor(QPalette::Window, QColor(0xff, 0xff, 0xe1)); - pal.setColor(QPalette::WindowText, Qt::black); - setPalette(pal); -} - -MessageBubbleWidget::~MessageBubbleWidget() -{ -} - -void MessageBubbleWidget::paintEvent(QPaintEvent *) -{ - QPainter painter(this); - painter.drawPixmap(rect(), m_pixmap); -} - -void MessageBubbleWidget::createBubble(const int maxWidth, const QString &mainText, const QString &subText) -{ - m_mainLabel->setText(mainText); - m_mainLabel->setMaximumWidth(maxWidth); - - m_subLabel->setText(subText); - m_subLabel->setMaximumWidth(maxWidth); - m_subLabel->setVisible(!subText.isEmpty()); - - int border = 1; - int arrowHeight = 18; - bool roundedCorners = true; - -#if defined(QT_NO_XSHAPE) && defined(Q_WS_X11) - // XShape is required for setting the mask, so we just - // draw an ugly square when its not available - arrowHeight = 0; - roundedCorners = false; -#endif - - setContentsMargins(border + 3, border + arrowHeight + 2, border + 3, border + 2); - show(); // The widget should be visible for updateGeometry() - updateGeometry(); - m_pixmap = QPixmap(sizeHint()); - - QPainterPath path = drawBoxPath(QPoint(0, arrowHeight), border, roundedCorners); - - // Draw border and set background - QPainter painter(&m_pixmap); - painter.setPen(QPen(palette().color(QPalette::Window).darker(160), border)); - painter.setBrush(palette().color(QPalette::Window)); - painter.drawPath(path); -} - -void MessageBubbleWidget::moveToAnchor(QWebEngineView *view, const QRect &anchor) -{ - QPoint topLeft = view->mapToGlobal(anchor.topLeft()); - move(topLeft.x(), topLeft.y() + anchor.height()); -} - -QPainterPath MessageBubbleWidget::drawBoxPath(const QPoint &pos, int border, bool roundedCorners) -{ - const int arrowHeight = pos.y(); - const int arrowOffset = 18; - const int arrowWidth = 18; - - const int cornerRadius = roundedCorners ? 7 : 0; - - const int messageBoxLeft = pos.x(); - const int messageBoxTop = arrowHeight; - const int messageBoxRight = m_pixmap.width() - 1; - const int messageBoxBottom = m_pixmap.height() - 1; - - QPainterPath path; - path.moveTo(messageBoxLeft + cornerRadius, messageBoxTop); - - if (arrowHeight) { - path.lineTo(messageBoxLeft + arrowOffset, messageBoxTop); - path.lineTo(messageBoxLeft + arrowOffset, messageBoxTop - arrowHeight); - path.lineTo(messageBoxLeft + arrowOffset + arrowWidth, messageBoxTop); - } - - if (roundedCorners) { - path.lineTo(messageBoxRight - cornerRadius, messageBoxTop); - path.quadTo(messageBoxRight, messageBoxTop, messageBoxRight, messageBoxTop + cornerRadius); - path.lineTo(messageBoxRight, messageBoxBottom - cornerRadius); - path.quadTo(messageBoxRight, messageBoxBottom, messageBoxRight - cornerRadius, messageBoxBottom); - path.lineTo(messageBoxLeft + cornerRadius, messageBoxBottom); - path.quadTo(messageBoxLeft, messageBoxBottom, messageBoxLeft, messageBoxBottom - cornerRadius); - path.lineTo(messageBoxLeft, messageBoxTop + cornerRadius); - path.quadTo(messageBoxLeft, messageBoxTop, messageBoxLeft + cornerRadius, messageBoxTop); - } else { - path.lineTo(messageBoxRight, messageBoxTop); - path.lineTo(messageBoxRight, messageBoxBottom); - path.lineTo(messageBoxLeft, messageBoxBottom); - path.moveTo(messageBoxLeft, messageBoxTop); - } - - // Set mask - if (arrowHeight || roundedCorners) { - QBitmap bitmap = QBitmap(sizeHint()); - bitmap.fill(Qt::color0); - QPainter painter(&bitmap); - painter.setPen(QPen(Qt::color1, border)); - painter.setBrush(QBrush(Qt::color1)); - painter.drawPath(path); - setMask(bitmap); - } - - return path; -} - -} // namespace QtWebEngineWidgetUI diff --git a/src/webenginewidgets/ui/messagebubblewidget_p.h b/src/webenginewidgets/ui/messagebubblewidget_p.h deleted file mode 100644 index 6898aea131906f2595f39b7cc4ba39ea4ac7e597..0000000000000000000000000000000000000000 --- a/src/webenginewidgets/ui/messagebubblewidget_p.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:LGPL$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU Lesser General Public License Usage -** Alternatively, this file may be used under the terms of the GNU Lesser -** General Public License version 3 as published by the Free Software -** Foundation and appearing in the file LICENSE.LGPL3 included in the -** packaging of this file. Please review the following information to -** ensure the GNU Lesser General Public License version 3 requirements -** will be met: https://www.gnu.org/licenses/lgpl-3.0.html. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 2.0 or (at your option) the GNU General -** Public license version 3 or any later version approved by the KDE Free -** Qt Foundation. The licenses are as published by the Free Software -** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3 -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-2.0.html and -** https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -#ifndef MESSAGEBUBBLEWIDGET_P_H -#define MESSAGEBUBBLEWIDGET_P_H - -// -// W A R N I N G -// ------------- -// -// This file is not part of the Qt API. It exists purely as an -// implementation detail. This header file may change from version to -// version without notice, or even be removed. -// -// We mean it. -// - -#include <QWidget> -#include <QPainterPath> - -QT_BEGIN_NAMESPACE -class QLabel; -class QWebEngineView; -QT_END_NAMESPACE - -namespace QtWebEngineWidgetUI { - -class MessageBubbleWidget : public QWidget -{ - Q_OBJECT -public: - MessageBubbleWidget(); - ~MessageBubbleWidget(); - - static void showBubble(QWebEngineView *view, const QRect &anchor, const QString &mainText, const QString &subText = QString()); - static void hideBubble(); - static void moveBubble(QWebEngineView *view, const QRect &anchor); - -protected: - void paintEvent(QPaintEvent *) override; - -private: - void createBubble(const int maxWidth, const QString &mainText, const QString &subText); - void moveToAnchor(QWebEngineView *view, const QRect &anchor); - - QPainterPath drawBoxPath(const QPoint &pos, int border, bool roundedCorners); - - QScopedPointer<QLabel> m_mainLabel; - QScopedPointer<QLabel> m_subLabel; - QPixmap m_pixmap; -}; - -} // namespace QtWebEngineWidgetUI - -#endif // MESSAGEBUBBLEWIDGET_P_H diff --git a/src/webenginewidgets/webenginewidgets.pro b/src/webenginewidgets/webenginewidgets.pro index 540c4d538b2854f91f82658d66f31c347153f202..a891c062eeb284d2aaa50c1a933e434242e82b03 100644 --- a/src/webenginewidgets/webenginewidgets.pro +++ b/src/webenginewidgets/webenginewidgets.pro @@ -44,12 +44,6 @@ HEADERS = \ api/qwebengineview_p.h \ render_widget_host_view_qt_delegate_widget.h -qtConfig(webengine-ui-delegates) { - SOURCES += ui/messagebubblewidget.cpp - HEADERS += ui/messagebubblewidget_p.h - DEFINES += QT_UI_DELEGATES -} - qtConfig(webengine-spellchecker) { DEFINES += ENABLE_SPELLCHECK } diff --git a/tests/auto/quick/qmltests/data/tst_formValidation.qml b/tests/auto/quick/qmltests/data/tst_formValidation.qml deleted file mode 100644 index 182a2eaa92988ac923b2ebd003f0656edb2496c0..0000000000000000000000000000000000000000 --- a/tests/auto/quick/qmltests/data/tst_formValidation.qml +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2016 The Qt Company Ltd. -** Contact: https://www.qt.io/licensing/ -** -** This file is part of the QtWebEngine module of the Qt Toolkit. -** -** $QT_BEGIN_LICENSE:GPL-EXCEPT$ -** Commercial License Usage -** Licensees holding valid commercial Qt licenses may use this file in -** accordance with the commercial license agreement provided with the -** Software or, alternatively, in accordance with the terms contained in -** a written agreement between you and The Qt Company. For licensing terms -** and conditions see https://www.qt.io/terms-conditions. For further -** information use the contact form at https://www.qt.io/contact-us. -** -** GNU General Public License Usage -** Alternatively, this file may be used under the terms of the GNU -** General Public License version 3 as published by the Free Software -** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT -** included in the packaging of this file. Please review the following -** information to ensure the GNU General Public License requirements will -** be met: https://www.gnu.org/licenses/gpl-3.0.html. -** -** $QT_END_LICENSE$ -** -****************************************************************************/ - -import QtQuick 2.0 -import QtTest 1.0 -import QtWebEngine 1.4 - -TestWebEngineView { - id: webEngineView - width: 400 - height: 300 - - SignalSpy { - id: formValidationMessageRequestSpy - target: webEngineView - signalName: "formValidationMessageRequested" - } - - TestCase { - name: "WebEngineViewFormValidation" - when: windowShown - - function init() { - webEngineView.url = Qt.resolvedUrl("about:blank"); - verify(webEngineView.waitForLoadSucceeded()); - formValidationMessageRequestSpy.clear(); - } - - function test_urlForm() { - webEngineView.url = Qt.resolvedUrl("forms.html#url_empty"); - verify(webEngineView.waitForLoadSucceeded()); - keyPress(Qt.Key_Enter); - formValidationMessageRequestSpy.wait(); - compare(formValidationMessageRequestSpy.signalArguments[0][0].type, FormValidationMessageRequest.Show); - compare(formValidationMessageRequestSpy.signalArguments[0][0].text, "Please fill out this field."); - - webEngineView.url = Qt.resolvedUrl("about:blank"); - verify(webEngineView.waitForLoadSucceeded()); - formValidationMessageRequestSpy.wait(); - compare(formValidationMessageRequestSpy.signalArguments[1][0].type, FormValidationMessageRequest.Hide); - - webEngineView.url = Qt.resolvedUrl("forms.html#url_invalid"); - verify(webEngineView.waitForLoadSucceeded()); - keyPress(Qt.Key_Enter); - formValidationMessageRequestSpy.wait(); - compare(formValidationMessageRequestSpy.signalArguments[2][0].type, FormValidationMessageRequest.Show); - compare(formValidationMessageRequestSpy.signalArguments[2][0].text, "Please enter a URL."); - } - - function test_emailForm() { - webEngineView.url = Qt.resolvedUrl("forms.html#email_empty"); - verify(webEngineView.waitForLoadSucceeded()); - keyPress(Qt.Key_Enter); - formValidationMessageRequestSpy.wait(); - compare(formValidationMessageRequestSpy.signalArguments[0][0].type, FormValidationMessageRequest.Show); - compare(formValidationMessageRequestSpy.signalArguments[0][0].text, "Please fill out this field."); - - webEngineView.url = Qt.resolvedUrl("about:blank"); - verify(webEngineView.waitForLoadSucceeded()); - formValidationMessageRequestSpy.wait(); - compare(formValidationMessageRequestSpy.signalArguments[1][0].type, FormValidationMessageRequest.Hide); - - webEngineView.url = Qt.resolvedUrl("forms.html#email_invalid"); - verify(webEngineView.waitForLoadSucceeded()); - keyPress(Qt.Key_Enter); - formValidationMessageRequestSpy.wait(); - compare(formValidationMessageRequestSpy.signalArguments[2][0].type, FormValidationMessageRequest.Show); - compare(formValidationMessageRequestSpy.signalArguments[2][0].text, "Please include an '@' in the email address. 'invalid' is missing an '@'."); - } - - function test_textForm() { - webEngineView.url = Qt.resolvedUrl("forms.html#input_empty"); - verify(webEngineView.waitForLoadSucceeded()); - keyPress(Qt.Key_Enter); - formValidationMessageRequestSpy.wait(); - compare(formValidationMessageRequestSpy.signalArguments[0][0].type, FormValidationMessageRequest.Show); - compare(formValidationMessageRequestSpy.signalArguments[0][0].text, "Please fill out this field."); - // Title should be shown for pattern mismatch only - compare(formValidationMessageRequestSpy.signalArguments[0][0].subText, ""); - - webEngineView.url = Qt.resolvedUrl("about:blank"); - verify(webEngineView.waitForLoadSucceeded()); - formValidationMessageRequestSpy.wait(); - compare(formValidationMessageRequestSpy.signalArguments[1][0].type, FormValidationMessageRequest.Hide); - - webEngineView.url = Qt.resolvedUrl("forms.html#lorem_ipsum"); - verify(webEngineView.waitForLoadSucceeded()); - keyPress(Qt.Key_Enter); - formValidationMessageRequestSpy.wait(); - compare(formValidationMessageRequestSpy.signalArguments[2][0].type, FormValidationMessageRequest.Show); - compare(formValidationMessageRequestSpy.signalArguments[2][0].text, "Please match the requested format."); - compare(formValidationMessageRequestSpy.signalArguments[2][0].subText, "Should type 'Lorem ipsum'"); - } - } -} diff --git a/tests/auto/quick/qmltests/qmltests.pro b/tests/auto/quick/qmltests/qmltests.pro index 16ecbc1bc07a604d5a0e7d0d236dcebe09b7415e..5395da0b5de8b27b9d5366ae1260bc086391b3ba 100644 --- a/tests/auto/quick/qmltests/qmltests.pro +++ b/tests/auto/quick/qmltests/qmltests.pro @@ -51,7 +51,6 @@ OTHER_FILES += \ $$PWD/data/tst_filePicker.qml \ $$PWD/data/tst_findText.qml \ $$PWD/data/tst_focusOnNavigation.qml \ - $$PWD/data/tst_formValidation.qml \ $$PWD/data/tst_geopermission.qml \ $$PWD/data/tst_getUserMedia.qml \ $$PWD/data/tst_inputMethod.qml \