Peter Leopold | 23 Apr 22:33

still no luck print/saving pdfs of qwtPlotMarkers

Has anyone had success labeling QwtPlots with QwtPlotMarkers, then exporting the
plots to pdf or a printer?

If so, do you create std::vector<QwtPlotMarker> to hold the markers?
QList<QwtPlotMarker>? Dynamically allocated arrays, viz., 

QwtPlotMarker *markerArray = 0;
try{markerArray = new QwtPlotMarker [numberToBeUsed];}
catch(...){return MEMORY_ALLOCATION_ERROR;}

I'll expect that whatever you do, your collection of QwtPlotMarkers is a class
attribute, since anything else would be crazy.

Uwe suggested that I try to compile the entire source of Qwt into my own app. I
will try this in the next few days, but since my compilation environment
(basically just qmake -project ; qmake ; make) is not compatible with the
elegant, non-local architecture of the qwt project files, and I would (and
could) break a lot to make it work. Indeed, getting qwt to compile outside its
tidy architecture will be a do-able, but nontrivial, project.

However, since the QwtPlotMarkers appear on the screen AOK, the problem is not
likely to be in QwtPlotMarker class, but the pdf class. Or in my own code, but
my code passes valgrind review for memory management, etc., so there is probably
a subtle problem with passing contents to the print engine. Surely someone else
has seen this.

As the project I'm working on is ready to go out the door, I've written release
notes to the effect that QwtPlotMarkers don't print. Alas, the markers are a big
part of the value of the project, so I'm as motivated as ever to solve this.

(Continue reading)

Joey Mukherjee | 23 Apr 23:37

Re: still no luck print/saving pdfs of qwtPlotMarkers

On Apr 23, 2008, at 3:34 PM, Peter Leopold wrote:

> Has anyone had success labeling QwtPlots with QwtPlotMarkers, then  
> exporting the
> plots to pdf or a printer?
>
> Also, if QwtPlotMarkers are unprintable, does anyone have a  
> suggestion for
> another way to annotate QwtPlots?

I have no problems plotting markers, all I do is marker->attach  
(_qwtplot) and everything just sort of works.  I don't hold them  
separately either.   Doesn't QwtPlot save them anyway?
Attachment (markers.pdf): application/pdf, 12 KiB
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest
Peter Leopold | 23 Apr 23:58

Re: still no luck print/saving pdfs of qwtPlotMarkers

Joey Mukherjee <joey <at> swri.edu> writes:

> 
> I have no problems plotting markers, all I do is marker->attach  
> (_qwtplot) and everything just sort of works.  I don't hold them  
> separately either.   Doesn't QwtPlot save them anyway?

I'm not sure about the QwtPlot internals. I suppose we could just look it up in
the source. It would certainly be nice if I didn't have to juggle memory
management for all of the plot attributes within my application, but I do just
to avoid the sort of situation I'm in.

To confirm, you are able to *print* the markers, and export them to pdf? And
they are still there? I can see the markers OK, and screen capture them, but
they blow off the page on the way to the printer or a pdf file.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Peter Leopold | 26 Apr 16:14

How do you attach documents to posts in this forum?

Joey Mukherjee <joey <at> swri.edu> writes:

> 
> On Apr 23, 2008, at 3:34 PM, Peter Leopold wrote:
> 
> > Has anyone had success labeling QwtPlots with QwtPlotMarkers, then  
> > exporting the
> > plots to pdf or a printer?
> >
> > Also, if QwtPlotMarkers are unprintable, does anyone have a  
> > suggestion for
> > another way to annotate QwtPlots?
> 
> I have no problems plotting markers, all I do is marker->attach  
> (_qwtplot) and everything just sort of works.  I don't hold them  
> separately either.   Doesn't QwtPlot save them anyway?
> Attachment (markers.pdf): application/pdf, 12 KiB

So how do attachments work on this newsgroup? I am unable to find the
attachment option in the web post editor. I am using IE 7.0.5730.13 
on Windows XP right now and have used Firefox 2.0.0.14 on WindowsXP 
and Firefox 2.0.0.13 on Kubuntu/GutsyGibbon. The various
help options provided by GMANE do not describe attachments. 

Yet, Joey could do it. What's the trick?

Peter

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
(Continue reading)

Joey Mukherjee | 26 Apr 16:38

Re: How do you attach documents to posts in this forum?

I was using my Mac mail client and I was subscribed to the list normally, rather than reading the list from gmane or what not.  You could get a web email account and subscribe to the list that way if you want to use the browser. 

Anyway, glad you got it solved!  I know how frustrating that can be....  :-)

On Sat, Apr 26, 2008 at 9:14 AM, Peter Leopold <Peter.Leopold <at> bioanalyte.com> wrote:
Joey Mukherjee <joey <at> swri.edu> writes:

>
> On Apr 23, 2008, at 3:34 PM, Peter Leopold wrote:
>
> > Has anyone had success labeling QwtPlots with QwtPlotMarkers, then
> > exporting the
> > plots to pdf or a printer?
> >
> > Also, if QwtPlotMarkers are unprintable, does anyone have a
> > suggestion for
> > another way to annotate QwtPlots?
>
> I have no problems plotting markers, all I do is marker->attach
> (_qwtplot) and everything just sort of works.  I don't hold them
> separately either.   Doesn't QwtPlot save them anyway?
> Attachment (markers.pdf): application/pdf, 12 KiB

So how do attachments work on this newsgroup? I am unable to find the
attachment option in the web post editor. I am using IE 7.0.5730.13
on Windows XP right now and have used Firefox 2.0.0.14 on WindowsXP
and Firefox 2.0.0.13 on Kubuntu/GutsyGibbon. The various
help options provided by GMANE do not describe attachments.

Yet, Joey could do it. What's the trick?

Peter


