Results 1 to 4 of 4

Thread: QGraphicsscene and QGraphicsview

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jul 2015
    Posts
    21
    Thanks
    10
    Qt products
    Qt5
    Platforms
    Windows

    Smile QGraphicsscene and QGraphicsview

    Hey guys,
    my Code:
    Qt Code:
    1. #include "../header/analyse.h"
    2. #include "ui_analyse.h"
    3. #include <QDebug>
    4.  
    5. Analyse::Analyse(QWidget *parent) :
    6. QWidget(parent),
    7. ui(new Ui::Analyse)
    8. {
    9.  
    10. ui->setupUi(this);
    11.  
    12. scene = new QGraphicsScene();
    13. this->ui->graphicsView->setScene(scene);
    14. this->ui->graphicsView->setRenderHint(QPainter::Antialiasing);
    15.  
    16. }
    17.  
    18. Analyse::~Analyse()
    19. {
    20. delete ui;
    21. }
    To copy to clipboard, switch view to plain text mode 
    Qt Code:
    1. #ifndef ANALYSE_H
    2. #define ANALYSE_H
    3.  
    4. #include <QWidget>
    5. #include <QPushButton>
    6. #include <QGraphicsLineItem>
    7. #include <QStringList>
    8. namespace Ui {
    9. class Analyse;
    10. }
    11.  
    12. class Analyse : public QWidget
    13. {
    14. Q_OBJECT
    15. public:
    16. explicit Analyse(QWidget *parent = 0);
    17. ~Analyse();
    18. private:
    19. Ui::Analyse *ui;
    20. };
    21. #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
    Last edited by ReasyEasyPeasy; 4th October 2015 at 22:00.

Similar Threads

  1. Replies: 1
    Last Post: 8th September 2012, 05:08
  2. Help with QGraphicsScene
    By justin123 in forum Newbie
    Replies: 2
    Last Post: 3rd June 2010, 00:48
  3. Too Much RAM used by QGraphicsScene
    By grabalon in forum Qt Programming
    Replies: 4
    Last Post: 6th May 2010, 15:38
  4. in QGraphicsScene matrix of other QGraphicsScene
    By Noxxik in forum Qt Programming
    Replies: 5
    Last Post: 15th February 2009, 17:27
  5. Help on QGraphicsScene
    By Sandip in forum Qt Programming
    Replies: 1
    Last Post: 11th April 2008, 14:20

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.