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

Page 205

Advertising
background image

KTD-S0057-I

Page 201 Linux® Programming Examples (DebianTM)


KTAM3874/pITX Software Guide


void MainWindow::setPixmap (const QPixmap &pixmap)
{
pixmapLabel->setPixmap

(pixmap);

QSize size = pixmap.size ();

if (size - QSize (1, 0) == pixmapLabelArea->maximumViewportSize ())

size -= QSize (1, 0);

pixmapLabel->resize

(size);

}


QSize MainWindow::getSize ()
{
bool

ok;

QString text = QInputDialog::getText (this, tr ("Grabber"), tr ("Enter pixmap size:"),

QLineEdit::Normal, tr ("%1 x %2").arg (glWidget->width ()).arg (glWidget->height ()), &ok);

if (! ok)

return QSize ();

QRegExp regExp (tr ("([0-9]+) *x *([0-9]+)"));

if (regExp.exactMatch (text))

{

int width = regExp.cap (1).toInt ();

int height = regExp.cap (2).toInt ();

if (width > 0 && width < 2048 && height > 0 && height < 2048)

return QSize (width, height);

}

return glWidget->size ();

}

Finally, for a change, the Guide now presents a self-created Qt

TM

sample program which shows a calendar

with date display in plain text and a clock widget with hour/minute display. The graphic surface has been
made with the Qt Designer. If on the Desktop PC the Designer is not already installed use the command line

sudo apt-get install qt4-designer

and then call

designer

. The first variant applies the

Dialog with Buttons Bottom

template. The figure shows

further details (without assignment of a layout).

Advertising
This manual is related to the following products: