How to change width of individual QBarSet in a QStackedBarSeries? - c++

I'm trying to create a mosaic plot series to include in a widget.
QStackedBarSeries seems like the best place to start but I'm unable to change the width of individual bars in it. (please correct me if there is a better/simpler starting point!)
I digged through the QBarSet to see if I can subclass it to scale it's width but it appears that the graphing is done in the QStackedBarSeries.
Is my only option to subclass QAbstractBarSeries to make the bar widths customizable?
Thanks!

Related

How to include bars in in a QChart with QValueAxis?

I need a combined chart showing multiple lineseries (given by x,y values) and bars (given by x_start,x_end and y values; somewhat like a histogram) in QtCharts.
Unfortunately it is not possible to assign a QValueAxis to a QBarseries, so I can't just include a number of bar series. I tried using QCandlestickSeries, but it seems like even though the timestamp is supposed to be a qreal type, candlesticks are only put at integer values (Bug?).
I was also thinking about making my own MyBarSeries class inheriting from QAbstractSeries, but that seems complicated. Another alternative would be to combine a QValueAxis and QBarCategoryAxis somehow, but I need zooming and panning in the chart which makes this difficult aswell.
I would highly appreciate it if anyone had an idea on how to do this, or could show me in the rigt direction.

How do i increase the size of my tooltip in c++/cli?

I want to increase the size of my tooltip as i want to insert an image as background to my tooltip. I am able to apply an image to my tooltip but the problem is the size of the tooltip being small only the upper part of the image is being displayed.
I am displaying image using Graphics Draw Image function. And I want the tooltip to take original size of an image without creating a rectangle as I tried all already.
I don't want to create my own tooltip. Just increase size of existing one.
I resolved it!! Just needed to add spaces on the property Tool tip on mytooltip on that control on which tool tip is used.Here i have used tool tip on my buttons.

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.

what's the best way to display images in qt? also I would like to zoom in to particular areas as well

I've been using label to display images. I'd like to be able to click and create a bounding box then be able to drag the cursor to move around in the image. What would I need to do this? Thanks.
I'm not 100% sure I understand what you are trying to do, but I think the QGraphicsScene is what you are looking for. You can (among many other things):
Render images (QGraphicsPixmapItem, for example)
Change the zoom level when rendering the scene on a QGraphicsView.
Select things using a "rubber band"
Move items around with the mouse (see QGraphicsItem::ItemIsMovable)
etc.
You may need to get familiar with Qt's graphics view framework.

How to display different size images in CListCtrl

In my MFC program,I want to display different size images in a list!
I use CListCtrl and CImageList!
But the CImageList only can load fixed images!
Variable row heights in CListCtrl is not supported. You could take a look at this article that describes a control based on CWnd that handles drawing of variable row heights.
I would consider to use the so called "owner drawn" mode to draw these myself. I don't know about another option (there is no built-in mode)... Maybe you can also take the biggest size and fit the smaller images into the bigger frames but I think it will be the same effort and be less efficient...
I mean use the
CListCtrl::DrawItem()
method
Create a "grid," a non-symmetrical grid most likely, on a dialog or Form. Then populate it with irregular shaped images as you choose. If you need more space look into a Scrollable “whatever,” view, dialog, etc.
Irregular or non rectangular shaped bitmaps seems a good place to start.