Created
February 28, 2010 23:08
-
-
Save hjiang/317879 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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