-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Don't miss this year's exciting event. There's still time to save $100.
Use priority code J8TL2D2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest
Peter Leopold | 26 Apr 17:33

Q: How do you attach documents to posts in this forum? A: Mail client

Joey Mukherjee wrote:
> I was using my Mac mail client and I was subscribed to the list 
> normally, rather than reading the list from gmane or what not.  You 
> could get a web email account and subscribe to the list that way if you 
> want to use the browser. 
> 

Thanks, Joey.  Thunderbird to the attachment rescue.

 > Anyway, glad you got it solved!  I know how frustrating that can 
be....  :-)

Alas, the QwtPlotMarkers->pdf problem persists. Everything prints
except the labels. Uwe has helped narrow down the problem quite a bit.

Stay tuned for a solution or a work-around.

Peter

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Uwe Rathmann | 24 Apr 07:07

Re: still no luck print/saving pdfs of qwtPlotMarkers

On Wednesday 23 April 2008 22:34, Peter Leopold wrote:

> Has anyone had success labeling QwtPlots with QwtPlotMarkers, then
> exporting the plots to pdf or a printer?

Yes, f.e the bode example does it.

> If so, do you create std::vector<QwtPlotMarker> to hold the markers?
> QList<QwtPlotMarker>? Dynamically allocated arrays, viz.,

No, why should I ?

> Uwe suggested that I try to compile the entire source of Qwt into my own
> app. 

No, all I asked you is to try a few simple things to identify the source of 
the problem. Obviously you did none of them, instead you reposted the same 
problem without any new informations.

> I will try this in the next few days, but since my compilation 
> environment (basically just qmake -project ; qmake ; make) is not
> compatible with the elegant, non-local architecture of the qwt project
> files, and I would (and could) break a lot to make it work. 

On Linux ( with shared libraries ) with Qwt 5.0.2:

- Build Qwt as it is in debug mode somewhere and don't install it.
- export LD_LIBRARY_PATH=/your/path/to/qwt-5.0.2/lib:$LD_LIBRARY_PATH

Try "ldd /your/path/to/your/application" to be sure, that it uses your local 
Qwt build. If true start your application. Nothing will be broken, believe 
me.

Uwe

PS:

Only if you are using static libraries you need to rebuild your application. 
Then you need to replace the paths to Qwt temporarily in your project file:

INCLUDEPATH += /your/path/to/qwt-5.0.2/src
LIBS        += -L/your/path/ro/qwt-5.0.2/lib -lqwt

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Peter Leopold | 24 Apr 15:43

some new information (with code) on the nonprinting qwtplotmarker problem

Uwe Rathmann <Uwe.Rathmann <at> tigertal.de> writes:

> 
> On Wednesday 23 April 2008 22:34, Peter Leopold wrote:
> 
> > Has anyone had success labeling QwtPlots with QwtPlotMarkers, then
> > exporting the plots to pdf or a printer?
> 
> Yes, f.e the bode example does it.
> 
> > If so, do you create std::vector<QwtPlotMarker> to hold the markers?
> > QList<QwtPlotMarker>? Dynamically allocated arrays, viz.,
> 
> No, why should I ?
> 

Thanks Uwe. Points taken! A new day brings new energy to this mini-project. 
Here
is more information:

1) My plotmarkers are alphanumeric strings "A1" "G3" etc. They show up on the
screen, but not in the pdf file or in the printer.

2) I tried printing to PostScriptFormat. Same problem. Here is the code.

void printPlotToFile(
		QwtPlot *qwtplot
		,QString filename
	){
  QPrinter qp;
#if(0)
  filename += ".pdf";
  qp.setOutputFormat(QPrinter::PdfFormat);
#else
  filename += ".ps";
  qp.setOutputFormat(QPrinter::PostScriptFormat);
#endif
  qp.setOutputFileName(filename);
  qp.setOrientation(QPrinter::Landscape);
  qp.setResolution(300);//dpi
  QwtPlotPrintFilter ppf;
  ppf.setOptions(QwtPlotPrintFilter::PrintAll);
  ppf.color(Qt::red,QwtPlotPrintFilter::Marker);
  qwtplot->replot();
  qwtplot->print(qp,ppf);
}

3) Things I know don't matter: qp.setResolution(),
QwtPlotPrintFilter.setOptions() and .color(). Postscript vs. pdf.
setOrientation(); replot();

4) I looked at both the pdf file and the postscript file in emacs looking 
for my alphanumeric markers "A1" etc. They weren't there, but then most 
of the file was encoded, anyway, so literals character strings were 
probably also encoded.

5) I loaded the .ps file into PhotoShop and got a clue in the form of an 
error message from PhotoShop. "This file uses one or more fonts which are 
unavailable on this machine." (Note that fonts for title, subtitle and 
legend are supported and print fine.)

6) So I set font explicitly where the QwtPlotMarkers are created

int annotatePlot(){
  if(markerTIC!=0)delete [] markerTIC;markerTIC=0;
  try{markerTIC = new QwtPlotMarker [part.size()];}// 'part' is an std::vector
  catch(...){return MEMORY_ALLOCATION_ERROR;}
  QFont qf("Helvetica", 12);
  QwtText qtxt;
  qtxt.setFont(qf);
  for(unsigned int i=0;i<part.size();i++){
    qtxt.setText(part[i].vial); // part[i].vial is a QString
    markerTIC[i].setLabel(qtxt);
    markerTIC[i].setValue(part[i].midpoint,LabelOffset+part[i].height);
    markerTIC[i].attach(qwtPlotTIC); //what happens to memory 
                                     //profile in attach)? I don't know
  } 
  return OK;
}

Helvetica is also described as an unsupported font by PhotoShop!?!?! 
That's very strange.

So this is where I stand now.

