Hey guys,
my Code:
#include "../header/analyse.h"
#include "ui_analyse.h"
#include <QDebug>
Analyse
::Analyse(QWidget *parent
) : ui(new Ui::Analyse)
{
ui->setupUi(this);
this->ui->graphicsView->setScene(scene);
this
->ui
->graphicsView
->setRenderHint
(QPainter::Antialiasing);
}
Analyse::~Analyse()
{
delete ui;
}
#include "../header/analyse.h"
#include "ui_analyse.h"
#include <QDebug>
Analyse::Analyse(QWidget *parent) :
QWidget(parent),
ui(new Ui::Analyse)
{
ui->setupUi(this);
scene = new QGraphicsScene();
this->ui->graphicsView->setScene(scene);
this->ui->graphicsView->setRenderHint(QPainter::Antialiasing);
}
Analyse::~Analyse()
{
delete ui;
}
To copy to clipboard, switch view to plain text mode
#ifndef ANALYSE_H
#define ANALYSE_H
#include <QWidget>
#include <QPushButton>
#include <QGraphicsLineItem>
#include <QStringList>
namespace Ui {
class Analyse;
}
{
Q_OBJECT
public:
explicit Analyse
(QWidget *parent
= 0);
~Analyse();
private:
Ui::Analyse *ui;
};
#endif // ANALYSE_H
#ifndef ANALYSE_H
#define ANALYSE_H
#include <QWidget>
#include <QPushButton>
#include <QGraphicsLineItem>
#include <QStringList>
namespace Ui {
class Analyse;
}
class Analyse : public QWidget
{
Q_OBJECT
public:
QGraphicsScene *scene;
explicit Analyse(QWidget *parent = 0);
~Analyse();
private:
Ui::Analyse *ui;
};
#endif // ANALYSE_H
To copy to clipboard, switch view to plain text mode
The user can add moveable Items to the scene. I want that you can only move Items through the right border. I got two problems:
The borders one the left, top and bottom site. If you try to move an item through this borders it stops.(colide)
If you move items to the right border of the scene scroll bars should appear. and the scene should extend.
A scene like this :
---------------------------------
|
|
| ->->->->->->->->->->->->->->->->
|
|___________________
I tried a lot of things and looked around. I would be happy if someone can help me.
Greets
Bookmarks