I would like to create a car dashboard-like Qt interface (gauges, dials, knobs, etc). My device has a 800x480 LCD powered by a imx287 ARM SoC (armv5te with no hardware float, or GPU).
The problem im having is its very slow. A single gauge (background PNG image, with rotating PNG dial image) drawn at 20fps uses a ~20% CPU time. Adding a single rendered text string increases that up to 40% CPU use.
Im using QGraphicsScene which i uses a lot of floating point calcs... a problem since my SoC has no hardware float ability.
Are there any alternatives to QGraphicsScene that would work well for me?
This is what im currently doing:
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
bg.load("rpm.png");
needle.load("needle.png");
scene = new QGraphicsScene(this);
scene->setSceneRect(0,0, 800,480);
scene->addPixmap(bg);
needleItem = scene->addPixmap(needle);
needleItem->setPos(400-4,17);
textItem = scene->addText(tr(""), QFont("utsaah", 50, QFont::Bold, true));
textItem->setDefaultTextColor(QColor(255,255,255));
textItem->setPos(430, 360);
ui->graphicsView->setScene(scene);
thread = new UpdateDialsThread(this);
connect(thread, SIGNAL(updateDials()), this, SLOT(updateDials()));
thread->start();
}
void MainWindow::updateDials(void)
{
static int deg = 180;
deg += 1;
if (deg > 180+270)
deg = 180;
QTransform trans;
trans.translate(needleItem->boundingRect().width()/2, needleItem->boundingRect().height());
trans.rotate(deg, Qt::ZAxis);
trans.translate(-needleItem->boundingRect().width()/2, -needleItem->boundingRect().height());
needleItem->setTransform(trans);
textItem->setPlainText(tr("%1").arg(deg*10, 4, 'f', 0));
}
Thanks in advance!