Next steps
1) The next step is to try to try to extract the markerTIC array from 
qwtPlotTIC to prove that it is still there. It is certainly still there 
in my own memory space. I don't destruct my copy (the only copy?) of 
the QwtPlotMarker array until I do a general memory cleanup. 

2) Assuming qwtPlot still has its qwtPlotMarkers, I will then chase the 
problem down the rabbit hole called qwtPlot->print(). For this, I will 
follow Uwe's advice to compile a debug version of qwt.

Everything is being done in qwt5.0.2, with mingw on Windows and g++ on 
Linux. While this may yet be a Microsoft printer driver interface issue, 
it is not a Microsoft development environment issue.

I can't see any way to finesse this problem.

I can attach the screen shot and the pdf to make the point of the 
missing alphanumerics. (First I have to figure out how to attach 
files in this user forum.)

Peter

> > Uwe suggested that I try to compile the entire source of Qwt into my own
> > app. 
> 
> No, all I asked you is to try a few simple things to identify the source of 
> the problem. Obviously you did none of them, instead you reposted the same 
> problem without any new informations.
> 
> > I will try this in the next few days, but since my compilation 
> > environment (basically just qmake -project ; qmake ; make) is not
> > compatible with the elegant, non-local architecture of the qwt project
> > files, and I would (and could) break a lot to make it work. 
> 
> On Linux ( with shared libraries ) with Qwt 5.0.2:
> 
> - Build Qwt as it is in debug mode somewhere and don't install it.
> - export LD_LIBRARY_PATH=/your/path/to/qwt-5.0.2/lib:$LD_LIBRARY_PATH
> 
> Try "ldd /your/path/to/your/application" to be sure, that it uses your local 
> Qwt build. If true start your application. Nothing will be broken, believe 
> me.
> 
> Uwe
> 
> PS:
> 
> Only if you are using static libraries you need to rebuild your application. 
> Then you need to replace the paths to Qwt temporarily in your project file:
> 
> INCLUDEPATH += /your/path/to/qwt-5.0.2/src
> LIBS        += -L/your/path/ro/qwt-5.0.2/lib -lqwt
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
> 

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Peter Leopold | 24 Apr 16:11

Re: still no luck print/saving pdfs of qwtPlotMarkers

Uwe Rathmann <Uwe.Rathmann <at> tigertal.de> writes:

> 
> On Wednesday 23 April 2008 22:34, Peter Leopold wrote:
> 
> > Has anyone had success labeling QwtPlots with QwtPlotMarkers, then
> > exporting the plots to pdf or a printer?
> 
> Yes, f.e the bode example does it.
> 
> > If so, do you create std::vector<QwtPlotMarker> to hold the markers?
> > QList<QwtPlotMarker>? Dynamically allocated arrays, viz.,
> 
> No, why should I ?

OK, I can't see how to upload the screen capture figure and pdf. That's another
project I don't quite have time for.) However, since two pictures are worth two
thousand words, I've put both figures (screen capture of QwtPlot with
QwtPlotMarkers and screen capture of pdf file without QwtPlotMarkers) on my
personal wiki site: http://www.cascokid.com  .

Remember: valgrind says I've go no memory leaks, and I'm not destructing my copy
of the plot markers before the qwtPlot->print(QPrinter qp) statement. I haven't
deleted my own markers by mistake or otherwise. Something happens inside the
qwtPlot->print() rabbit hole.

Peter

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Peter Leopold | 24 Apr 17:42

Could plotmarkers disappear when QwtPlotDict::autoDelete=true? No!

Uwe Rathmann <Uwe.Rathmann <at> tigertal.de> writes:

> 
> On Wednesday 23 April 2008 22:34, Peter Leopold wrote:
> 
> > Has anyone had success labeling QwtPlots with QwtPlotMarkers, then
> > exporting the plots to pdf or a printer?
> 
> Yes, f.e the bode example does it.
> 
> > If so, do you create std::vector<QwtPlotMarker> to hold the markers?
> > QList<QwtPlotMarker>? Dynamically allocated arrays, viz.,
> 
> No, why should I ?
> 

The heartbreaking thing is that this "total failure" is probably trivial, 
but to discover the trivial, I'll have to map out a big part of the 
subterranean rabbit warren concerning how Qwt does what it does. Joey's 
question "Doesn't QwtPlot save plotmarkers?" is an indication that I'm 
not alone in wondering how memory is managed, and how 
QwtPlotDict::PrivateData might be automatically deleted.

So, I'm not so much reading qwt_plot.h, qwt_plot_dict.h qwt_plot_print.cpp, 
etc., as I am trying to find words and patterns of words that correlate 
to the deletion of the plotmarkers during printing. 

For example, QwtPlot uses the base class QwtPlotDict, which has the 
constructor

QwtPlotDict::QwtPlotDict()
{
    d_data = new QwtPlotDict::PrivateData;
    d_data->autoDelete = true;
}

autoDelete = true !?!?!?

So it turns out that autoDelete is checked in the destructor, 
so it is likely not to be the problem, but since auto deletion 
is the observed problem, I give it a go:

qwtPlot->setAutoDelete(false);
qwtPlot->print(QPrinter,QPrintFilter)
qwtPlot->setAutoDelete(true);

Nope. Problem still there.

In an earlier email, Uwe wrote

> a) What happens if you print postscript instead of PDF ?

No markers, as described earlier today.

> b) Remove all other items from your plot and disable title, legend and axes. 
Now look with an editor into the PDF ( or postscript ) file. Can you find 
your markers there ?

That's next.

> c) Use the debugger and step through the Qwt code to be sure, that the marker 
is painted with useful parameters. Otherwise you might waste a lot of time.

Yes, potential for large waste of time is quite real.

I use gdb to find where segementation faults occur, but my preferred 
method of debugging is to write diagnostic print statements.

std::cerr<<"x="<<x<<std::endl;

