Skip to content

Instantly share code, notes, and snippets.

@sulincix
Created May 29, 2025 18:08
Show Gist options
  • Save sulincix/f19441ff329d4db6efbbf5cb6c3d6025 to your computer and use it in GitHub Desktop.
Save sulincix/f19441ff329d4db6efbbf5cb6c3d6025 to your computer and use it in GitHub Desktop.
Simple qt application that may fix lcd bad pixel
#include <QApplication>
#include <QMainWindow>
#include <QPalette>
#include <QTimer>
/* For compile:
g++ main.cpp -o lcd-fix $(pkg-config --cflags --libs Qt6Widgets Qt6Core Qt6Gui) -fPIC
*/
static QMainWindow *mainWindow;
QColor colors[] = {Qt::red, Qt::green, Qt::blue};
static void changeColor(){
QPalette palette = mainWindow->palette();
palette.setColor(QPalette::Window, colors[rand()%3]);
mainWindow->setPalette(palette);
mainWindow->setAutoFillBackground(true);
}
int main(int argc, char *argv[]) {
QApplication app(argc, argv);
mainWindow = new QMainWindow();
mainWindow->showFullScreen();
QTimer *timer = new QTimer(mainWindow);
mainWindow->connect(timer, &QTimer::timeout, mainWindow, changeColor);
timer->start(1000/60);
return app.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment