PDA

View Full Version : problem with stroking demo.



impeteperry
4th July 2006, 23:31
I'm running Qt4.1.4 in Kubuntu 6.06 distro.

I am trying to learn.......

I setup the "Path Stroking" demo as suggested in the Qpen "more".

when I run "make" after generating the "Makefile" of course, the "arthurwidget.h" is missing error comes up. What do i need?.

thanks.

jacek
4th July 2006, 23:36
You can find working pathstroke demo in $QTDIR/demos/pathstroke. Missing classes are in $QTDIR/demos/shared.

impeteperry
5th July 2006, 13:33
I must be blind.
The demo is beautiful and I like the layout, but it would be much more helpful to someone learning, to have a straight line (or lines ) from point a to point b and show the code for the line type elected.

It takes a lot of time to decipher the code when all you want is the "setPen(......)" code to appliy to the lines in your code. somthing like
QPen pen;
QVector<qreal> dashes;
qreal space = 4;

dashes << 1 << space << 3 << space << 9 << space
<< 27 << space << 9;

pen.setDashPattern(dashes);

in the documentation, but specific to the lines in the demo.

Is there a way to set "dashDot" line that is not dependent on line width?

Thanks

jacek
5th July 2006, 13:44
Is there a way to set "dashDot" line that is not dependent on line width?
Maybe something like this?

pen.setStyle( Qt::DashDotLine );

impeteperry
5th July 2006, 20:56
Maybe something like this?

pen.setStyle( Qt::DashDotLine );
Thanks, I had tried that but spaces too small so I tried this,
QPainter painter( this );

QPen pen(Qt::blue, 0, Qt::DashLine);
painter.setPen(pen);

for( n = 0; n < paintLines.count(); ++n )
{
I want a thin line "0" and the length of the spaces. that a line width of 3 would give me. Now I am aware that QPen doc. has
QPen pen;
QVector<qreal> dashes;
qreal space = 4;

dashes << 1 << space << 3 << space << 9 << space
<< 27 << space << 9;

pen.setDashPattern(dashes);

, but the demo doesn't go into this and in addition we have anothrer widget "QVector" and "qreal" instead of "single" or "double". I assume this will display the same line regardless of screen resolution?.Will Let you know how i make out

thanks,
pete