Results 1 to 2 of 2

Thread: QGraphicsView selection problem when there is large scale factor in view (Linux)

  1. #1
    Join Date
    Aug 2010
    Posts
    18
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QGraphicsView selection problem when there is large scale factor in view (Linux)

    Greetings,
    I would like to show QGraphicsScene. The scene bounding rectangle is (0,0,1,1). The problem is that then the selection of items on linux doesn't work correctly. On Windows there are no problems.
    To better explain this I have created simple application with QGraphicsView of dimensions (500,500) in a simple QMainWindow:
    Qt Code:
    1. MainWindow::MainWindow(QWidget *parent) :
    2. QMainWindow(parent),
    3. ui(new Ui::MainWindow)
    4. {
    5. ui->setupUi(this);
    6. scena=new QGraphicsScene();
    7. ui->graphicsView->setScene(scena);
    8. ui->graphicsView->scale(500,500);
    9. it->setRect(-0.1,-0.1,0.2,0.2);
    10. it->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
    11. scena->addItem(it);
    12. }
    To copy to clipboard, switch view to plain text mode 

    Is there some bug in linux version of qt? I have qt 4.7.

    Thank you,
    MadBear

  2. #2
    Join Date
    Mar 2010
    Location
    Brazil
    Posts
    39
    Thanks
    2
    Thanked 1 Time in 1 Post
    Qt products
    Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: QGraphicsView selection problem when there is large scale factor in view (Linux)

    I tried this code, and works fine:

    Qt Code:
    1. ui->graphicsView->setScene(scena);
    2. ui->graphicsView->scale(500,500);
    3. it->setRect(-0.1,-0.1,0.2,0.2);
    4. it->setFlags(QGraphicsItem::ItemIsMovable | QGraphicsItem::ItemIsSelectable);
    5. scena->addItem(it);
    To copy to clipboard, switch view to plain text mode 

Similar Threads

  1. Replies: 2
    Last Post: 31st January 2010, 02:53
  2. Large fonts on Linux and Solaris
    By doggrant in forum Qt Programming
    Replies: 3
    Last Post: 16th October 2009, 15:14
  3. QGraphicsView: determining the current scale factor
    By chezifresh in forum Qt Programming
    Replies: 7
    Last Post: 28th April 2009, 07:14
  4. World View Zooming factor
    By Pharell in forum General Programming
    Replies: 0
    Last Post: 6th November 2008, 13:04
  5. Replies: 1
    Last Post: 1st June 2008, 11:04

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.