What exactly is the widget supposed to display?
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.
It's a matter of passing the QTextEdit widget a proper parent.
J-P Nurmi
Thanks, it came to me last night what I was doing wrong.
I am still having problems which I have narrowed down to maybe a Qt problem.
I want to "show" a "help" box on a "QPainter" drawinq. I want to "toggle" this "box" by means of the keyboard "F1" key.
Line #4 in the following code activates a HelpFunction class to do this as has been suggested and line #5 does this in the painter function itself.
The first thumbnail just shows the drawing. The second shows the HelpFunction class "help box" after pressing the "F1" key.. The third shows the "help box" when generate by the painter itself.
The code below is for the HelpFunction class. Below the horizontal line controls the toggle function.Qt Code:
///----------------------------------------------------------------------------Pb1 void BaseForm::slotPb1() { emit activate(); paintList.append("help"); emit displayErectionDrawing(paintList, helpFlag); }To copy to clipboard, switch view to plain text mode
Line 23 displays the status of the toggle so I can tell if the "F1" keystroke was received.
There are several problemsQt Code:
{ frameH->setAutoFillBackground ( true ); teHBox->setAutoFillBackground(true); teHBox->setReadOnly ( true ); } void HelpFunction::slotActivate() { emit getDrawingFrameSize ( &W, &H ); emit getTextListItem(2, &k); frameH->setGeometry ( W - 350, H - 420, 350, 430 ); teHBox->setGeometry ( 10, 10, 330, 410 ); teHBox->setPlainText ( k ); emit showHelpFrame(frameH); //-------------------------------------------------------------------------- if(helpFlag == false) k = "false"; else k = "true"; emit setMessageBox("help 15 helpFlag = " + k); if(helpFlag == true) helpFlag = false; else if(helpFlag == false) helpFlag = true; else helpFlag = true; }To copy to clipboard, switch view to plain text mode
1. the first time the "F1" key was pressed, the HelpFunction "help box" was displayed as shown in the second thumbnail.
2. After that, pressing the "F1" key had no effect.
3. Clicking anywhere on the screen with the left mouse button closed the HelpFunction "help box" and left the "painter" help box displayed.
4. Now the "F1" key toggled the "painter" help box.
5, If I changed line #3 of the HelpFunction class to "frameH = new QFrame(this);", the toggle worked fine for the "painter" box thumbnail #2.
6. CONCLUSION: When the "Help Function" box was displayed, the "F1" key was DEACTIVATED.
If we get problem #6 corrected, I would much prefer the "Box" to look like the "painter" box, but with scroll bars and the functionality of the QTextEdit widget.
If I am doing somthing wrong, I am including the pb1 and fk1clicked items which have worked flawlessly up to now.
[/CODE]Qt Code:
connect ( Pb1, SIGNAL ( clicked() ), this, SLOT ( slotPb1() ) ); ///--------------------------------------------------------Function Keys connect ( this, SIGNAL ( fk1clicked() ), this, SLOT ( slotPb1() ) );To copy to clipboard, switch view to plain text modeThank you very muchQt Code:
{ int n; QString h; n = k->key(); h = h.setNum ( n ); if ( k->key() == 16777264 && Pb1->text() != "-" ) emit fk1clicked(); if ( k->key() == 16777265 && Pb2->text() != "-" ) emit fk2clicked();To copy to clipboard, switch view to plain text mode
Ok, I don't blame you all if you are fed up with me, but please give me a answer
Can I do what I want to in Qt4?
Thanks
You see... the problem is we are not seeing your problemI suggest you forget about F keys and all that stuff and focus on implementing a widget with properties that allow you to modify the behaviour of the widget. When you have that done, start thinking about function keys.
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.
I'd say tempList has no items and so tempList[0] fails. Or it can have one value and tempList[1] fails.
Could you explain what is preventing you from using Qt4 and QGraphicsView?
I am going back and check my data as I am sure that is where it must be as you suggest, but I would like to know about the "{ Q_ASSERT_X(i >= 0 && i < p.size(),...." message. can it help me find where and what is the problem is?.
I looked at QGraphicsView, as you suggested earlier, but for some reason decided not to go there. I will however do so now and try to make a parallel program to the one I have now.
What I am trying to do as a structural engineer is write a parametric driven program to replace the current CAD programs used in the industry and one that someone can learn to use in a day or two by going back to a modified command line operation similar to one I had written in pre-dos days. I do not have any time restraints, but a need to get it right.
I took a quick look at "graphicsview" and noted it was a 2D program and the program i am trying to re-write was a 3D rendered structure
Thanks for you indulgence
Last edited by impeteperry; 10th September 2008 at 06:36.
Not really. But a backtrace from a debugger will and I suggest you use one here. There is no point in guessing if the application itself can tell you what is wrong.
I really suggest you reconsider using GV. It's perfect for your usecase.I looked at QGraphicsView, as you suggested earlier, but for some reason decided not to go there. I will however do so now and try to make a parallel program to the one I have now.
But you are rendering it on a 2D canvas, so everything is ok. If you want to have real 3D, consider using OpenGL with one of the viewer frameworks available for Qt.I took a quick look at "graphicsview" and noted it was a 2D program and the program i am trying to re-write was a 3D rendered structure
Thanks
I am using opengl.
There are 2 parts to the program.
1. developing a library of concrete elements (columns, beams, plank, connection hardware etc.) using opengl.
2. defining where they go.
This in a replacement for conventional CAD! which is prone for errors resulting from a multiplicity of input points for a given item. (floor plan, excavations, wall sections and details);
I layout a set of grids( support lines)
select a level (1st, 2nd, 3rd etc floor, )
place columns from the column library and locate them on grid intersections
place beams from the beam library and locate them by their supporting columns
place plank from the plank library and locate them by their supporting beams
now, if a grid line is moved, the associated columns move, the beam location and spans change, the plank location and spans change.
Now is a change levels, the column length changes etc.
this is all done automatically. Sort of like a "solid modeler" which I had tried.
Sorry to be so verbose, and I thank you for you patients.
Hmm... honestly I don't see anything 3D in the second image you attached to the last post.
Bookmarks