which I will do inside qwt_plot_print.cpp and friends, remake the library.
To see what's actually in there I'll write a 
getPrivateData() function to see if the markers are still attached.

Since I'm working largely blind, any other hints would be much appreciated.

Peter

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Peter Leopold | 25 Apr 16:09

qwtPlot->itemList()->size() shows plotMarkers are still there after printing

Peter Leopold <Peter.Leopold <at> BioAnalyte.com> writes:

> 
> Uwe Rathmann <Uwe.Rathmann <at> tigertal.de> writes:
> 
> > 
> > On Wednesday 23 April 2008 22:34, Peter Leopold wrote:
> > 
> > > Has anyone had success labeling QwtPlots with QwtPlotMarkers, then
> > > exporting the plots to pdf or a printer?
> > 
> > Yes, f.e the bode example does it.
> > 
> > > If so, do you create std::vector<QwtPlotMarker> to hold the markers?
> > > QList<QwtPlotMarker>? Dynamically allocated arrays, viz.,
> > 
> > No, why should I ?
> > 

If I remove all decorations (titles, axes, legends, data) 
from the plot except the plotmarkers, then 
nothing is plotted on the screen, not even the plot markers. This is 
due to the fact that the default plot has coordinates 1000 x 1000, 
and my plotmarkers are located outside the box. If I change to locations
of the plot markers to points inside the 1000x1000 coordinate box, they
appear OK, or if I plot the curve 
with the highest y values (there are five) then the plotmarkers do 
appear on the screen. In any event, all screen-visible markers disappear 
when printing or saving as pdf, just as before. Poof. Gone.

I am trying to plot 192 plotmarkers. When I plot only 1, it appears on the
screen, but disappears in the pdf. There is no apparent dependence on the
number of markers being plotted.

Using QwtPlotItem::itemList(), I confirm that all items are present
before printing and after printing. Indeed, they are still on the screen.

I've read both pdf and ps files with emacs. pdf and ps files are partly 
ascii/human readable, but displayabe data are encoded/unreadable.

OK, I'm trying to be sensible here. Since plotmarkers plot predictably 
on the screen, but fail to print, I should concentrate on the print
mechanism, not on QwtPlotItem or on QwtPlotDict. Does everyone (anyone?) 
agree?

The problem is solely in the handling of qwtPlot objects within the 
printing context. I've proved that nothing is shearing the 
QwtPlotDict::PrivateData. But is there something that is setting font 
size to zero (strange) or is setting the font to null (strange), 
or is changing the color to background (probably not). What could it be?

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Peter Leopold | 25 Apr 17:16

Re: Could plotmarkers disappear when QwtPlotDict::autoDelete=true? No!


I can demonstrate that the following line in drawItem is being 
called once for every QwtPrintMarker inside QwtPlot::drawItems()

item->draw(
            painter, 
            map[item->xAxis()], 
            map[item->yAxis()],
            rect
           );

My diagnostic print statement just before this shows that all
QwtPlotMarkers are called with global plot coordinate values.

When I am printing to the screen, the values are

item->xAxis()=2 item->yAxis()=0
rect.x1,y1=2,2
rect.x2,y2=844,582

but when I'm printing to a file, the values are

item->xAxis()=2 item->yAxis()=0
rect.x1,y1=62,0
rect.x2,y2=991,726

Is this significant?

Should I see what's happening inside QwtScaleMap map[]?

Should I direct my attention to the internals of painter, 
where the fonts may be corrupted?

It is dark down here in the rabbit warren.

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Uwe Rathmann | 25 Apr 18:47

Re: Could plotmarkers disappear when QwtPlotDict::autoDelete=true? No!

On Friday 25 April 2008 17:16, Peter Leopold wrote:

> When I am printing to the screen, the values are

> rect.x1,y1=2,2
> rect.x2,y2=844,582

What type of rect is this ? For a screen with 1280*1024 pixels this is by far 
to big.

> but when I'm printing to a file, the values are
>
> item->xAxis()=2 item->yAxis()=0
> rect.x1,y1=62,0
> rect.x2,y2=991,726

The geometry will always differs from the screen, because the the size of 
printer device is different to the widget. For printing in high resolution 
the geometries are obviously larger.

> Should I direct my attention to the internals of painter,
> where the fonts may be corrupted?

Try to assign symbols to the markers. Also assign a background for your labels 
( see QwtText::setBackgroundBrush/setBackgroundPen ) and play with different 
fonts.

What happens ?

Uwe

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Peter Leopold | 26 Apr 05:33

playing with fonts and setBackgrounds

Uwe Rathmann writes:

>Try to assign symbols to the markers. Also assign a 
background for your labels 
( see QwtText::setBackgroundBrush/setBackgroundPen ) 
and play with different fonts.

> What happens?

Symbol assigning works in the screen and in the pdf. If I assign 
a symbol and a label, the label takes precedence. 
setBackgroundBrush/setBackgroundPen 
also work for both screen and pdf. In the pdf, the colored, 
outlined boxes are empty. No label.  This is true for Helvetica, 
Courier, Times, helvetica, courier and times, for font sizes 
6 to 14, and for bolded and/or italicized fonts.

I commented out QPrinter::setOutputFormat(QPrinter::PdfFormat) to 
see it that had an effect. No. pdf is default anyway, and the 
problem persists.

All has been performed in qt4.3.3 qwt5.0.2 in mingw/Windows 
XP on a Sony Vaio and g++ (Kubuntu 7.10 Gutsy Gibbon) on an 
Dell Pressario.

Here is another clue:

There is a mysterious warning in qwt_plot.cpp just before 
QwtPlot::drawCanvasItems()

warning: drawCanvas calls drawCanvasItems what is also used
for printing. Applications that like to add individual
plot items better overload QwtPlot::drawCanvasItems

