Results 1 to 6 of 6

Thread: QGraphicsLineItem - selection style

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    May 2008
    Location
    Rijeka, Croatia
    Posts
    85
    Thanks
    10
    Thanked 6 Times in 6 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default QGraphicsLineItem - selection style

    hi,
    i draw a line in QGraphicsScene, which can be selected and moved.
    Qt Code:
    1. MainPlot=new QGraphicsScene(centralWidget());
    2. MainPlot->setSceneRect(0,0,500,500);
    3.  
    4. QPen _Pen;
    5. _Pen.setColor(Qt::red);
    6. _Pen.setWidth(3);
    7.  
    8. QGraphicsLineItem* _Line=new QGraphicsLineItem(100,100,450,300);
    9. _Line->setPen(_Pen);
    10. _Line->setVisible(true);
    11. _Line->setFlags(QGraphicsLineItem::ItemIsSelectable | QGraphicsLineItem::ItemIsMovable);
    12. MainPlot->addItem(_Line);
    13.  
    14. ui.view->setScene(MainPlot);
    15. //ui.view is raphicsView
    To copy to clipboard, switch view to plain text mode 
    But i don't want that when line is selected, a rectangular is drawn (and line is its diagonal). I want line selection like in "diagramscene" example supplied with Qt documantation (thin rectangular paralel with line), or some custom selection style. How to do that? I can't find this in diagramscene source.

    Thanx
    Attached Images Attached Images
    Last edited by stefan; 7th August 2008 at 16:51.

Similar Threads

  1. Mac Style for Qt Application---help needed
    By swamyonline in forum Qt Programming
    Replies: 3
    Last Post: 15th June 2008, 21:49

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
  •  
Qt is a trademark of The Qt Company.