diff --git a/src/qbrowserlib/qbrowserlib_de.ts b/src/qbrowserlib/qbrowserlib_de.ts index 9d6e7f9..36677f8 100644 --- a/src/qbrowserlib/qbrowserlib_de.ts +++ b/src/qbrowserlib/qbrowserlib_de.ts @@ -695,7 +695,7 @@ Specify full path to executable program qbrowserlib::SwissWebWidget - + Browser Tools name of the browser's toolbar diff --git a/src/qbrowserlib/qbrowserlib_en.ts b/src/qbrowserlib/qbrowserlib_en.ts index abeb6f7..61b18c2 100644 --- a/src/qbrowserlib/qbrowserlib_en.ts +++ b/src/qbrowserlib/qbrowserlib_en.ts @@ -695,7 +695,7 @@ Specify full path to executable program qbrowserlib::SwissWebWidget - + Browser Tools name of the browser's toolbar diff --git a/src/qbrowserlib/qbrowserlib_fr.ts b/src/qbrowserlib/qbrowserlib_fr.ts index d7de06d..0587906 100644 --- a/src/qbrowserlib/qbrowserlib_fr.ts +++ b/src/qbrowserlib/qbrowserlib_fr.ts @@ -695,7 +695,7 @@ Specify full path to executable program qbrowserlib::SwissWebWidget - + Browser Tools name of the browser's toolbar diff --git a/src/qbrowserlib/qbrowserlib_it.ts b/src/qbrowserlib/qbrowserlib_it.ts index 8731e29..e2166da 100644 --- a/src/qbrowserlib/qbrowserlib_it.ts +++ b/src/qbrowserlib/qbrowserlib_it.ts @@ -695,7 +695,7 @@ Specify full path to executable program qbrowserlib::SwissWebWidget - + Browser Tools name of the browser's toolbar diff --git a/src/qbrowserlib/swisswebwidget.hxx b/src/qbrowserlib/swisswebwidget.hxx index ab8da8f..3b9f4b0 100644 --- a/src/qbrowserlib/swisswebwidget.hxx +++ b/src/qbrowserlib/swisswebwidget.hxx @@ -16,6 +16,20 @@ #include +#ifndef CREATE_QT_PROPERTY +#define CREATE_QT_PROPERTY(type, name) \ + Q_PROPERTY(type _##name READ name WRITE name USER true) \ + public: \ + void name(const type& v) { \ + _##name = v; \ + } \ + type name() { \ + return _##name; \ + } \ + private: \ + type _##name +#endif + //! @addtogroup qbrowserlib //! @{ @@ -30,6 +44,8 @@ namespace qbrowserlib { Q_OBJECT; + CREATE_QT_PROPERTY(QUrl, homeUrl); + public: SwissWebWidget(QWidget* p=0): QWidget(p) { @@ -40,7 +56,7 @@ namespace qbrowserlib { moveToMain(qobject_cast(p?p->parentWidget():p)); connects(); } - + //! Moves status widgets to status bar, tool widgets to toolbar /*! You can use this method to reparent the tools and the status part of the widget into the toolbar and statusbar of your @@ -49,7 +65,7 @@ namespace qbrowserlib { @note If used as central widget of a QMainWindow, status and tools are automatically reparented in the constructor. */ void moveToMain(QMainWindow* w) { - if (!w) return; + if (!w || !_statusbar || !_tools) return; QToolBar* t(w->addToolBar(trUtf8("Browser Tools", "name of the browser's toolbar"))); while (_tools->count()) @@ -66,11 +82,16 @@ namespace qbrowserlib { void load() { _webview->load(_url->text()); } + + void goHome() { + _webview->load(_homeUrl); + } protected: void connects() { connect(_url, SIGNAL(returnPressed()), SLOT(load())); + connect(_home, SIGNAL(pressed()), SLOT(goHome())); } };