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?
//compile and link with
// g++ main.cpp -o ss -I/usr/include/QtGui -lQtGui
#include <QWidget>
#include <QDesktopWidget>
#include <QApplication>
#include <QPixmap>
#include <QRubberBand>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
QRect SelectionRectangle
(TopLeft, BottomRight
);
outline.setGeometry(SelectionRectangle);
outline.show();
//pause
int a;
cin >> a;
return 0;
}
//compile and link with
// g++ main.cpp -o ss -I/usr/include/QtGui -lQtGui
#include <QWidget>
#include <QDesktopWidget>
#include <QApplication>
#include <QPixmap>
#include <QRubberBand>
#include <iostream>
using namespace std;
int main(int argc, char *argv[])
{
QApplication MyScreenshot(argc,argv);
QPoint TopLeft(100,100);
QPoint BottomRight(200,200);
QRect SelectionRectangle(TopLeft, BottomRight);
QRubberBand outline (QRubberBand::Rectangle);
outline.setGeometry(SelectionRectangle);
outline.show();
//pause
int a;
cin >> a;
return 0;
}
To copy to clipboard, switch view to plain text mode
Thanks!
Dave
Bookmarks