Hey all. Been a while since I've posted here, but I'm a bit stumped and I couldn't find any real good QT forums that are actually active.
I've inherited some QT code which creates widgets for displaying various aircraft cockpit instruments. Unfortunately, it's a bit of a processor hog. I need to get this to not take up so much CPU, as there's potential for 40+ instances of this dialog to be active at a time(crazy, but that's part of the requirements). The following is a piece of the compass widget. I've pulled out enough so that it's still very slow(in my opinion) for what it's actually doing, and somebody with a decent amount of QT experience might see something obviously bad here.
This is my paintEvent for the widget in question. It only gets updated every 400ms, yet is using between 6% and 10% of my CPU power(as seen in Task Manager, so that number may be off a bit). This is just one part of the compass, and the compass is one of about 15 widgets that I have to display. That means when everything is up and running my CPU is pretty much always above 50%.
The shape of the aircraft doesn't particularly matter, so any polygon would work for example purposes.
void Compass::paintEvent(QPaintEvent *pEvent)
painter.setWindow(-50, -50, 100, 100);
painter.setRenderHints(QPainter::Antialiasing | QPainter::TextAntialiasing);
//Draw compass background
painter.drawEllipse(-48, -48, 96, 96);
//Pulled from the DrawAircraft function
QColor clrAircraft(0xEE, 0xEE, 0xEE);
QPen penAircraft(clrAircraft, 1);
painter.setWindow(-60, -60, 120, 120);
if (m_bolHasSensor && m_bolIsSensorFixed)
painter.rotate(m_dblPlatformHeading - m_dblSensorHeading);
painter.drawLine(0, -32, 0, -42);
//End DrawAircraft function
//Draw outer rim
painter.setPen (QPen (Qt::black, 2));
painter.drawEllipse(-41, -41, 82, 82);
Is there something obviously wrong here?