#include <QGraphicsView>
{
Q_OBJECT
public:
protected:
};
#include <QGraphicsView>
class MyView: public QGraphicsView
{
Q_OBJECT
public:
MyView(QWidget *parent = 0);
protected:
void drawForeground(QPainter * painter, const QRectF & rect);
};
To copy to clipboard, switch view to plain text mode
#include <QtGui>
#include <QX11Info>
#include "graphics.h"
{
//--- Graphics View Properties
this->resize ( 768, 768 );
this->setStyleSheet("background-image: url(/aegean-120km.png)");
/*
QGraphicsScene scene;
scene.setSceneRect (0,0, 768, 768 );
this->setScene ( &scene );
*/
QBrush brush
(color, Qt
::SolidPattern);
this->setForegroundBrush(brush);
this->show();
}
{
QColor color1
(156,
189,
176,
254);
painter->setPen(Qt::lightGray);
int x,y,w,h,i;
double centre_x=384, centre_y=384;
double step_size=38.5;
for(i=1;i<=20 ;i++)
{
x = centre_x - step_size * i ;
y = centre_y - step_size * i ;
w=h=step_size * i * 2;
painter->drawEllipse(x,y,w,h);
}
}
#include <QtGui>
#include <QX11Info>
#include "graphics.h"
MyView::MyView(QWidget *parent) : QGraphicsView(parent)
{
//--- Graphics View Properties
this->resize ( 768, 768 );
this->setStyleSheet("background-image: url(/aegean-120km.png)");
/*
QGraphicsScene scene;
scene.setSceneRect (0,0, 768, 768 );
this->setScene ( &scene );
*/
QColor color(Qt::yellow);
QBrush brush(color, Qt::SolidPattern);
this->setForegroundBrush(brush);
this->show();
}
void MyView::drawForeground(QPainter * painter, const QRectF & rect)
{
QColor color1(156, 189, 176,254);
painter->setPen(Qt::lightGray);
int x,y,w,h,i;
double centre_x=384, centre_y=384;
double step_size=38.5;
for(i=1;i<=20 ;i++)
{
x = centre_x - step_size * i ;
y = centre_y - step_size * i ;
w=h=step_size * i * 2;
painter->drawEllipse(x,y,w,h);
}
}
To copy to clipboard, switch view to plain text mode
Bookmarks