Show data with Rapheal on click - raphael

I am hoping to use Raphael to draw a map and colour code according to a result for an area. That bit I can do. What I would like to do is if the user clicks an area that somewhere additional data appears. Is this possible. Within each element in the Raphael JS file, can I include a data source?

Related

How to take a screenshot of a particular QWidget in a tab in QT and post it in another tab?

I have a tab that is to display data that is to be prepared for a report. Kind of like a preview. What I want is to take a screenshot of graph generated in another tab.
Kind of similar to scanning an image. So the initial tab generates 3 graphs under each other that fit in the screen. I basically want the screen shots of the graphs to post them along with the data in the second tab.
The second image is where I want the content of the first image to be posted. How do I go on about that?

QTextEdit "pre-allocate" canvas size

I'm writing a simple text editor client that receives a given file in chunks, instead of reading it all in at once. For example, if I have a 10,000 line file, I'll only get the first 25 lines + some slop when I open it up in the client. As I scroll down the file, it'll load the lines that come into view dynamically.
I've got the dynamic insertion of the file contents working as I scroll around the file. However, I want the QScrollBar to reflect the full size of the file when a file is opened, instead of just the current contents of the QTextDocument.
Here it is in screenshot form:
The QTextEdit and QScrollBar when a file is initially loaded with just the first chunk of lines.
The same thing, once I've scrolled to the bottom of the file and the rest of it has been loaded.
Note the smaller QScrollBar slider.
I'm wondering if there's some kind of way to preset the size of the underlying canvas, i.e. it would be easy to calculate the height of the full document in pixels, and then make the QTextEdit scroll area that size. Preferably without having to resort to painting. Any other ideas are also welcome.
You need to start with programmatically setting the range of the vertical scrollbar:
textEdit->verticalScrollBar()->setMaximum(numberOfLines);
See the documentation for more details: QAbstractSlider::setMaximum()
In addition, you will probably need to implement custom behavior when the QAbstractSlider::sliderMoved(int) signal is emitted. The idea is that your canvas stays small, it only provides a small window on the complete text.

Change the order of ColumnLayout or ListView and save / restore it

I'm working on a stream overlay that extracts information out of a game (flight simulator) and displays it on the screen. Right now I'm using Qt in conjunction with a *.html to render the overlay. It is all working really well, however I wanted to add some customization options for the users of my overlay software and I figured the best way would be to render the Overlay in QML.
The main part of the overlay is a row that contains around 8 "elements" that display the relevant data.
One thing that should be customized is the order of the elements in the row. But I really have no idea how to implement this feature. I've seen a few posts and tutorials on how to customize the order in a View using the DelegateModel. However right now it's not a view but QML Components inserted in a RowLayout due to the fact that they are all different components (e.g. some of the images are actually animated for which I'm using a component that uses Canvas2D to draw the images). I guess I could figure out a way to store those elements in a model using the Loader Component to display the content in QML. But even then I'm not entirely sure how to store and restore the order of the elements. As far as I can tell the DelegateModel only changes the View and not the underlying model.
Any suggestion or best practice to accomplish my goal would be highly appreciated.

MFC CGridListCtrlEx

In MFC CGridListCtrlEx how can I insert image to the right of the cell. I can add image to the right but that works only for the column heading by using flag LVCFMT_BITMAP_ON_RIGHT. All I want to do is to add image to the right of cell, by default the images are getting added towards the left.
I believe only LVCOLUMN not LVITEM allows for alignment. Which you have discovered. I think your only recourse may be Owner Draw for each cell which might also give you more layout flexibility.

How to determine the content step value of scrollarea

I'm making my own UI from scratch using OpenGL that is why I'm asking this and please don't make any discouragement as this is just a hobby project.
Currently, I'm stuck implementing how this scrollbars really work. In my current implementation, the content scrolls at the wrong step value as well as the thumb, meaning, I set the value manually like 1px step for each of them.
The structure of my scrollbar implementation is describe as follows:
I draw scrollbars i.e the main rectangle where the 3 button lies.
Those 3 buttons are, thumb, buttonBack and buttonNext.
All of them do the basic logic of scrollbars i.e when I click each one of them, they moved. But the whole part(scrollbar) don't know how to scroll contents
So what I did is: I make another object and I call it scrollarea
It has two scrollbars, vertical and horizontal scrollbar.
I made a function called scrollToX and scrollToY which
does what I named to them.
But the step values I set to them are
manually set up.
I try to google some scrollbar, scrollarea, scrollview or whatever you call to that scrollable rectangle thing, but all I see are implementation and I cannot find any guides how to build your own. I have no choice but to look at their implementation. I try my best to comprehend what they did but their implementation of how their whole UI structure is very different to mine, and I cannot find anything useful there.
So I ask again here if anybody can explain me well how to make a properly functional scrollbar.
Most specific things I'm really concerned of are:
How do I determine the thumb step value?
How do I determine the content step value?
All of these depend on your content -
Is it just an image ? If so, you only need to change the offset depending on the size of the image.
Is it a list of values like in Windows explorer ? Then you need to create a data structure first that contains all of it, and shows the content that fits within the window as it scrolls.
OpenGL does not fit into this discussion.