QtCanvas::QtCanvas(const std::string& title,
                   const ivec2& size,
                   const Buffers buffers,
                   QWidget* parent, bool shared, Qt::WFlags f, char* /*name*/)
    : GLCanvas(title, size, buffers)
    , QGLWidget(getQGLFormat(buffers), parent, (shared ? shareWidget_ : 0), f)
{
    resize(size.x, size.y);
    if (shared && shareWidget_ == 0)
        shareWidget_ = this;

    setWindowTitle(QString(title.c_str()));

    setFocusPolicy(Qt::StrongFocus);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    // we have our own AutoBufferSwap-mechanism (GLCanvas::setAutoFlush), so disable the one of qt
    setAutoBufferSwap(false);

    rgbaSize_ = ivec4(format().redBufferSize(),
                      format().greenBufferSize(),
                      format().blueBufferSize(),
                      format().alphaBufferSize());
    stencilSize_ = format().stencilBufferSize();
    depthSize_ = format().depthBufferSize();
    doubleBuffered_ = doubleBuffer();
    stereoViewing_ = format().stereo();
}
QGLBlitter::SubWidget::SubWidget(const unsigned swapInterval_in, const bool bf_in, QGLBlitter *parent) :
    QGLWidget(getQGLFormat(swapInterval_in), parent),
    corrected_w(160),
    corrected_h(144),
    textureRes(0x100),
    inWidth(160),
    inHeight(144),
    swapInterval(swapInterval_in),
    clear(2),
    initialized(false),
    bf(bf_in),
    blitted(false)
{
    setAutoBufferSwap(false);
    setMouseTracking(true);
// 	setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Ignored);
}