Skip to content

Instantly share code, notes, and snippets.

@tru
Created October 7, 2014 09:30
Show Gist options
  • Select an option

  • Save tru/d8634374905cd8a584fa to your computer and use it in GitHub Desktop.

Select an option

Save tru/d8634374905cd8a584fa to your computer and use it in GitHub Desktop.
#include "mainwindow.h"
#include <QWebEngineView>
#include <QGLWidget>
#include <QStackedWidget>
#include <QShortcut>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setMinimumSize(1280, 720);
m_stack = new QStackedWidget(this);
setCentralWidget(m_stack);
m_web = new QWebEngineView(this);
m_web->setUrl(QUrl("http://www.google.com"));
m_web->setAccessibleName("web");
m_stack->addWidget(m_web);
// m_glWidget = new QGLWidget(this);
// m_glWidget->setAttribute(Qt::WA_NativeWindow);
// m_stack->addWidget(m_glWidget);
QShortcut* shortcut = new QShortcut(QKeySequence("Ctrl+R"), this);
connect(shortcut, SIGNAL(activated()), this, SLOT(switchView()));
}
void MainWindow::switchView()
{
m_stack->setCurrentIndex(m_stack->currentIndex() ? 0 : 1);
}
MainWindow::~MainWindow()
{
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment