WebView::WebView(QWidget *parent) : QWebView(parent) , m_page(new WebPage(this)) { setPage(m_page); page()->setLinkDelegationPolicy(QWebPage::DelegateAllLinks); connect( m_page->mainFrame() , SIGNAL(javaScriptWindowObjectCleared()), this, SLOT(attachObject()) ); connect(this,SIGNAL(loadFinished(bool)),this,SLOT(loadFinished(bool))); connect(this,SIGNAL(selectionChanged()),this,SLOT(doNothing())); connect(this,SIGNAL(urlChanged(QUrl)),this,SLOT(urlChanged(QUrl))); enableSettings(); attachObject(); //setContextMenuPolicy(Qt::PreventContextMenu); }
GLFWwindow* initWindow() { //Initialize GLFW glfwInit(); //Setup the window properties, to use OpenGL 3.3 and restrain it to the core profile glfwWindowHint(GLFW_CONTEXT_VERSION_MAJOR, 3); glfwWindowHint(GLFW_CONTEXT_VERSION_MINOR, 3); glfwWindowHint(GLFW_OPENGL_PROFILE, GLFW_OPENGL_CORE_PROFILE); glfwWindowHint(GLFW_OPENGL_FORWARD_COMPAT, GL_TRUE); glfwWindowHint(GLFW_SAMPLES, 16); //Create the window GLFWwindow* window = glfwCreateWindow(800, 600, "Learn OpenGL", nullptr, nullptr); if (window == nullptr) { std::cout << "Unable to create window." << std::endl; glfwTerminate(); return nullptr; } glfwMakeContextCurrent(window); //More window options glfwWindowHint(GLFW_RESIZABLE, GL_FALSE); glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); glfwSetWindowPos(window, 500, 100); //Setup all the callback functions glfwSetKeyCallback(window, keyboard); glfwSetCursorPosCallback(window, mouse); glfwSetMouseButtonCallback(window, mouseButtons); glfwSetScrollCallback(window, scroll); //Initialize GLEW and make sure glewExperimental is true for OpenGL 3.3 glewExperimental = GL_TRUE; if (glewInit() != GLEW_OK) { std::cout << "Failed to initialize GLEW." << std::endl; return nullptr; } enableSettings(); /*glCullFace(GL_BACK); glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ONE, GL_ZERO);*/ glDepthFunc(GL_LEQUAL); return window; }