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();
}
void QOpenGLContextWrapper::setShareContext(QOpenGLContext* otherContext) {
_context->setShareContext(otherContext);
}
bool isCurrentContext(QOpenGLContext* context) {
return QOpenGLContext::currentContext() == context;
}
}

View file

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

View file

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

View file

@ -93,9 +93,12 @@ private:
QQuickItem* asQuickItem() const;
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;
QObject* const _qmlWindow;
};
#endif

View file

@ -26,8 +26,7 @@
#include <QtGui/QResizeEvent>
#include <QtGui/QScreen>
#include <QtGui/QOpenGLContext>
#include <QtGui/QOpenGLDebugLogger>
#include <gl/QOpenGLContextWrapper.h>
#include <QtScript/QScriptEngine>
@ -403,7 +402,6 @@ private:
std::atomic<bool> _isFinished { false };
std::atomic<bool> _isRunning { false };
bool _wantSignals { true };
bool _isThreaded { false };
QHash<QTimer*, QScriptValue> _timerFunctionMap;
};
@ -423,7 +421,7 @@ Q_GUI_EXPORT void qt_gl_set_global_share_context(QOpenGLContext *context);
class QTestWindow : public QWindow {
Q_OBJECT
QOpenGLContext* _context{ nullptr };
QOpenGLContextWrapper* _context{ nullptr };
QSize _size;
bool _altPressed{ false };
RateCounter fps;
@ -450,7 +448,7 @@ public:
setSurfaceType(QSurface::OpenGLSurface);
QSurfaceFormat format = getDefaultOpenGLSurfaceFormat();
setFormat(format);
_context = new QOpenGLContext;
_context = new QOpenGLContextWrapper();
_context->setFormat(format);
_context->setShareContext(_chromiumShareContext->getContext());
}
@ -464,18 +462,6 @@ public:
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;
glewInit();
glGetError();
@ -492,7 +478,7 @@ public:
auto offscreenUi = DependencyManager::set<OffscreenUi>();
{
offscreenUi->create(_context);
offscreenUi->create(_context->getContext());
offscreenUi->setProxyWindow(this);
connect(offscreenUi.data(), &OffscreenUi::textureUpdated, this, [this, offscreenUi](int textureId) {