Have you seen this thread?
http://www.qtcentre.org/forum/f-qt-d...bel-11504.html
Especially take a look at how the line is drawn depending on the size of the widget.
Have you seen this thread?
http://www.qtcentre.org/forum/f-qt-d...bel-11504.html
Especially take a look at how the line is drawn depending on the size of the widget.
impeteperry (27th January 2008)
Thanks Mysota It was a great help.My big problem I forgot the line under the "public;" when defining the class. What ever you do, don't get old (I'm 81).
Now all I have to do is figure out how to set the size of the frame, but I"m going to bed it's 12:30.
Thanks again.
Please mention the name correctly as Wysota, Qt Guru.Thanks Mysota It was a great help.My big problem
Last edited by wysota; 28th January 2008 at 10:19. Reason: Please use proper tags - [quote] instead of [code] :P
Anurag Shukla
A man who never makes mistake is the man who never does anything! Theodre Rosvelt!
Wysots, Qi Guru, I'm sorry about the name. It was late and I don't see to well.
I have made some progress. I can draw some lines, so I am back at setting up my scaling functions.
I do have a question. In the distant past I wrote to a "pixmap". is there any advantage to that now with the paintEvent functionallity?
Thanks
Hi
I now have my painter working on my laptop whereI compiled the program.
It also runs on my desk computer as long as I don't re-compile it there. If I re-compile the same source code there it locks up the computer on the first "p.drawText" command. I have single stepped the program on both computers. Everything is the same. There is no problem with the "p.drawLine" command. If I option out the single p.drawText(x, y, "text"); line 16, the program runs fine.I am using the same Kubuntu 7.10 on each computer.Qt Code:
p.drawLine ( xs, ys, xe, ye ); /// start of labeling. if ( tempList[4] == "true" ) { xc = ( xs + xe ) / 2; yc = ( ys + ye ) / 2; if ( xs == xe ) angle = pi/2.0; else if ( ys == ye ) angle = 0.0; else angle = atan((double)(ye - ys) / (double)(xe - xs)); angle = ( angle * 180.0 ) / pi; p.save(); p.translate ( xc, yc ); p.rotate ( angle ); p.scale ( 1, -1 ); k = "S" + h.setNum ( n + 1 ); p.drawText ( 0, 0, k ); p.restore(); }To copy to clipboard, switch view to plain text mode
I am sorry to be such a pest.
Thanks for help.
What exactly is the widget supposed to display?
I have a bunch of lines and i label them with their number. the text I want to display is "S1" See attachment. These are "Grid" lines are used for locating building columns and other elements.
Except for the screen size the data is identical on the two computers. The lines draw correctly so the "viewWindow" and "viewPort" are set correctly. If I take the compiled program from the second machine, it runes fine on the firsrt machine.
In essense, the program compiled on the first computer runs fine on both computers
The program compiled on the second computer locks it up when run, but runs fine on the first computer.
Why don't you use QGraphicsView to make the visualization?
QGraphicsView was add in Qt4.2. I was unaware of its existance
Thanks, I will take a look at it.
I took a quick look at your QGraphicView and foundWhat would be the advantage using this when I already have the geometry and am already using the "painter" to draw items onto the "viewPort"?By default, the items are drawn onto the viewport by using a regular QPainter, and using default render hints.
Ease of handling. I don't say you should take that approach, but that if you have problems with one mechanism, try using another.
impeteperry (1st February 2008)
Well said.
I am still confused why a program compiled on one computer won't run on that computer, but will run on another one, I may try reinstalling Qt. but for now I will continue with the development of my program.
Thanks for your help and suggestions. Don't you ever sleep?
pete
I re-installed Qt-4 and all works now. Onward ever onword.
Thank you for your patience
pete
Hi, on the same subject.
My drawing is fine, but now I want to open a frame with a textEdit in it on top of the drawing with out the drawing showing through (help info) and when the frame is closed the drawinig is back. I thought Qt-4's "double buffering" took care of this.
Thanks
Last edited by impeteperry; 12th February 2008 at 05:42.
I'm back with another very confusing problem.
I have 2 versions of the same program. Call them A & B. I usefor both versions and as near as I can tell the same data. There are two stages. The first just displays the "support lines" and the second displays both the "support lines" and the "colums".(see attachments from version B) Version A is fine for just the support lines, but when trying to display both the program crashes with the following statement which I don't understand at all.Qt Code:
{ int n; for(n = 0; n < list.count(); ++n ) { tempList = list[n].split("|"); /// split the list into types of stringLists k = tempList[0]; /// get the type of element to draw if(k == "erase") clearWindow = "erase"; else { tempList.removeFirst(); /// remove the element with the code clearWindow = "false"; if(k=="supports") paintSupportLines=tempList; else if(k=="columns") paintColumns=tempList; else if(k=="help") paintDrawHelpWindow=tempList; else if(k=="erase") clearWindow="true"; } } emit getDrawingFrameSize (&W,&H); k = actionList.last(); tempList = k.split(","); if(tempList[1] == "4") setGeometry (10,10,W ,H); else setGeometry (10,10,0,0); update(); }To copy to clipboard, switch view to plain text modeI have replaced the "update" with "redraw" but same problem. I don't think the problem is in the "paint event" itself,{ Q_ASSERT_X(i >= 0 && i < p.size(), "QList<T>:perator[]", "index out of range");
detach(); return reinterpret_cast<Node *>(p.at(i))->t(); }
As usual I would appreciate any help you can give me.
thanks.
Bookmarks