1
mirror of https://invent.kde.org/network/falkon.git synced 2024-11-11 01:22:10 +01:00

Added function to return focused element on page.

WebView/WebPage::activeElement
This commit is contained in:
nowrep 2013-04-07 20:19:21 +02:00
parent a73ad89f9e
commit 90c285c1ac
4 changed files with 14 additions and 0 deletions

View File

@ -186,6 +186,12 @@ bool WebPage::containsRejectedCerts(const QList<QSslCertificate> &certs)
return matches == certs.count();
}
QWebElement WebPage::activeElement() const
{
QRect activeRect = inputMethodQuery(Qt::ImMicroFocus).toRect();
return mainFrame()->hitTestContent(activeRect.center()).element();
}
bool WebPage::isRunningLoop()
{
return m_runningLoop;

View File

@ -78,6 +78,7 @@ public:
void addRejectedCerts(const QList<QSslCertificate> &certs);
bool containsRejectedCerts(const QList<QSslCertificate> &certs);
QWebElement activeElement() const;
QString userAgentForUrl(const QUrl &url) const;
static bool isPointerSafeToUse(WebPage* page);

View File

@ -225,6 +225,12 @@ bool WebView::hasRss() const
return m_hasRss;
}
QWebElement WebView::activeElement() const
{
QRect activeRect = inputMethodQuery(Qt::ImMicroFocus).toRect();
return page()->mainFrame()->hitTestContent(activeRect.center()).element();
}
bool WebView::isUrlValid(const QUrl &url)
{
const QString &urlScheme = url.scheme();

View File

@ -49,6 +49,7 @@ public:
void fakeLoadingProgress(int progress);
bool hasRss() const;
QWebElement activeElement() const;
void addNotification(QWidget* notif);
bool eventFilter(QObject* obj, QEvent* event);