Can you please provide me how to make diamond shape in graphiti , i have tried it using RestoreBridge example but that example is SVG import so please provide me some idea or code for making diamond like shapes ( resizable and draggable diamond ).
Thanks in advance:)
"Diamond" shape is part of graphiti 0.9.34
inspect the package "graphiti.shape.basic.*"
Related
I just want to ask that I have my custom shape physical body, let say, I have a STAR having four outside and four inside vertices, and made with Physics Editor.
By using that Plist generated by Physics Editor, the body shows and behaving just perfect, but problem is that I could not get fixture(s) of that custom shape to get collision detection or any thing else.
So, how could I get the fixture(s) of custom physical shape body made with physics editor, so I can detect collision?
P.S: I have MyContactListener class that is working fine with basic shapes like circle and line.
Thanks in advance.
I am implementing Qt Model/View architecture and need little help please.
I have a QAbstarctItemModel which is a tree model and serves the QTreeView and it works. Now I need to display the same data in QTableView for which I need to flatten the tree model. This is where I am lost and need help. I have QSortFilterProxyModel to help me. I can't figure out how to override mapToSource and mapFromSource functions.
This is the same question asked, but no code examples were given.
QTreeView, QTableView, display items of different hierarchy layers
Problems with displaying data in QListView
Could someone please provide some example code.
I recently answered very similar question with code examples, I hope they will give you an idea where to go.
General rule, think about proxy model as about coordinates transformation, so you have to right a class which will transform coordinates from your source model to destination and other way around..
I am using box2d based game and i want to detect collision between my sprite body and edge body. I know use of b2Contactlistener in this tutorial but i want to use contactlistener in simplest form.
Is any one know than help me.
Thanks
This has a simple example (same site): http://www.raywenderlich.com/28606/how-to-create-a-breakout-game-with-box2d-and-cocos2d-2-x-tutorial-part-2
I want to show the grid lines in a graph created using vtkXYPlotActor.
Can you suggest me how?
Thanks.
With the vtkXYPlotActor class it is difficult modify the underlying (generated) plot data and settings.
You are better off using the vtkChartXY class , which allows this easily using something like
vtkSmartPointer<vtkChartXY> chart = vtkSmartPointer<vtkChartXY>::New();
chart->GetAxis(0)->SetGridVisible(true);
chart->GetAxis(0)->SetGridVisible(true);
If you don't have access to the vtkChartXY class you have two options both of which are more work than upgrading.
Attempt to make your own version of vtkXYPlotActor that uses
vtkAxisActor instead of vtkAxisActor2D, either through
subclassing or from creating from scratch.
vtkAxisActor has the 2 relevant modifiers for gridlines vtkAxisActor::SetDrawGridlines and vtkAxisActor::SetGridlinesProperty, whilst vtkAxisActor2D doesn't have these.
This is non trivial.
Make a 3D plot and move the camera so the plot looks like it is 2D.
Further VTK references include
VTK Plotting Examples
vtkChartXY Class Reference
vtkXYPlotActor Class Reference
I am using a QGraphicsPolygonItem and I have noticed that it always connects the end-point with the start-point.
I know that the polygon terms means exactly that, and what I am looking for is "polyline" or "polygonal chain". I didnt found nothing like that in QGraphicsItem subclasses.
How do I draw a polygonal chain in QGraphics Framework? Is there a property of QGraphicsPolygonItem or a class that does that?
I had a similar problem, and I solved it by using the QGraphicsPathItem class. In the following code, polygon is a non-closed QPolygonF object (i.e. a QPolygonF which start-point is different from its end-point):
QPainterPath path = new QPainterPath();
path.addPolygon(polygon);
QGraphicsPathItem contour = new QGraphicsPathItem(path);
contour.setPen(new QPen(QColor.black));
When displaying this QGraphicsPathItem object, the start-point is (in theory) disconnected from its end-point.
I'm sorry this example code is in Java; but the mechanisms should be the same as in C++.
You can use QPainterPath and use lineTo method to input yors polyline points, then just use QGraphicsPathItem to make it graphics item.
Alternatively you also might think about combining several QGraphicsLineItem into one QGraphicsItemGroup, but that's more difficult as you need to pay attention to aligning lines together.
Is this what you are looking for?
EDIT:
QPainterPath is apparently closing paths, then you are left with group of lines only.
EDIT2:
Sorry for confusing you, but HostileFork seem to be right - you just use QPainterPath and call pathItem->setBrush(QBrush(Qt::transparent)); to keep your path unfilled.