Skip to content

Instantly share code, notes, and snippets.

@hjiang
Created February 28, 2010 23:08
Show Gist options
  • Save hjiang/317879 to your computer and use it in GitHub Desktop.
Save hjiang/317879 to your computer and use it in GitHub Desktop.
#include "onyx/screen_proxy.h"
#include "onyx/sys_status_public.h"
/// Create my own widget.
class MyWidget : public QWidget
{
public:
MyWidget(QWidget *parent = 0) : QWidget(parent) {}
~MyWidget() {}
public:
void refreshScreen()
{
onyx::screen::ScreenProxy::instance().flush(this, onyx::screen::GC);
}
private:
void paintEvent(QPaintEvent *e)
{
QPainter painter(this);
QFont font("", 20, QFont::Normal);
painter.setFont(font);
painter.drawText(rect(), Qt::AlignCenter, tr("Hello World From Onyx."));
}
};
int main(int argc, char* argv[])
{
QApplication app(argc, argv);
// Important to tell system that it’s not busy now, otherwise screen proxy
// would not work.
sys::SysStatus::instance().setSystemBusy(false);
MyWidget main_window;
main_window.show();
// Refresh eInk screen.
main_window.refreshScreen();
return app.exec();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment