Thanks, talk about being confused, boy am I ever.
Using designer I have a "ui.drawingBox" which is a QFrame.
I have a "edpForm" which is my base class.
I start off with
edpForm::edpForm()
{
ui.setupUi(this);
help = new HelpFunction( this );
drawings = new DrawingFunctions( this );
controls = new ControlFunctions( this );
edpForm::edpForm()
{
ui.setupUi(this);
help = new HelpFunction( this );
drawings = new DrawingFunctions( this );
controls = new ControlFunctions( this );
To copy to clipboard, switch view to plain text mode
plus many more classes. In my constructor I have
drawings->setupDrawing( ui.drawingFrame, &baseBuffer, ui.centerBox );
drawings->setupDrawing( ui.drawingFrame, &baseBuffer, ui.centerBox );
To copy to clipboard, switch view to plain text mode
and in my DrawingFunction class I have
DrawingFunctions
::DrawingFunctions( QWidget *parent
) : QWidget(parent
){
}
{
drawings = f;
buffer = p;
frmTable = t;
pi = 3.1459265358979;
DrawingFunctions::DrawingFunctions( QWidget *parent ) : QWidget(parent)
{
}
void DrawingFunctions::setupDrawing( QFrame *f, QPixmap *p, QFrame *t)
{
drawings = f;
buffer = p;
frmTable = t;
pi = 3.1459265358979;
To copy to clipboard, switch view to plain text mode
and start off with
QPainter p
( drawings
);
/// set drawing pixmap QPainter b
( buffer
) ;
/// set buffer pixmap
slotSetDrawingScale();
count = lines.count();
start = 0;
if( code == "supports" )
QPainter p( drawings ); /// set drawing pixmap
QPainter b( buffer ) ; /// set buffer pixmap
slotSetDrawingScale();
count = lines.count();
start = 0;
if( code == "supports" )
To copy to clipboard, switch view to plain text mode
and come down to this
for( n = start; n < count; ++ n )
{
k = lines[n]; // get line coordinates string
temp = k.split( "//" ); // split into coordinates
h = temp[0];
dim = h.toLong( &ok );
xs = (int) ( deltaX + scaleFactor * dim );
h = temp[1];
dim = h.toLong( &ok );
ys = (int) ( deltaY + scaleFactor * ( maxY - dim ) );
h = temp[2];
dim = h.toLong( &ok );
xe = (int) ( deltaX + scaleFactor * dim );
h = temp[3];
dim = h.toLong( &ok );
ye = (int) (deltaY + scaleFactor * ( maxY - dim ) );
p.drawLine( xs, ys, xe, ye );
b.drawLine( xs, ys, xe, ye );
for( n = start; n < count; ++ n )
{
k = lines[n]; // get line coordinates string
temp = k.split( "//" ); // split into coordinates
h = temp[0];
dim = h.toLong( &ok );
xs = (int) ( deltaX + scaleFactor * dim );
h = temp[1];
dim = h.toLong( &ok );
ys = (int) ( deltaY + scaleFactor * ( maxY - dim ) );
h = temp[2];
dim = h.toLong( &ok );
xe = (int) ( deltaX + scaleFactor * dim );
h = temp[3];
dim = h.toLong( &ok );
ye = (int) (deltaY + scaleFactor * ( maxY - dim ) );
p.drawLine( xs, ys, xe, ye );
b.drawLine( xs, ys, xe, ye );
To copy to clipboard, switch view to plain text mode
This all works fine for Qt3.
For Qt4 I have tried about everything I can think of. I have added a paintEvent
{
QPainter painter
(drawing
);
// drawing being the ui.drawingBox; painter.drawLine( xs, ys, xe, ye );
}
DrawingFunctions::paintEvent( QPaintEvent* event)
{
QPainter painter(drawing); // drawing being the ui.drawingBox;
painter.drawLine( xs, ys, xe, ye );
}
To copy to clipboard, switch view to plain text mode
I have tried the "timer" after looking at the "Detailed Description".
I just now tried a "drawings->update(); no luck.
I have loaded my program into KDevelope which I find much easier to work with then DDD. for single stepping.
In get either a "sig...." error or a runaway message saying I need to access a paintEvent.
Unfortunately the Programming with Qt4 book by Blanchette & Summerfield hasn't been released yet.
Somewhere I saw you could write to a Pixmap and then have it transfer the image to paintEvent, but I think this is just a bitBlt subutitute.
Am I the only one having this kind of trouble?
Thanks.
As you can see, I don't know what the h... i'm doing
Bookmarks