Fixing warnings

This commit is contained in:
Brad Davis 2015-12-18 13:45:07 -08:00
parent 16dd24f3d8
commit 88b88a3306
5 changed files with 23 additions and 23 deletions

View file

@ -39,6 +39,11 @@ void QOpenGLContextWrapper::doneCurrent() {
_context->doneCurrent(); _context->doneCurrent();
} }
void QOpenGLContextWrapper::setShareContext(QOpenGLContext* otherContext) {
_context->setShareContext(otherContext);
}
bool isCurrentContext(QOpenGLContext* context) { bool isCurrentContext(QOpenGLContext* context) {
return QOpenGLContext::currentContext() == context; return QOpenGLContext::currentContext() == context;
} }

View file

@ -25,6 +25,12 @@ public:
void swapBuffers(QSurface* surface); void swapBuffers(QSurface* surface);
bool makeCurrent(QSurface* surface); bool makeCurrent(QSurface* surface);
void doneCurrent(); void doneCurrent();
void setShareContext(QOpenGLContext* otherContext);
QOpenGLContext* getContext() {
return _context;
}
private: private:
QOpenGLContext* _context { nullptr }; QOpenGLContext* _context { nullptr };

View file

@ -110,7 +110,7 @@ QScriptValue QmlWebWindowClass::constructor(QScriptContext* context, QScriptEngi
} }
QmlWebWindowClass::QmlWebWindowClass(QObject* qmlWindow) QmlWebWindowClass::QmlWebWindowClass(QObject* qmlWindow)
: _isToolWindow(false), _windowId(++nextWindowId), _qmlWindow(qmlWindow) : _windowId(++nextWindowId), _qmlWindow(qmlWindow)
{ {
qDebug() << "Created window with ID " << _windowId; qDebug() << "Created window with ID " << _windowId;
Q_ASSERT(_qmlWindow); Q_ASSERT(_qmlWindow);
@ -128,7 +128,7 @@ void QmlWebWindowClass::setVisible(bool visible) {
return; return;
} }
auto qmlWindow = (QQuickItem*)_qmlWindow; auto qmlWindow = asQuickItem();
if (qmlWindow->isEnabled() != visible) { if (qmlWindow->isEnabled() != visible) {
qmlWindow->setEnabled(visible); qmlWindow->setEnabled(visible);
emit visibilityChanged(visible); emit visibilityChanged(visible);

View file

@ -93,9 +93,12 @@ private:
QQuickItem* asQuickItem() const; QQuickItem* asQuickItem() const;
QmlScriptEventBridge* const _eventBridge { new QmlScriptEventBridge(this) }; QmlScriptEventBridge* const _eventBridge { new QmlScriptEventBridge(this) };
const bool _isToolWindow;
QObject* const _qmlWindow; // FIXME needs to be initialized in the ctor once we have support
// for tool window panes in QML
const bool _isToolWindow { false };
const int _windowId; const int _windowId;
QObject* const _qmlWindow;
}; };
#endif #endif

View file

@ -26,8 +26,7 @@
#include <QtGui/QResizeEvent> #include <QtGui/QResizeEvent>
#include <QtGui/QScreen> #include <QtGui/QScreen>
#include <QtGui/QOpenGLContext> #include <gl/QOpenGLContextWrapper.h>
#include <QtGui/QOpenGLDebugLogger>
#include <QtScript/QScriptEngine> #include <QtScript/QScriptEngine>
@ -403,7 +402,6 @@ private:
std::atomic<bool> _isFinished { false }; std::atomic<bool> _isFinished { false };
std::atomic<bool> _isRunning { false }; std::atomic<bool> _isRunning { false };
bool _wantSignals { true }; bool _wantSignals { true };
bool _isThreaded { false };
QHash<QTimer*, QScriptValue> _timerFunctionMap; QHash<QTimer*, QScriptValue> _timerFunctionMap;
}; };
@ -423,7 +421,7 @@ Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
class QTestWindow : public QWindow { class QTestWindow : public QWindow {
Q_OBJECT Q_OBJECT
QOpenGLContext* _context{ nullptr }; QOpenGLContextWrapper* _context{ nullptr };
QSize _size; QSize _size;
bool _altPressed{ false }; bool _altPressed{ false };
RateCounter fps; RateCounter fps;
@ -450,7 +448,7 @@ public:
setSurfaceType(QSurface::OpenGLSurface); setSurfaceType(QSurface::OpenGLSurface);
QSurfaceFormat format = getDefaultOpenGLSurfaceFormat(); QSurfaceFormat format = getDefaultOpenGLSurfaceFormat();
setFormat(format); setFormat(format);
_context = new QOpenGLContext; _context = new QOpenGLContextWrapper();
_context->setFormat(format); _context->setFormat(format);
_context->setShareContext(_chromiumShareContext->getContext()); _context->setShareContext(_chromiumShareContext->getContext());
} }
@ -464,18 +462,6 @@ public:
makeCurrent(); makeCurrent();
{
qDebug() << (const char*)glGetString(GL_VERSION);
QOpenGLDebugLogger* logger = new QOpenGLDebugLogger(this);
logger->initialize(); // initializes in the current context, i.e. ctx
logger->enableMessages();
connect(logger, &QOpenGLDebugLogger::messageLogged, this, [&](const QOpenGLDebugMessage & debugMessage) {
qDebug() << debugMessage;
});
//logger->startLogging(QOpenGLDebugLogger::SynchronousLogging);
}
glewExperimental = true; glewExperimental = true;
glewInit(); glewInit();
glGetError(); glGetError();
@ -492,7 +478,7 @@ public:
auto offscreenUi = DependencyManager::set<OffscreenUi>(); auto offscreenUi = DependencyManager::set<OffscreenUi>();
{ {
offscreenUi->create(_context); offscreenUi->create(_context->getContext());
offscreenUi->setProxyWindow(this); offscreenUi->setProxyWindow(this);
connect(offscreenUi.data(), &OffscreenUi::textureUpdated, this, [this, offscreenUi](int textureId) { connect(offscreenUi.data(), &OffscreenUi::textureUpdated, this, [this, offscreenUi](int textureId) {