Clearly this is not useful, i need to do this on mouse events, but as a demo I thought I would just draw a static rectangle. Surprisingly I see no rectangle! Where have I gone wrong?
Qt Code:
  1. //compile and link with
  2. // g++ main.cpp -o ss -I/usr/include/QtGui -lQtGui
  3.  
  4. #include <QWidget>
  5. #include <QDesktopWidget>
  6. #include <QApplication>
  7. #include <QPixmap>
  8. #include <QRubberBand>
  9. #include <iostream>
  10.  
  11. using namespace std;
  12.  
  13. int main(int argc, char *argv[])
  14. {
  15. QApplication MyScreenshot(argc,argv);
  16.  
  17. QPoint TopLeft(100,100);
  18. QPoint BottomRight(200,200);
  19. QRect SelectionRectangle(TopLeft, BottomRight);
  20.  
  21. QRubberBand outline (QRubberBand::Rectangle);
  22. outline.setGeometry(SelectionRectangle);
  23. outline.show();
  24.  
  25. //pause
  26. int a;
  27. cin >> a;
  28.  
  29. return 0;
  30. }
To copy to clipboard, switch view to plain text mode 

Thanks!
Dave