Hello all!
I am trying to subclass QGraphicsView, but its crashing the app.
How can I do that.
fluxocaixagraphicsview.h
#ifndef FLUXOCAIXAGRAPHICSVIEW_H
#define FLUXOCAIXAGRAPHICSVIEW_H
#include <QGraphicsView>
#include <QGraphicsScene>
//#include <QGraphicsLineItem>
{
public:
explicit fluxoCaixaGraphicsView
(QWidget *parent
= 0);
~fluxoCaixaGraphicsView();
private:
protected:
};
#endif // FLUXOCAIXAGRAPHICSVIEW_H
#ifndef FLUXOCAIXAGRAPHICSVIEW_H
#define FLUXOCAIXAGRAPHICSVIEW_H
#include <QGraphicsView>
#include <QGraphicsScene>
//#include <QGraphicsLineItem>
class fluxoCaixaGraphicsView : public QGraphicsView
{
public:
explicit fluxoCaixaGraphicsView(QWidget *parent = 0);
~fluxoCaixaGraphicsView();
private:
QGraphicsScene *cenario;
protected:
void showEvent(QShowEvent *event);
void resizeEvent(QResizeEvent *event);
};
#endif // FLUXOCAIXAGRAPHICSVIEW_H
To copy to clipboard, switch view to plain text mode
fluxocaixagraphicsview.cpp
#include "fluxocaixagraphicsview.h"
fluxoCaixaGraphicsView
::fluxoCaixaGraphicsView(QWidget *parent
) :{
}
fluxoCaixaGraphicsView::~fluxoCaixaGraphicsView()
{
}
void fluxoCaixaGraphicsView
::showEvent(QShowEvent *event
) {
}
void fluxoCaixaGraphicsView
::resizeEvent(QResizeEvent *event
) {
}
#include "fluxocaixagraphicsview.h"
fluxoCaixaGraphicsView::fluxoCaixaGraphicsView(QWidget *parent) :
QGraphicsView(parent)
{
QGraphicsScene *cenario = new QGraphicsScene(this);
}
fluxoCaixaGraphicsView::~fluxoCaixaGraphicsView()
{
}
void fluxoCaixaGraphicsView::showEvent(QShowEvent *event)
{
}
void fluxoCaixaGraphicsView::resizeEvent(QResizeEvent *event)
{
}
To copy to clipboard, switch view to plain text mode
calling it
QWidget *MainWindow
::criaEstruturaNovoIvestimento() {
//code here
fluxoCaixaGraphicsView *graphicsViewFluxoCaixa = new fluxoCaixaGraphicsView(boxInvestimento3);
//code here
}
QWidget *MainWindow::criaEstruturaNovoIvestimento()
{
//code here
fluxoCaixaGraphicsView *graphicsViewFluxoCaixa = new fluxoCaixaGraphicsView(boxInvestimento3);
//code here
}
To copy to clipboard, switch view to plain text mode
Thanks a lot
Bookmarks