My software log some devices parameters and if the device is turned off i want to "interrupt" the series (i think i'll add a special value on the data to highlight a device off) and draw new points only when the device is turned on.
I'm using JavaFx LineChart (i don't want to change library)
Sorry for my very no talent using paint!
You should treat each line before and after the break as a new series in the chart. You can keep the colors the same by assigning them to a custom css style class, and defining the class in your application's css file.
Related
I need to render lots (hundreds) of similar spheres and cylinders with different transforms. Currently this is achieved by creating hundreds of identical QEntity objects. The result is the app's constantly consuming 20..70% of CPU -- even when the scene is still.
Is there a default source of update events for the widget? If there is one, can I turn it off or reduce its frequency? There seems to be no other source of CPU load but the Qt3D widget.
Did you have a look at the enum of the QRenderSettings class? It seems like you can set the render policy to OnDemand which causes Qt to only render the scene when something changes.
Alternatively, if you don't need interaction with the scene you could have a look at my implementation of an offline renderer. The underlying QAspectEngine starts and stops whenever you set a root entity. You could set your root entity, capture the frame and unset the root entity, causing the graphics loop to stop which would result in less CPU load I would guess.
In Qt3D 5.9, I am using scene 3D to render an .obj file and display it. I also have enabled object picking, so when a user selects part of the object, I know exactly where on the model they clicked. What I would like to do is add color to that part of the obj/mesh that the user clicked on. To be more specific, for the 'y' value that the user clicked on, I want to color a line all the way around the object model on that 'y' value. I've looked around online and can't find anything to help. Unfortunately I'm not familiar when it comes to 3D objects, meshes, etc. How can I color just part of a mesh in Qt 3D 5.9?
Since you managed to load your own meshes, I suppose you understood how the GeometryRenderer and Geometry QML Components work. The Geometry component takes attribute that define (for instance) the position and normals of your object. The names you give to these attributes allow you to retrieve them in custom shaders. You can add an Attribute in your geometry that defines a buffer in which you will store vertices colors instead of positions and normals.
Then, you will need a custom Material (If you haven't a custom Material, try to read the QML doc to understand how it works. I know, the doc is not really complete but it is a good start)
This custom material will allow you to call your own shader, in which you can retrieve the color of a vertex in the same way you retrieve it's position.
So to conclude, since you want to color just a part of the vertices, you will need
A buffer containing all the colors of all vertices of your mesh
A Geometry attribute that tells how to read this buffer
A script that update the buffer on selection
A custom material and a custom shader that uses the color buffer to paint the object
This is a not-so-easy thing to accomplish, but it is possible and should give you a better undestanding of how Geometry, Materials and shaders work in QML.
If you are not familiar with these, I would suggest that you first put asside the par vertex color buffer and try to make a custom shader that paint all your object red. From that you will be able to go on and find out how to pass per vertex colors to your shader
Good luck
I'm using Altera ModelSim 10.1d for a verilog project for a class. I can't figure out how to run the simulation properly. I have a very simple verilog file (just a 2 to 1 multiplexer) and I want to try 4 different combinations of inputs.
According to the guides on Altera's site I've done the following:
1) Clicked Simulate->Start Simulation and selected the mux file
2) Clicked Add Wave in the 'Sim' pane
3) Then clicked run.
All I get are some flat lines. How can I modify the wave form of the inputs? Right clicking an input in the objects pane and going to 'modify' has a 'change value' option but it is grayed out.
Any ideas?
You need to create a testbench that drives the inputs to the mux. The simulator doesn't know how to do that without being told. You can manually fiddle with the inputs in the wave window by right clicking on them and selecting the force dialog to set a new value but it is tedious to use for anything but debug.
I am going to create Win Hex like application in Qt. I want to know which widget should I use for creating hex display area. I have to open hard disk in it so it would be a very large number of lines for displaying 500 GB of disk.
So, which widget can handle this large number of hexadecimal lines?
I have started to do it in QWidget's paint event but the height of QWidget is in integer so number of lines could not be greater than the range of integer.
So, should I use QTextEdit or QPlainTextEdit?
You use wrong way. Consider to use QAbstractItemModel + QTableView. Your model can use "virtual window". It means that your model holds only small piece of data which will be loaded on demand.
I am working on a multi -segment download manager. I want to display the segmentation procedure. QGraphicsScene works fine but , unfortunately it slows the download. Is there any better option, other than using QProgressBars.
I am using QNetworkAccessManager to download files. If I connect the downloadProgress signal of QNetworkManager object to a slot of Main Gui Thread which draws on QGraphicsView, the download speed decreases even upto 10 times in some cases
// a custom progress bar
void Download::showGProgress(int num, float prgrss) //slot
{
prgrss=prgrss/100;
x_coord=(ui->graphicsView_2->width()-3)*prgrss;
for(float b=0;b<=x_coord;b=b+0.5)
{
progress.addRect(0,0,x_coord,y_coord);
}
}
QNetworkAccessManager is not threaded. It is asynchronous, using the current threads eventloop. It is the HTTP requests which it create that are the threaded aspect.
This would explain why anything you do in your main thread could theoretically slow down the operations of the download. Though not necessarily the underlying threaded download itself, but rather the signaling response time that would allow you to have fast feedback about it.
What you should probably do is create your own QThread subclass, and create the QNetworkAccessManager in the run() method. And then create a QEventLoop in the thread and call exec()
In a nutshell, you need to create your own Threaded QNetworkAccessManager.
create your own widget to do what you would like
this is easier than it sounds.
Make a class that subclasses from a QWidget. And in this widget make a Horizontal Sizer that contains 100 Qlabels (store the QLabels in a vector). Give it slots to 'update' the current progress by setting the background color of each QLabel to a different color. This should be fairly easy to do progressively, meaning you store the current 'percentage' as a member variable and then only adjust the fields that are necessary to get to the percentage that you're looking for (This will eliminate some flickering if you were to do it from scratch every time).
Add functions that will switch the sizer to a vertical one instead of a horizontal one to make it even more customizable.
This allows you to get creative in the what you can do for the progress bar as each element could be a different picture, or a different color, or whatever you would like.
Did you try QProgressBar? Maybe you can write a subclass of it to handle your own properties.