Refactored osgQt so that QWebViewImage is now entirely implementated in the header, and osgQt itself no longer compiles it,
leaving it to only applications that require it to include the header and it's implementation and with ith the QWebKit dependency.
This commit is contained in:
@@ -26,7 +26,7 @@ FOREACH( mylibfolder
|
||||
|
||||
ENDFOREACH()
|
||||
|
||||
IF (QT4_FOUND AND QT_QTWEBKIT_FOUND)
|
||||
IF (QT4_FOUND)
|
||||
ADD_SUBDIRECTORY(osgQt)
|
||||
ENDIF()
|
||||
|
||||
|
||||
@@ -19,17 +19,17 @@ SET(LIB_PUBLIC_HEADERS
|
||||
${HEADER_PATH}/Export
|
||||
${HEADER_PATH}/QFontImplementation
|
||||
${HEADER_PATH}/QGraphicsViewAdapter
|
||||
${HEADER_PATH}/QWebViewImage
|
||||
${HEADER_PATH}/QWidgetImage
|
||||
${HEADER_PATH}/QWebViewImage
|
||||
)
|
||||
|
||||
|
||||
# FIXME: For OS X, need flag for Framework or dylib
|
||||
ADD_LIBRARY(${LIB_NAME}
|
||||
${OPENSCENEGRAPH_USER_DEFINED_DYNAMIC_OR_STATIC}
|
||||
${LIB_PUBLIC_HEADERS}
|
||||
QFontImplementation.cpp
|
||||
QGraphicsViewAdapter.cpp
|
||||
QWebViewImage.cpp
|
||||
QWidgetImage.cpp
|
||||
${SOURCES_H_MOC}
|
||||
${OPENSCENEGRAPH_VERSIONINFO_RC}
|
||||
@@ -48,7 +48,7 @@ IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
STRING(REGEX REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
||||
ENDIF()
|
||||
|
||||
TARGET_LINK_LIBRARIES(${LIB_NAME} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY} ${QT_QTWEBKIT_LIBRARY})
|
||||
TARGET_LINK_LIBRARIES(${LIB_NAME} ${QT_QTCORE_LIBRARY} ${QT_QTGUI_LIBRARY} ${QT_QTOPENGL_LIBRARY})
|
||||
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR} ${QT_QTCORE_INCLUDE_DIR})
|
||||
|
||||
LINK_CORELIB_DEFAULT(${LIB_NAME})
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
|
||||
#include <osgQt/QGraphicsViewAdapter>
|
||||
#include <osgQt/QWidgetImage>
|
||||
#include <osgQt/QWebViewImage>
|
||||
|
||||
#include <QtOpenGL/QGLWidget>
|
||||
|
||||
@@ -310,11 +309,7 @@ bool QGraphicsViewAdapter::handlePointerEvent(int x, int y, int buttonMask)
|
||||
|
||||
if (eventType==QEvent::MouseButtonPress)
|
||||
{
|
||||
QWidgetImage* qwidgetImage = dynamic_cast<QWidgetImage*>(_image.get());
|
||||
if (qwidgetImage) qwidgetImage->focusWidget(true);
|
||||
|
||||
QWebViewImage* qwebViewImage = dynamic_cast<QWebViewImage*>(_image.get());
|
||||
if (qwebViewImage) qwebViewImage->focusBrowser(true);
|
||||
_image->sendFocusHint(true);
|
||||
}
|
||||
|
||||
QMouseEvent event(eventType, QPoint(x, y), qtButton, qtMouseButtons, 0);
|
||||
|
||||
@@ -1,71 +0,0 @@
|
||||
/* -*-c++-*- OpenSceneGraph - Copyright (C) 1998-2009 Robert Osfield
|
||||
*
|
||||
* This library is open source and may be redistributed and/or modified under
|
||||
* the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
|
||||
* (at your option) any later version. The full license is in LICENSE file
|
||||
* included with this distribution, and on the openscenegraph.org website.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* OpenSceneGraph Public License for more details.
|
||||
*/
|
||||
|
||||
#include <osgQt/QWebViewImage>
|
||||
|
||||
namespace osgQt
|
||||
{
|
||||
|
||||
QWebViewImage::QWebViewImage()
|
||||
{
|
||||
// make sure we have a valid QApplication before we start creating widgets.
|
||||
getOrCreateQApplication();
|
||||
|
||||
_webView = new QWebView;
|
||||
|
||||
_webPage = new QWebPage;
|
||||
_webPage->settings()->setAttribute(QWebSettings::JavascriptEnabled, true);
|
||||
_webPage->settings()->setAttribute(QWebSettings::PluginsEnabled, true);
|
||||
|
||||
_webView->setPage(_webPage);
|
||||
|
||||
_adapter = new QGraphicsViewAdapter(this, _webView.data());
|
||||
}
|
||||
|
||||
void QWebViewImage::navigateTo(const std::string& url)
|
||||
{
|
||||
_webView->load(QUrl(url.c_str()));
|
||||
}
|
||||
|
||||
void QWebViewImage::focusBrowser(bool focus)
|
||||
{
|
||||
QFocusEvent event(focus ? QEvent::FocusIn : QEvent::FocusOut, Qt::OtherFocusReason);
|
||||
QCoreApplication::sendEvent(_webPage, &event);
|
||||
}
|
||||
|
||||
void QWebViewImage::clearWriteBuffer()
|
||||
{
|
||||
_adapter->clearWriteBuffer();
|
||||
}
|
||||
|
||||
void QWebViewImage::render()
|
||||
{
|
||||
_adapter->render();
|
||||
}
|
||||
|
||||
void QWebViewImage::setFrameLastRendered(const osg::FrameStamp* frameStamp)
|
||||
{
|
||||
_adapter->setFrameLastRendered(frameStamp);
|
||||
}
|
||||
|
||||
bool QWebViewImage::sendPointerEvent(int x, int y, int buttonMask)
|
||||
{
|
||||
return _adapter->sendPointerEvent(x,y,buttonMask);
|
||||
}
|
||||
|
||||
bool QWebViewImage::sendKeyEvent(int key, bool keyDown)
|
||||
{
|
||||
return QWebViewImage::_adapter->sendKeyEvent(key, keyDown);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -31,10 +31,11 @@ QWidgetImage::QWidgetImage( QWidget* widget )
|
||||
_adapter = new QGraphicsViewAdapter(this, _widget.data());
|
||||
}
|
||||
|
||||
void QWidgetImage::focusWidget(bool focus)
|
||||
bool QWidgetImage::sendFocusHint(bool focus)
|
||||
{
|
||||
QFocusEvent event(focus ? QEvent::FocusIn : QEvent::FocusOut, Qt::OtherFocusReason);
|
||||
QCoreApplication::sendEvent(_widget, &event);
|
||||
return true;
|
||||
}
|
||||
|
||||
void QWidgetImage::clearWriteBuffer()
|
||||
|
||||
Reference in New Issue
Block a user