It seems to be saying that drawCanvasItems is called by 
drawCanvas as well as by certain mechanisms in the print 
engine. Then it goes on to say that applications that use 
QwtPlotItems such as QwtPlotCurves and QwtPlotMarkers 
("like to add individual plot items") must be supported 
by custom implementations of QwtPlot::drawCanvasItems. 
So if drawCanvasItems does not draw QwtPlotItems on a 
canvas, why is it called drawCanvasItems?

What's more: QwtPlot::drawCanvasItems doesn't even exist in Qwt, 
so we are asked to overload a nonexistent function. I don't 
think the author meant "overload." Hmmm!

And lastly: drawCanvas does NOT call drawCanvasItems at all. 
(How could it? drawCanvasItems doesn't exist.) Rather, 
drawCanvas calls drawItems.

If we go back perform the string substitution 
drawCanvasItems->drawItems, then the author warns us to 
implement a custom drawItems if our QwtPlot has items on it. 
Hmmm! 

Looking inside drawItems, I see that . . . I was here earlier 
today. This is where I proved that all items are being drawn. 
I've come full circle in the rabbit warren and found my own 
droppings.

Perhaps I'm as close to the solution as I was when I set
PrivateData::autoDelete=false.

On the other hand, the problem could lie deep inside the
QPrinter.setOutputFormat(QPrinter::PdfFormat). 

Or it could lie somewhere else.

Next: a hello world example to illustrate the problem in as 
few lines as possible

Peter

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Peter Leopold | 26 Apr 05:37

"hello world" exhibiting the QwtPlotMarker->pdf problem

Uwe Rathmann <Uwe.Rathmann <at> tigertal.de> writes:

> Try to assign symbols to the markers. Also assign a background for your labels 
> ( see QwtText::setBackgroundBrush/setBackgroundPen ) and play with different 
> fonts.
> 
> What happens ?
> 
> Uwe
> 

The simplest hello world I can come up with.
Four files:

in a directory named "label"
1. label.pro
2. label.cpp (main)
3. MyMainWindow.h
4. MyMainWindow.ui

% qmake
% make
% label

This application will run, create a qwtPlot with "Hello world"
written in the lower left quadrant, and print the same to xxx.pdf.

% kpdf xxx.pdf

Hello world is on the screen in the appliation, but it is 
not in the pdf.

Sorry I couldn't make it any shorter.

Peter

///////////////// label.pro /////////////
TEMPLATE = app
TARGET = 
DEPENDPATH += .
INCLUDEPATH += .

# Input
HEADERS += MyMainWindow.h
FORMS += MyMainWindow.ui
SOURCES += label.cpp
LIBS +=  -lqwt-qt4 
INCLUDEPATH = . /usr/include/qwt-qt4 /usr/include/qt4/Qt

///////////////// label.cpp///////////

#include <QApplication>
#include "MyMainWindow.h"

int main(int argc, char *argv[])  {
  QApplication *app;
  app = new QApplication (argc, argv);
  MyMainWindow *mw=0;
  mw= new MyMainWindow();
  int retval=app->exec();
  if(mw!=0)delete mw; mw=0;
  if(app!=0)delete app;app=0; 
  return retval;
}
///////////////// MyMainWindow.h////
#ifndef MYMAINWINDOW_H
#define MYMAINWINDOW_H
#include "ui_MyMainWindow.h"
#include <QMainWindow>
#include <QPrinter>
#include <qwt_plot_marker.h>
class MyMainWindow : public QMainWindow, Ui_MainWindow {
  Q_OBJECT;
 public:
  QwtPlotMarker *pm;
  MyMainWindow () : QMainWindow() , Ui_MainWindow(){
    setupUi(this);
    this->show();
    pm=0;

    QwtText txt;
    txt.setFont(QFont("helvetica",10,QFont::Normal,false));
    txt.setText("Hello World");
    pm = new QwtPlotMarker();
    pm->setLabel(txt);
    pm->setValue(250,250);
    pm->attach(qwtPlot);
    QPrinter qp;
    qp.setOutputFormat(QPrinter::PdfFormat);
    qp.setOutputFileName("xxx.pdf");
    qwtPlot->print(qp);
  }
  ~MyMainWindow(){
    if(pm!=0)delete pm; pm=0;
  }
};
#endif
//////////////// MyMainWindow.ui //////
<ui version="4.0" >
 <class>MainWindow</class>
 <widget class="QMainWindow" name="MainWindow" >
  <property name="geometry" >
   <rect>
    <x>0</x>
    <y>0</y>
    <width>800</width>
    <height>600</height>
   </rect>
  </property>
  <property name="windowTitle" >
   <string>MainWindow</string>
  </property>
  <widget class="QWidget" name="centralwidget" >
   <widget class="QwtPlot" name="qwtPlot" >
    <property name="geometry" >
     <rect>
      <x>40</x>
      <y>40</y>
      <width>721</width>
      <height>491</height>
     </rect>
    </property>
   </widget>
  </widget>
  <widget class="QMenuBar" name="menubar" >
   <property name="geometry" >
    <rect>
     <x>0</x>
     <y>0</y>
     <width>800</width>
     <height>29</height>
    </rect>
   </property>
   <widget class="QMenu" name="menuFile" >
    <property name="title" >
     <string>File</string>
    </property>
   </widget>
   <addaction name="menuFile" />
  </widget>
  <widget class="QStatusBar" name="statusbar" />
 </widget>
 <customwidgets>
  <customwidget>
   <class>QwtPlot</class>
   <extends>QFrame</extends>
   <header>qwt_plot.h</header>
  </customwidget>
 </customwidgets>
 <resources/>
 <connections/>
</ui>

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Uwe Rathmann | 26 Apr 09:25

Re: "hello world" exhibiting the QwtPlotMarker->pdf problem

On Saturday 26 April 2008 05:37, Peter Leopold wrote:

> This application will run, create a qwtPlot with "Hello world"
> written in the lower left quadrant, and print the same to xxx.pdf.

>From the history of this thread I expect, that it is a Qt problem or a problem 
of your PDF viewer. Before I will check your demo on my box I would like to 
see the xxx.pdf file, that was generated in your environment.

Uwe

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Peter Leopold | 26 Apr 15:55

xxx.pdf hello world file content

> Uwe Rathmann <Uwe.Rathmann <at> tigertal.de> writes:

> From the history of this thread I expect, that it is a Qt 
> problem or a problem 
> of your PDF viewer. Before I will check your demo on my box 
> I would like to 
> see the xxx.pdf file, that was generated in your environment.

OK, so the problem is potentially in Qt4.3.2 both for MinGW and Linux, 
or the problem is in Acrobat Reader and in kpdf. Here is the pdf file 
for the hello world example.

Whoops, lines are longer than 80 characters. I've had to add carriage
returns, so the following probably will not be readable in the a pdf
viewer, but it is still available for inspection.

I'll try to upload the file to the wiki at http://www.cascokid.com, 
where I am also posting screen captures of
the hello world application and the (empty) hello world pdf.

Whoops, wikis don't like pdf files. 

And they don't like pdf files renamed as png files.

I could create a ftp account at bioanalyte.com and post the username
and password, but that seems like overkill (not to mention a security
risk) for making an empty pdf file available to all who want to see
what an empty file looks like.

So I'm going to have to email this directly to Uwe. Perhaps
Uwe will post it if he thinks it is appropriate.

Joey was able to attach a pdf directly to his posting earlier. I'm using
firefox 2.0.14 on Kubuntu gutsy gibbon, and the post editor I see
in my browser does not have a a file attachment option. It would
be far more convenient to attach the file here. Sorry.

Here it is, with carriage returns to comply with the 80 character
line limit.

Peter

//////////xxx.pdf///////////

%PDF-1.4
1 0 obj
<<
/Title ()
/Creator ()
/Producer (Qt 4.3.2 (C) 1992-2008 Trolltech ASA)
/CreationDate (D:20080426132816)
>>
endobj
2 0 obj
<<
/Type /Catalog
/Pages 3 0 R
>>
endobj
4 0 obj
<<
/Type /ExtGState
/SA true
/SM 0.02
/ca 1.0
/CA 1.0
/AIS false
/SMask /None>>
endobj
5 0 obj
[/Pattern /DeviceRGB]
endobj
6 0 obj
<<
/Type /Page
/Parent 3 0 R
/Contents 7 0 R
/Resources 9 0 R
>>
endobj
9 0 obj
<<
/ColorSpace <<
/PCSp 5 0 R
/CSp /DeviceRGB
/CSpg /DeviceGray
>>
/ExtGState <<
/GSa 4 0 R
>>
/Pattern <<
>>
/Font <<
>>
/XObject <<
>>
>>
endobj
7 0 obj
<<
/Length 8 0 R
/Filter /FlateDecode
>>
stream
xœR=oÃ
Ü߯¸¹R18Xö›=DêPÉò!êP¹M£Èf{`ªzæî€ãø(¶ý;¾n(ÚþŠanÛ
ž¬©++ú=/¬ôh\áL&ê¨옅±N”lâ¼Ûp¡".@l¬ZÀã|ÇM…1gŠDi{f^Wr–ááàr÷û¯èø#šûÄ®‚g§ö¹–
'6*3VКRΑãФŮB|½ª$Ãlõz‰jx£%€º¬¼ÏÖñßüN6TËmI¾?é0ßWÐuG
Œ˜“ÈQ; ͑vO¸ägôØÂéYÄ#íÛWA?(ñ"õũ›ˆ2¤£_•ξendstream
endobj
8 0 obj
248
endobj
3 0 obj
<<
/Type /Pages
/Kids 
[
6 0 R
]
/Count 1
/MediaBox [0 0 595 842]
/ProcSet [/PDF /Text /ImageB /ImageC]
>>
endobj
xref
0 10
0000000000 65535 f 
0000000009 00000 n 
0000000134 00000 n 
0000000890 00000 n 
0000000183 00000 n 
0000000278 00000 n 
0000000315 00000 n 
0000000550 00000 n 
0000000871 00000 n 
0000000395 00000 n 
trailer
<<
/Size 10
/Info 1 0 R
/Root 2 0 R
>>
startxref
1012
%%EOF

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest
Peter Leopold | 26 Apr 17:55

xxx.pdf hello world file attachment

Peter Leopold wrote:
>> Uwe Rathmann <Uwe.Rathmann <at> tigertal.de> writes:
>> I would like to 
>> see the xxx.pdf file, that was generated in your environment.

as attached, thanks to Thunderbird (and Joey)
Attachment (xxx.pdf): application/pdf, 1290 bytes
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest
Peter Leopold | 28 Apr 16:30

more on QwtPlotMarkers and the bode example

Uwe Rathmann wrote:
> On Wednesday 23 April 2008 22:34, Peter Leopold wrote:
> 
>> Has anyone had success labeling QwtPlots with QwtPlotMarkers, then
>> exporting the plots to pdf or a printer?
> 

> Yes, f.e the bode example does it.

In hindsight, I should have done this first:

>From the bode example, I've added the setLineStyle(),
setLabelAlignment(), setLinePen() aspects of plotmarkers.
I've created a memory leak in doing so, but it is the same
memory leak in the bode example, viz., allocating but
never deleting QwtPlotMarkers. The result is plottable,
pdf exportable plotmarker, but . . .

The bode example requires dashed or dotted lines in order for the
QwtPlotMarkers to be located in the correct places. If you turn off
these lines
    d_mrk1->setLineStyle(QwtPlotMarker::NoLine);

the markers move around on the plot. Strange. The pdf export contains
the mislocated markers.

In my case, if I set lineStyle to NoLine, the markers disappear from
the pdf files. They also move around on the screen plot.

Since I have 192 plotmarkers, I cannot tolerate 192 vertical/horizontal
lines.

Does anyone know how to turn this *@*#*$ lines off without sacrificing
the markers themselves?

I'm contemplating two workarounds:

1. QwtPlainTextEngine::draw(qpainter,QRect rect,int flags,QString text)
as a workaround. QwtPlot doesn't have a getPainter() method. What method
can I use to implement the QwtPlainTextEngine directly on the QwtPlot?
(I have the feeling that I'm asking how to recreate QwtPlotMarkers from
scratch.)

2. QClipBoard to do a screen capture then print to pdf.

Comments? Suggestions?

Peter (day 5 of the quest to print QwtPlotMarkers from the screen to the
pdf file)

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Uwe Rathmann | 28 Apr 20:22

Re: more on QwtPlotMarkers and the bode example

Hi Peter,

The pdf file you sent to me doesn't show anything useful on my box too. So it 
isn no problem of your PDF viewer.

Compiling and running your demo ( here Linux/X11 + Qwt 5.1/Qt 4.3.4 ) displays 
half of the text in the bottom left corner. The reason for the incomplete 
printout is because your demo prints before the first replot is done. After 
inserting a replot() everything works perfect.

> I'm contemplating two workarounds:

Try Qt 4.3.4 and insert a "qwtPlot->replot()" in MyMainWindow.h before you are 
printing. If this doesn't help stop fiddling around with Qwt, and write a 
small demo, that does a QPainter::drawText() on a QPrinter. If this is not 
successful too contact the TrollTech support.

Uwe

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Peter Leopold | 28 Apr 20:45

more on hello world example

Peter Leopold wrote:
> Uwe Rathmann wrote:
>> On Wednesday 23 April 2008 22:34, Peter Leopold wrote:
>>
>>> Has anyone had success labeling QwtPlots with QwtPlotMarkers, then
>>> exporting the plots to pdf or a printer?
> 
>> Yes, f.e the bode example does it.
> 
> In hindsight, I should have done this first:
> 

In QwtPlotMarker::draw( . . .) in the section on labels, after
translation, I've added the diagnostic print statements:

	std::cerr<<"drawing label:"<<d_data->label.text().toStdString();
	std::cerr<<" tr.x()="<<tr.x()<<" tr.y()="<<tr.y();
	std::cerr<<" r.x1,y1,x2,y2="<<x1<<" "<<y1<<" "<<x2<<" "<<y2;
	std::cerr<<std::endl;
        d_data->label.draw(p, tr);

Note that r is the input QRect. I recompiled and installed qwt.  The
output of the hello world demo code (attached) is

// pm->attach(qwtPlot); //pdf plot: numbers are clearly out of bounds
drawing label: Hello World tr.x()=-231 tr.y()=8769
	r.x1,y1,x2,y2=137 0 13236 8974

// qwtPlot->print(QPrinter); //screen plot: numbers are sane
drawing label: Hello World tr.x()=182 tr.y()=302
	r.x1,y1,x2,y2=2 2 671 463

So I can say with some security that the pdf drawing  boundaries are
wrong. But what are the right values?

If I turn on setLineStyle(), setLinePen() setLabelAlignment, notice
the pdf numbers are in bounds:

drawing label: Hello World tr.x()=6513 tr.y()=5806 r.x1,y1,x2,y2=625 0
13236 8799
drawing label: Hello World tr.x()=304 tr.y()=302 r.x1,y1,x2,y2=2 2 671 463

So I think the solution is to create two linear transformations that map
the labels onto their intended locations. This works OK for screen, but
is somehow coupled to setLineStyle(HLine|VLine) for the pdf. Something
is really wrong here.

I'll write a patch for my own use and would be happy to share it. My
patch is written without any knowledge of the qwt scalemap internals,
QPrinter, etc. Indeed, I will likely reproduce some fraction of qwt scaling.

* * *

QClipboard was easy, but disappointing. Why capture a Pixmap when you
can make a real pdf?

QPlainTextEngine was looking difficult. Not getPainter() or setPainter()
methods for QwtPlot or QwtPlotCanvas, so how can you put text in a
painter and add a painter to a plot? And if my question doesn't make
sense, then I should change it to "How do you use QwtPlainTextEngine on
a QwtPlot?"

Peter

Attachment (label.cpp): text/x-c++src, 299 bytes
######################################################################
# Automatically generated by qmake (2.01a) Mon Apr 28 14:33:07 2008
######################################################################

TEMPLATE = app
TARGET = 
DEPENDPATH += .
INCLUDEPATH += .

# Input
HEADERS += MyMainWindow.h
FORMS += MyMainWindow.ui
SOURCES += label.cpp
DEFINES += APPVERSION=0.9 APPBUILTON=$(COMPILEDATE) COMPANALYST=0 COMPMASSLYNX=0 COMPXCALIBUR=1
COMPCOMPASS=0 COMPCHEMSTATION=1 BA_IS_LINUX=1
LIBS +=  -lQtNetwork
LIBS +=  -L/usr/local/qwt-5.0.2/lib -lqwt 
INCLUDEPATH = . /home/pel/work/regatta/btools /usr/local/qwt-5.0.2/include /usr/include/qt4/Qt
Attachment (MyMainWindow.h): text/x-chdr, 1317 bytes
Attachment (MyMainWindow.ui): application/x-designer, 1203 bytes
-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
_______________________________________________
qwt-interest mailing list
qwt-interest <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/qwt-interest
Peter Leopold | 28 Apr 21:55

Re: more on QwtPlotMarkers and the bode example


For hello world example I posted earlier, the drawing geometry for the
qwtplotmarker::draw() for the pdf drawing case:

d_data->xValue=250 d_data->yValue=250
xmap: p1=187 p2=13175
ymap: p1=8912 p2=50
xmap: s1=0 s2=0
ymap: s1=0 s2=0

Evidently, the pdf draw routine does not know what the scale of the
plot is supposed to be. Compare to the screen case:

xmap: p1=6 p2=657
ymap: p1=459 p2=6
xmap: s1=-200 s2=1200
ymap: s1=-200 s2=1200

where the s1,s2 values are right, and the plot works.

Unfortunately, when I correct s1 and s2 by hand (basically I hardwire
values in the the qwt shared object) I get much more sensible values,
but nothing that displays in the pdf.

So there is more trouble deeper in the rabbit warren.

Does anyone  have any ideas?

Peter

Peter Leopold wrote:
> Uwe Rathmann wrote:
>> On Wednesday 23 April 2008 22:34, Peter Leopold wrote:
>>
>>> Has anyone had success labeling QwtPlots with QwtPlotMarkers, then
>>> exporting the plots to pdf or a printer?
> 
>> Yes, f.e the bode example does it.
> 
> In hindsight, I should have done this first:
> 
>>From the bode example, I've added the setLineStyle(),
> setLabelAlignment(), setLinePen() aspects of plotmarkers.
> I've created a memory leak in doing so, but it is the same
> memory leak in the bode example, viz., allocating but
> never deleting QwtPlotMarkers. The result is plottable,
> pdf exportable plotmarker, but . . .
> 
> The bode example requires dashed or dotted lines in order for the
> QwtPlotMarkers to be located in the correct places. If you turn off
> these lines
>     d_mrk1->setLineStyle(QwtPlotMarker::NoLine);
> 
> the markers move around on the plot. Strange. The pdf export contains
> the mislocated markers.
> 
> In my case, if I set lineStyle to NoLine, the markers disappear from
> the pdf files. They also move around on the screen plot.
> 
> Since I have 192 plotmarkers, I cannot tolerate 192 vertical/horizontal
> lines.
> 
> Does anyone know how to turn this *@*#*$ lines off without sacrificing
> the markers themselves?
> 
> I'm contemplating two workarounds:
> 
> 1. QwtPlainTextEngine::draw(qpainter,QRect rect,int flags,QString text)
> as a workaround. QwtPlot doesn't have a getPainter() method. What method
> can I use to implement the QwtPlainTextEngine directly on the QwtPlot?
> (I have the feeling that I'm asking how to recreate QwtPlotMarkers from
> scratch.)
> 
> 2. QClipBoard to do a screen capture then print to pdf.
> 
> Comments? Suggestions?
> 
> Peter (day 5 of the quest to print QwtPlotMarkers from the screen to the
> pdf file)
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
> Don't miss this year's exciting event. There's still time to save $100. 
> Use priority code J8TL2D2. 
> http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Uwe Rathmann | 29 Apr 07:00

Re: more on QwtPlotMarkers and the bode example

On Monday 28 April 2008 21:55, Peter Leopold wrote:

> For hello world example I posted earlier, ...

Please continue with the label demo. It makes no sense (= nobody will look at 
it) to write more complex demos, when a more simple one already shows the 
problem. 

You have already spend several days on this ( producing a lot of noise on this 
list) because you don't organize your quest.

Uwe

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Peter Leopold | 29 Apr 23:34

Qt::QPainter and Qt::QPrinter create pdf export of text AOK.

 > Please continue with the label demo.
 > Uwe
 >

Thanks to Uwe's suggestions (and his patience) I am now using Qt 4.3.4 
and a freshly recompiled qwt-5.0.2 in Kubuntu:

A QPainter/QPrinter version of the hello world label demo works fine, 
both on the screen and in the pdf. I'll spare the details. Not a qt problem.

Can anyone get the bode example to work (with valid pdf output) when

   d_mrk1->setLineStyle(QwtPlotMarker::VLine);

is changed to

   d_mrk1->setLineStyle(QwtPlotMarker::NoLine);

??

If you *can't* get it to work, then that says something, and I'm not as 
alone as I think I am.

My next steps: painting on QwtPlots directly. QPainter::begin() keeps 
reminding me that "Widget painting can only begin as a result of a 
paintEvent" so to get this to work I'll have to extend QwtPlot:

class MyPaintablePlot : public QwtPlot {
   MyPaintablePlot : QwtPlot (){}
   void paintEvent(QPaintEvent *ev){
	etc.
   }
};

This will allow me to use the same paint methods, e.g., 
QPainter::drawText(QRect r, QString label), that actually work.

On the other hand, since this doesn't exist already, there is probably a 
good reason for it. Comments? Advice?

Peter

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone
Uwe Rathmann | 30 Apr 07:13

Re: Qt::QPainter and Qt::QPrinter create pdf export of text AOK.

On Tuesday 29 April 2008 23:34, Peter Leopold wrote:

> A QPainter/QPrinter version of the hello world label demo works fine,
> both on the screen and in the pdf. I'll spare the details. Not a qt
> problem.

Please let's continue with your label demo. It works fine here ( after adding 
the replot ), but not on your box. On the other side you can print with 
QPainter::drawText. So there is something in between, what makes the 
difference.

So the next step is to strip down the label example:

1) Hide the axes ( so there is nothing else painted than the marker )

2) Change QwtPlotMarker::draw and replace "d_data->label.draw(p, tr);" by your 
working QPainter::drawText(). Please try QPainter::drawText(tr, ...) and 
QPainter::drawText(tr.topLeft(), ...).

Uwe

PS: By the way: if you add a title with the same font. Is it printed ?

-------------------------------------------------------------------------
This SF.net email is sponsored by the 2008 JavaOne(SM) Conference 
Don't miss this year's exciting event. There's still time to save $100. 
Use priority code J8TL2D2. 
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone

Gmane