Results 1 to 6 of 6

Thread: Can't draw an arc with Qt on a beaglebone

  1. #1
    Join Date
    Oct 2014
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Can't draw an arc with Qt on a beaglebone

    I'm using Qt Creator to design a GUI for an industrial machinery. The beaglebone displays various things based on CAN messages it receives. All was going well until I tried to draw an arc to symbolize the position of some moving equipment.

    Using Qt Creator's UI editor, I've placed a square shaped graphics view in my UI. I gave it a width of 256 and a height of 256 and I named it graphicsPipeView.

    In mainwindow.cpp:

    Qt Code:
    1. PipeScene = new QGraphicsScene;
    2. ui->graphicsPipeView->setScene(PipeScene);
    3. QRectF pipe_rect(0, 0, 250, 250);
    4. QRectF inner_rect(10, 10, 230, 230);
    5. PipeScene->addEllipse(pipe_rect, QPen(QColor(0, 0, 0)), QBrush(QColor(230, 230, 230))); // this draws the circle in the picture
    6. QPainterPath *path = new QPainterPath();
    7.  
    8. path->moveTo(0, 0);
    9. path->lineTo(250, 250); // this draws the NW to SE line - I drew this as a sanity check because I couldn't get the arc to draw
    10. path->moveTo(250, 0);
    11. path->lineTo(0, 250); // this draws the NE to SW line - I also drew this as a sanity check because I couldn't get the arc to draw
    12. path->arcMoveTo(inner_rect, 90);
    13. path->lineTo(125, 125); // this draws the horizontal line, but according to the arcMoveTo command, it should be vertical (at least I think that's what it's supposed to be)
    14. path->closeSubpath();
    15. PipeScene->addPath(*path);
    16. ui->graphicsPipeView->show();
    To copy to clipboard, switch view to plain text mode 

    Here's my problem. I couldn't draw ANY arc at all so I decided to see where or how the code was failing. I came up with the above test. The resulting picture is attached.

    According to the documentation, arcMoveTo(inner_rect, 90) should move the starting point to 12 noon if the drawing was a clock. The lineTo(125, 125) should draw a vertical line. Only problem is the line is horizontal. I can put any number (degrees) in the arcMoveTo() function and the resulting line is always as shown.

    What am I doing wrong? I've tried many iterations of an arcMoveTo() followed by an arcTo() but the result is either a point or a random-angled line.

    Both my Linux laptop and the beaglebone are running Qt version 4.8.1.
    Attached Images Attached Images

  2. #2
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Can't draw an arc with Qt on a beaglebone

    So you are saying it works when the program runs on your laptop but does not work when it runs on the beagleboard?

    Cheers,
    _

  3. #3
    Join Date
    Oct 2014
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Can't draw an arc with Qt on a beaglebone

    Sorry for the confusion. What I meant is that I'm cross-compiling for a beaglebone on my laptop using the Qt Creator suite. I'm not running the program on my laptop. I can't seem to get the arc related functions to work properly.

  4. #4
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Can't draw an arc with Qt on a beaglebone

    Have you tried specifying a rect that actually intersects with the position you are on when you start the arc?

    Cheers,
    _

  5. #5
    Join Date
    Oct 2014
    Posts
    4
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Can't draw an arc with Qt on a beaglebone

    Don't know what you mean. From my reading of the documentation arcMoveTo() sets the starting point of the arc based on an ellipse/circle defined by the rectangle you pass to it, along with the starting angle you specify. From what I've read it doesn't care what position the pen was previously at before you started to draw the arc.

    And yes, I've tried changing the order of the drawing commands. Even if the arcMoveTo() comes first, I get the same result.

  6. #6
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: Can't draw an arc with Qt on a beaglebone

    Hmm.
    My interpretation is that a moveTo needs to be able to follow a patch from the current position to the target position along the geometry specified.

    If the geometry and the current position do not intersect, where would it start?

    But to rule out that this is in fact a necessary pre-condition I suggested to check if it works if the arc's ellipse contains the current position

    Cheers,
    _

Similar Threads

  1. Issue Deploying Qt app to my Beaglebone Black
    By MarkB in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 10th October 2014, 15:33
  2. Problem configuring Qt for BeagleBone Black
    By sask1236 in forum Qt for Embedded and Mobile
    Replies: 0
    Last Post: 7th November 2013, 07:30
  3. Qt creator for Beaglebone black
    By Nagarajan in forum Newbie
    Replies: 0
    Last Post: 24th October 2013, 06:28
  4. Replies: 2
    Last Post: 30th September 2013, 13:18
  5. Configure for Buiding Qt with Beaglebone
    By shindo216 in forum Qt for Embedded and Mobile
    Replies: 1
    Last Post: 5th August 2013, 16:37

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.