I'm working on a Qt project and I'm struck on a QtDesign issue.
I've at the moment a 4x4 grid, like that:
Top Left (TL): SourceSelector
Top Right (TR): groupBox_vizualization
Bottom Left (BL): groupBox_filtrage
Bottom Right (BR): groupBox_spectre
I would like the SourceSelector to have a 100% width when I select one of the widgets in stackWidget_source. At the moment, when I select this widget I set the width of the "vizualisation" widget to 0, and hide it. I would like the SourceSelector to use 100% of the width in that case only. I order to have a grid (2)x(1 1).
But TL/BL et TR/BR always have the same width. So I can't make the TR one to use 100% as the BR has a fixed size.
Do you guys have any idea ?
Well, I solved my problem with a Grid Layout at the bottom and a HLayout at the top. Both of them placed in a VLayout.
Related
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!
when I run my application under Ubuntu (Gnome/Unity) all wxBitmapButtons come with a white border (with a size of about 2..4 pixels). This border also shifts the position and extends the size of the total button by the borders size.
When I specify flag wxNO_BORDER (or wxBORDER_NONE) the border is no longer shown by default bur re-appears on mouse-over.
So my question: how can I remove this border completely? Normal wxButtons do not show this behaviour, only wxBitmapButton is affected...
wxBORDER_NONE is supposed to work, so if it doesn't, it looks like a bug in wxGTK. It's pretty strange that it does work for wxButtons as wxBitmapButton is basically the same class. However if it's really the case, you should consider just using wxButton with a bitmap instead.
I created a simple 10x10 black box and added it to a QToolButton as follows:
QIcon minIcon;
minIcon.addFile("c:/tmp/black10x10.png");
minButton = new QToolButton;
minButton->setIcon(minIcon);
However, it appears on screen shifted left (image enlarged for convenience):
Some squinting in Gimp told me that grey area to the left is 56 pixels zoomed and grey area to the right is 68. This misalignment is very noticeable even without zoom - that was how I spotted it in the first place. So, how do I center this icon?
P.S. Tried using a QPushButton without text. Same effect.
It's probably a bit late now, but I stumbled across the same issue and found the following code snippet in QTs qstylesheet.cpp
case CT_ToolButton:
if (rule.hasBox() || !rule.hasNativeBorder() || !rule.baseStyleCanDraw())
sz += QSize(3, 3); // ### broken QToolButton
This would increase your even sized icon to be odd sized and therefor not centered. I'm not sure why there's an addition of 3 but the comment suggest it's a fix for something...
Unfortunately this doesn't fix the issue, it just kind of explains the source of it. But it might help someone to find a better solution than "make all your icons odd sized".
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.
In QtCreator I created a QSplitter which separates vertically a QTreeWidget from a vertical layout with many things on the right.
I would like that this second column by default takes the minimum space it needs to maximise the first one.
I tried setting sizes and vertical policy of the splitter as expanding but surely I'm not doing it right. How can I set this exactly?
You can set this in code with QSplitter::setStretchFactor(int index, int stretch).
You would set the first column to have a stretch of 1 and the second 0.
splitter->setStretchFactor(0, 1);
splitter->setStretchFactor(1, 0);