Loop sweeping to avoid stray pixels. Avoided at first hoping there was a cleverer approach. Fortunately sweep is infrequent.
#include <QApplication>
#include "mainform.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MyWindow *mainWin = new MyWindow;
mainWin->show();
return app.exec();
}