PDA

View Full Version : Line drawing in Designer



Doug Broadwell
27th March 2007, 02:59
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

VireX
27th March 2007, 03:24
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.

wysota
27th March 2007, 09:01
This might sound like a really stupid question, but why would you want to use a diagonal line in Designer?

Doug Broadwell
27th March 2007, 18:06
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

Doug Broadwell
27th March 2007, 18:24
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

Brandybuck
27th March 2007, 19:18
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.

Doug Broadwell
27th March 2007, 19:26
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

wysota
27th March 2007, 20:25
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...

Doug Broadwell
28th March 2007, 01:02
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