Advertisement
Guest User

Untitled

a guest
Jul 27th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. /*
  2. // Shows text:
  3. sudo Xorg &
  4. clang++-3.8 -g --std=c++11 -fPIC -Wall
  5. -I /usr/include/x86_64-linux-gnu/qt5/
  6. test1.cpp
  7. -l Qt5Core
  8. -l Qt5Gui
  9. -l Qt5Widgets
  10. -o test1 &&
  11. sudo DISPLAY=:0 HOME=/tmp ./test1
  12. sudo killall Xorg
  13.  
  14. // Does not show text:
  15. clang++-3.8 -g --std=c++11 -fPIC -Wall
  16. -I /usr/include/x86_64-linux-gnu/qt5/
  17. test1.cpp
  18. -l Qt5Core
  19. -l Qt5Gui
  20. -l Qt5Widgets
  21. -o test1 &&
  22. sudo HOME=/tmp ./test1 --platform eglfs
  23.  
  24. */
  25. #include <QtWidgets/QApplication>
  26. #include <QtWidgets/QOpenGLWidget>
  27. #include <QtWidgets/QLabel>
  28. #include <QtWidgets/QTextEdit>
  29. #include <QtWidgets/QPushButton>
  30.  
  31.  
  32. int main(int argc, char *argv[]) {
  33.  
  34. QApplication* app = new QApplication(argc, argv);
  35.  
  36. QOpenGLWidget root_widget;
  37. root_widget.setAutoFillBackground(true);
  38. root_widget.show();
  39.  
  40. QTextEdit text_box1(&root_widget);
  41. text_box1.setPlainText("INITIAL TEXT");
  42. text_box1.setGeometry(0, 0, 500, 50);
  43. text_box1.show();
  44.  
  45. QPushButton button1(&root_widget);
  46. button1.setGeometry(0, 60, 500, 50);
  47. button1.setText("Test1");
  48. button1.show();
  49.  
  50. return app->exec();
  51.  
  52. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement