Browse files

Add properties "page.title" and "page.frameTitle"

  • Loading branch information...
1 parent 42bf8b3 commit 3f874067f59a682e25dde7e6b694462f1d220f1a @detro detro committed Sep 26, 2012
Showing with 15 additions and 0 deletions.
  1. +10 −0 src/webpage.cpp
  2. +5 −0 src/webpage.h
View
10 src/webpage.cpp
@@ -361,6 +361,16 @@ void WebPage::setFrameContent(const QString &content)
m_currentFrame->setHtml(content);
}
+QString WebPage::title() const
+{
+ return m_mainFrame->title();
+}
+
+QString WebPage::frameTitle() const
+{
+ return m_currentFrame->title();
+}
+
QString WebPage::url() const
{
return m_mainFrame->url().toString();
View
5 src/webpage.h
@@ -48,6 +48,8 @@ class Phantom;
class WebPage: public REPLCompletable, public QWebFrame::PrintCallback
{
Q_OBJECT
+ Q_PROPERTY(QString title READ title)
+ Q_PROPERTY(QString frameTitle READ frameTitle)
Q_PROPERTY(QString content READ content WRITE setContent)
Q_PROPERTY(QString frameContent READ frameContent WRITE setFrameContent)
Q_PROPERTY(QString url READ url)
@@ -85,6 +87,9 @@ class WebPage: public REPLCompletable, public QWebFrame::PrintCallback
void setContent(const QString &content);
void setFrameContent(const QString &content);
+ QString title() const;
+ QString frameTitle() const;
+
QString url() const;
QString frameUrl() const;

0 comments on commit 3f87406

Please sign in to comment.