designer plugin works; refs #115
This commit is contained in:
@@ -28,13 +28,13 @@ win32 {
|
||||
QMAKE_LIBS += /opt/local/i586-mingw32msvc/lib/winscard.a
|
||||
CONFIG += release
|
||||
}
|
||||
SOURCES = webviewwidgetifc.cxx
|
||||
|
||||
SOURCES = webviewwidgetifc.cxx
|
||||
HEADERS = webviewwidgetifc.hxx
|
||||
|
||||
FORMS =
|
||||
|
||||
RESOURCES = resources.qrc.in
|
||||
RESOURCES = resources.qrc
|
||||
|
||||
TEMPLATE = lib
|
||||
TARGET = qbrowserlib-plugin
|
||||
|
@@ -1,5 +1,5 @@
|
||||
<RCC>
|
||||
<qresource prefix="/icon">
|
||||
<qresource prefix="/icons">
|
||||
<file>webview.png</file>
|
||||
</qresource>
|
||||
</RCC>
|
||||
|
@@ -11,55 +11,60 @@
|
||||
#include <qbrowserlib/webview.hxx>
|
||||
#include <QtDesigner>
|
||||
|
||||
#define LOG qDebug()<<__PRETTY_FUNCTION__
|
||||
|
||||
//! WebView widget for Qt Designer
|
||||
class WebViewWidgetIfc: public QObject, public QDesignerCustomWidgetInterface {
|
||||
Q_OBJECT;
|
||||
Q_INTERFACES(QDesignerCustomWidgetInterface);
|
||||
public:
|
||||
bool isContainer() const {
|
||||
LOG;
|
||||
return false;
|
||||
}
|
||||
bool isInitialized() const {
|
||||
return _initialized;
|
||||
}
|
||||
QIcon icon() const {
|
||||
return QIcon(QPixmap("qrc:/icons/webview.png"));
|
||||
LOG;
|
||||
return QIcon(":/icons/webview.png");
|
||||
}
|
||||
QString domXml() const {
|
||||
LOG;
|
||||
return
|
||||
" <property name=\"geometry\">\n"
|
||||
" <rect>\n"
|
||||
" <x>0</x>\n"
|
||||
" <y>0</y>\n"
|
||||
" <width>100</width>\n"
|
||||
" <height>100</height>\n"
|
||||
" </rect>\n"
|
||||
" </property>\n";
|
||||
QString
|
||||
("<ui language=\"c++\" displayname=\"%1\">"
|
||||
" <widget class=\"%1\" name=\"%2\"/>"
|
||||
" <customwidgets>"
|
||||
" <customwidget>"
|
||||
" <class>%1</class>"
|
||||
" </customwidget>"
|
||||
" </customwidgets>"
|
||||
"</ui>")
|
||||
.arg(name())
|
||||
.arg(name().toLower());
|
||||
}
|
||||
QString group() const {
|
||||
return "DisplayWidgets";
|
||||
LOG;
|
||||
return "Display Widgets [Examples]";
|
||||
}
|
||||
QString includeFile() const {
|
||||
LOG;
|
||||
return "qbrowserlib/webview.hxx";
|
||||
}
|
||||
QString name() const {
|
||||
return "SwissWebView";
|
||||
LOG;
|
||||
return "WebView";
|
||||
}
|
||||
QString toolTip() const {
|
||||
return "SwissWebView";
|
||||
LOG;
|
||||
return "";
|
||||
}
|
||||
QString whatsThis() const {
|
||||
return "SwissWebView";
|
||||
LOG;
|
||||
return "";
|
||||
}
|
||||
QWidget *createWidget(QWidget *parent) {
|
||||
LOG;
|
||||
return new WebView(parent);
|
||||
}
|
||||
void initialize(QDesignerFormEditorInterface *core) {
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
private:
|
||||
bool _initialized;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -12,10 +12,11 @@
|
||||
#include <qbrowserlib/pluginfactory.hxx>
|
||||
|
||||
#include <QtWebKit>
|
||||
#include <QtDesigner/QDesignerExportWidget>
|
||||
|
||||
#include <memory>
|
||||
|
||||
class WebView: public QWebView {
|
||||
class QDESIGNER_WIDGET_EXPORT WebView: public QWebView {
|
||||
Q_OBJECT;
|
||||
signals:
|
||||
void newView(WebView*);
|
||||
|
Reference in New Issue
Block a user