master
Marc Wäckerlin 12 years ago
parent 5f39f8d261
commit 9d50e35895
  1. 2
      src/qbrowserlib/qbrowserlib_de.ts
  2. 2
      src/qbrowserlib/qbrowserlib_en.ts
  3. 2
      src/qbrowserlib/qbrowserlib_fr.ts
  4. 2
      src/qbrowserlib/qbrowserlib_it.ts
  5. 25
      src/qbrowserlib/swisswebwidget.hxx

@ -695,7 +695,7 @@ Specify full path to executable program</source>
<context> <context>
<name>qbrowserlib::SwissWebWidget</name> <name>qbrowserlib::SwissWebWidget</name>
<message> <message>
<location filename="swisswebwidget.hxx" line="53"/> <location filename="swisswebwidget.hxx" line="69"/>
<source>Browser Tools</source> <source>Browser Tools</source>
<comment>name of the browser&apos;s toolbar</comment> <comment>name of the browser&apos;s toolbar</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

@ -695,7 +695,7 @@ Specify full path to executable program</source>
<context> <context>
<name>qbrowserlib::SwissWebWidget</name> <name>qbrowserlib::SwissWebWidget</name>
<message> <message>
<location filename="swisswebwidget.hxx" line="53"/> <location filename="swisswebwidget.hxx" line="69"/>
<source>Browser Tools</source> <source>Browser Tools</source>
<comment>name of the browser&apos;s toolbar</comment> <comment>name of the browser&apos;s toolbar</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

@ -695,7 +695,7 @@ Specify full path to executable program</source>
<context> <context>
<name>qbrowserlib::SwissWebWidget</name> <name>qbrowserlib::SwissWebWidget</name>
<message> <message>
<location filename="swisswebwidget.hxx" line="53"/> <location filename="swisswebwidget.hxx" line="69"/>
<source>Browser Tools</source> <source>Browser Tools</source>
<comment>name of the browser&apos;s toolbar</comment> <comment>name of the browser&apos;s toolbar</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

@ -695,7 +695,7 @@ Specify full path to executable program</source>
<context> <context>
<name>qbrowserlib::SwissWebWidget</name> <name>qbrowserlib::SwissWebWidget</name>
<message> <message>
<location filename="swisswebwidget.hxx" line="53"/> <location filename="swisswebwidget.hxx" line="69"/>
<source>Browser Tools</source> <source>Browser Tools</source>
<comment>name of the browser&apos;s toolbar</comment> <comment>name of the browser&apos;s toolbar</comment>
<translation type="unfinished"></translation> <translation type="unfinished"></translation>

@ -16,6 +16,20 @@
#include <QtDebug> #include <QtDebug>
#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 //! @addtogroup qbrowserlib
//! @{ //! @{
@ -30,6 +44,8 @@ namespace qbrowserlib {
Q_OBJECT; Q_OBJECT;
CREATE_QT_PROPERTY(QUrl, homeUrl);
public: public:
SwissWebWidget(QWidget* p=0): QWidget(p) { SwissWebWidget(QWidget* p=0): QWidget(p) {
@ -40,7 +56,7 @@ namespace qbrowserlib {
moveToMain(qobject_cast<QMainWindow*>(p?p->parentWidget():p)); moveToMain(qobject_cast<QMainWindow*>(p?p->parentWidget():p));
connects(); connects();
} }
//! Moves status widgets to status bar, tool widgets to toolbar //! Moves status widgets to status bar, tool widgets to toolbar
/*! You can use this method to reparent the tools and the status /*! You can use this method to reparent the tools and the status
part of the widget into the toolbar and statusbar of your 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 @note If used as central widget of a QMainWindow, status and
tools are automatically reparented in the constructor. */ tools are automatically reparented in the constructor. */
void moveToMain(QMainWindow* w) { void moveToMain(QMainWindow* w) {
if (!w) return; if (!w || !_statusbar || !_tools) return;
QToolBar* t(w->addToolBar(trUtf8("Browser Tools", QToolBar* t(w->addToolBar(trUtf8("Browser Tools",
"name of the browser's toolbar"))); "name of the browser's toolbar")));
while (_tools->count()) while (_tools->count())
@ -66,11 +82,16 @@ namespace qbrowserlib {
void load() { void load() {
_webview->load(_url->text()); _webview->load(_url->text());
} }
void goHome() {
_webview->load(_homeUrl);
}
protected: protected:
void connects() { void connects() {
connect(_url, SIGNAL(returnPressed()), SLOT(load())); connect(_url, SIGNAL(returnPressed()), SLOT(load()));
connect(_home, SIGNAL(pressed()), SLOT(goHome()));
} }
}; };

Loading…
Cancel
Save