Ktam3874/pitx software guide – Kontron KTAM3874-pITX User Manual

Page 203

Advertising
background image

KTD-S0057-I

Page 199 Linux® Programming Examples (DebianTM)


KTAM3874/pITX Software Guide


xSlider = createSlider (SIGNAL (xRotationChanged (int)), SLOT (setXRotation (int)));

ySlider = createSlider (SIGNAL (yRotationChanged (int)), SLOT (setYRotation (int)));

zSlider = createSlider (SIGNAL (zRotationChanged (int)), SLOT (setZRotation (int)));

createActions

();

createMenus

();

QGridLayout *centralLayout = new QGridLayout;

centralLayout->addWidget (glWidgetArea, 0, 0);

centralLayout->addWidget

(pixmapLabelArea, 0, 1);

centralLayout->addWidget

(xSlider, 1, 0, 1, 2);

centralLayout->addWidget (ySlider, 2, 0, 1, 2);

centralLayout->addWidget (zSlider, 3, 0, 1, 2);

centralWidget->setLayout

(centralLayout);

xSlider->setValue (15 * 16);

ySlider->setValue (345 * 16);

zSlider->setValue (0 * 16);

setWindowTitle (tr ("Grabber"));

resize (400, 300);

}


void MainWindow::renderIntoPixmap ()
{

QSize size = getSize ();

if (size.isValid ())

{

QPixmap pixmap = glWidget->renderPixmap (size.width (), size.height ());

setPixmap

(pixmap);

}
}


void MainWindow::grabFrameBuffer ()
{

QImage image = glWidget->grabFrameBuffer ();

setPixmap (QPixmap::fromImage (image));

}


void MainWindow::clearPixmap ()
{

setPixmap (QPixmap ());

}


void MainWindow::about ()
{

QMessageBox::about (this, tr ("About Grabber"),

tr ("The <b>Grabber</b> example demonstrates two approaches for rendering OpenGL into a Qt pixmap."));

}

Advertising
This manual is related to the following products: