Results 1 to 9 of 9

Thread: Line drawing in Designer

  1. #1
    Join Date
    Jan 2006
    Location
    Berkeley California
    Posts
    109
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Line drawing in Designer

    Is there any way to draw a line of arbitrary angle and width in the Designer, or do I have to manually code it?

    In designer there are Horizontal and Vertical lines but seemingly no way to alter their width - is that true?

    Thanks,
    Doug

  2. #2
    Join Date
    Jan 2007
    Posts
    209
    Thanks
    34
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Line drawing in Designer

    You can change their width either with properties or by clicking the resize arrows on the edges...
    Any other way would require you to code QPainter events for your widgets.

  3. #3
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Line drawing in Designer

    This might sound like a really stupid question, but why would you want to use a diagonal line in Designer?

  4. #4
    Join Date
    Jan 2006
    Location
    Berkeley California
    Posts
    109
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Line drawing in Designer

    I have an application where audio can have alternate routings amoung functional block and I need to show the current routing - that's why I'm using horizontal, and other, lines.

    In designer, I can change the resize handles, which changes the line parameters, but the line remains 1 pixel wide in designer, and when the window is run - not the intuitive functionality at all.

    Doug

  5. #5
    Join Date
    Jan 2006
    Location
    Berkeley California
    Posts
    109
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Line drawing in Designer

    I see the problem, Designer is drawing a line by instantiating a QFrame and setting its Style to HLine, so the "Frame" width is ignored. I have to manually add a call to setLineWidth() with a value > 1. So it looks like it's just poor design in Designer.

    Doug

  6. #6
    Join Date
    Mar 2006
    Location
    Mountain View, California
    Posts
    489
    Thanks
    3
    Thanked 74 Times in 54 Posts
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: Line drawing in Designer

    Quote Originally Posted by Doug Broadwell View Post
    So it looks like it's just poor design in Designer.
    Not at all. It's just that you're trying to use Designer for something it is not meant to do. Designer is meant to lay out widgets on a form. What you want to do is draw, but Designer does not do drawing.

  7. #7
    Join Date
    Jan 2006
    Location
    Berkeley California
    Posts
    109
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Line drawing in Designer

    If that is the case, why are there Horizontal Line and Vertical Line widgets in the designer? To my mind, they should either work "correctly" or shouldn't be there.

    %-)

    Just my opinion.

    Doug

  8. #8
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Line drawing in Designer

    Quote Originally Posted by Doug Broadwell View Post
    If that is the case, why are there Horizontal Line and Vertical Line widgets in the designer?
    To make a visual separation between two sections of the form.

    To my mind, they should either work "correctly" or shouldn't be there.
    They work correctly. They just don't do what you'd want them to. Why not just either place a QLabel with a pixmap of a diagonal line or set a background brush with the line? Or use stylesheets...

  9. #9
    Join Date
    Jan 2006
    Location
    Berkeley California
    Posts
    109
    Thanked 1 Time in 1 Post
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Line drawing in Designer

    All good suggestions, and as a beginner all things I need to learn. Thanks.

    I don't mean to disparage the Qt tools, in general I like Qt a lot.

    Doug

Similar Threads

  1. QTextStream : Remove a Line?
    By kaydknight in forum Qt Programming
    Replies: 7
    Last Post: 31st January 2011, 18:15
  2. Line drawing
    By kiranraj in forum Qt Programming
    Replies: 1
    Last Post: 29th January 2007, 06:38
  3. Replies: 13
    Last Post: 15th December 2006, 11:52
  4. QTableView paints too much
    By Jimmy2775 in forum Qt Programming
    Replies: 2
    Last Post: 26th July 2006, 18:42
  5. How to create custom slot in Qt Designer 4.1?
    By jamadagni in forum Qt Tools
    Replies: 31
    Last Post: 18th January 2006, 20:46

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.