designer plugin works; refs #115

master
Marc Wäckerlin 13 years ago
parent dc9844bae4
commit 66f3cad774
  1. 4
      src/designer/qmake.pro.in
  2. 2
      src/designer/resources.qrc.in
  3. 49
      src/designer/webviewwidgetifc.hxx
  4. 3
      src/qbrowserlib/webview.hxx

@ -28,13 +28,13 @@ win32 {
QMAKE_LIBS += /opt/local/i586-mingw32msvc/lib/winscard.a QMAKE_LIBS += /opt/local/i586-mingw32msvc/lib/winscard.a
CONFIG += release CONFIG += release
} }
SOURCES = webviewwidgetifc.cxx
SOURCES = webviewwidgetifc.cxx
HEADERS = webviewwidgetifc.hxx HEADERS = webviewwidgetifc.hxx
FORMS = FORMS =
RESOURCES = resources.qrc.in RESOURCES = resources.qrc
TEMPLATE = lib TEMPLATE = lib
TARGET = qbrowserlib-plugin TARGET = qbrowserlib-plugin

@ -1,5 +1,5 @@
<RCC> <RCC>
<qresource prefix="/icon"> <qresource prefix="/icons">
<file>webview.png</file> <file>webview.png</file>
</qresource> </qresource>
</RCC> </RCC>

@ -11,55 +11,60 @@
#include <qbrowserlib/webview.hxx> #include <qbrowserlib/webview.hxx>
#include <QtDesigner> #include <QtDesigner>
#define LOG qDebug()<<__PRETTY_FUNCTION__
//! WebView widget for Qt Designer //! WebView widget for Qt Designer
class WebViewWidgetIfc: public QObject, public QDesignerCustomWidgetInterface { class WebViewWidgetIfc: public QObject, public QDesignerCustomWidgetInterface {
Q_OBJECT; Q_OBJECT;
Q_INTERFACES(QDesignerCustomWidgetInterface); Q_INTERFACES(QDesignerCustomWidgetInterface);
public: public:
bool isContainer() const { bool isContainer() const {
LOG;
return false; return false;
} }
bool isInitialized() const {
return _initialized;
}
QIcon icon() const { QIcon icon() const {
return QIcon(QPixmap("qrc:/icons/webview.png")); LOG;
return QIcon(":/icons/webview.png");
} }
QString domXml() const { QString domXml() const {
LOG;
return return
" <property name=\"geometry\">\n" QString
" <rect>\n" ("<ui language=\"c++\" displayname=\"%1\">"
" <x>0</x>\n" " <widget class=\"%1\" name=\"%2\"/>"
" <y>0</y>\n" " <customwidgets>"
" <width>100</width>\n" " <customwidget>"
" <height>100</height>\n" " <class>%1</class>"
" </rect>\n" " </customwidget>"
" </property>\n"; " </customwidgets>"
"</ui>")
.arg(name())
.arg(name().toLower());
} }
QString group() const { QString group() const {
return "DisplayWidgets"; LOG;
return "Display Widgets [Examples]";
} }
QString includeFile() const { QString includeFile() const {
LOG;
return "qbrowserlib/webview.hxx"; return "qbrowserlib/webview.hxx";
} }
QString name() const { QString name() const {
return "SwissWebView"; LOG;
return "WebView";
} }
QString toolTip() const { QString toolTip() const {
return "SwissWebView"; LOG;
return "";
} }
QString whatsThis() const { QString whatsThis() const {
return "SwissWebView"; LOG;
return "";
} }
QWidget *createWidget(QWidget *parent) { QWidget *createWidget(QWidget *parent) {
LOG;
return new WebView(parent); return new WebView(parent);
} }
void initialize(QDesignerFormEditorInterface *core) {
_initialized = true;
}
private:
bool _initialized;
}; };
#endif #endif

@ -12,10 +12,11 @@
#include <qbrowserlib/pluginfactory.hxx> #include <qbrowserlib/pluginfactory.hxx>
#include <QtWebKit> #include <QtWebKit>
#include <QtDesigner/QDesignerExportWidget>
#include <memory> #include <memory>
class WebView: public QWebView { class QDESIGNER_WIDGET_EXPORT WebView: public QWebView {
Q_OBJECT; Q_OBJECT;
signals: signals:
void newView(WebView*); void newView(WebView*);

Loading…
Cancel
Save