Draw.io autosize by keeping width fixed, and expanding height if needed - draw.io

Is there a way in draw.io, to autosize a text container, keeping it's width fixed, and telling draw.io to only adjust the height if neccessary?
I tried out almost all options in the properties of the text box, but when I apply the autosize, it always overwrites my set width and height, by making the width larger, and the height smaller.
I am putting these texts inside a swimlane, and what I would like to achieve is, either:
when I add text to these text rectangles, the rectangle and the swimlane should expand automatically, but only vertically, ie, only the height of it should change (this would be the best for me, so that it is automatic)
if the automatic solution is not achievable, I would be happy with something like manually pressing the autosize button, and draw.io should keep my width fixed, and change the size of the height only.

Couldn't find any documentation anywhere. But I notice that the behaviour of auto wrap is different depending on the object type that you choose. For example,
The above one is a "Rectangle". it won't resize the width when auto-sizing. The bottom one is a "UML/Object". It will resize both the width and height.

Related

GTK Treeview fixed width

I have a window structured in the following manner:
Window>VBox>Scrolled Window>Tree View>Columns
My issue arises when I label the last column (it must be a dynamic assignment). If the label winds up being too long, the containing window gets stretched horizontally. Instead, I would like a scroll bar to appear at the bottom of the Scrolled Window to deal with it, leaving the window at its original width.
However, it looks like the closest I can come is fixing the height of the Tree View. Surely there's a way to fix the width?
Do you have some code to look at? I have done this many times in python and never had any trouble. Also, you link to the fixed height property of the Tree View rows, you actually need the requested width property of the scrolled window. That link also has a link to set the size of the window.

QScrollArea vertical sizePolicy - Fit contents up to maximum height

I've had a real challenge getting QScrollArea to take the minimum space possible up to a maximum height.
My GUI model is as follows: A QScrollArea contains a vertical layout which is populated with a widget of class TableRow. I want this class TableRow to take up the minimum height possible. It has a widget at the top which is always visible, and a QScrollArea below which has a label inside it whose visibility can be toggled. The label is for notes which may be 0 characters or may be infinite in length (hardware limitations aside).
I've found that for a label in class TableRow setting the vertical sizePolicy to Fixed will actually take up exactly how much it needs to fit all the contents (see: Qt Layout, resize to minimum after widget size changes). However this doesn't appear to work with QScrollArea. In fact every sizePolicy I've tried keeps the QScrollArea at a fixed height; except for Ignore, but then the QScrollArea goes to a height of 0, regardless of its contents.
I've created a git branch producing a simplified version of this problem.
Here is the result of applying a fixed vertical sizePolicy:
What I'm expecting from this test case:
The first widget's height should be almost 30px (the height of the upper widget) only showing the borders for the QLabel and QScrollArea
The second widget's height should be shorter than 130px (the maximum height of the QScrollArea being 100px) but large enough to show the label without scrolling
The third widget's height should be 130px, and the scrollbar should appear (this part is correct in every case I've tried except for when the vertical sizePolicy is set to Ignored )
I understand I may need to override some things to make this work, as by itself it's not obvious why a QScrollArea's height might be dependent on its child widgets (which is probably why it was not designed to make this easy, or at least it seems like it wasn't).
However, I think the case I'm trying to make is common enough, and my current approach is justifiable. If there's another/better way to make an individual widget scroll after it reaches a maximum height I'm open to that as an answer, provided it meets the three conditions I'm expecting.
This feels more like a hack than a solution, but it does work for me, at least in the short term. Because the text for lblNotes does not change runtime, I was able to add the following code in the constructor of my TableRow widget:
// Hack to resize QScrollAreas
ui->lblNotes->adjustSize(); // Otherwise lblNotes will think its height is still ~0px
int height = ui->lblNotes->height() + 12; // Borders and margins add up to 12px
if (height > 100) { height = 100; } // Cap the height at desired maximum value
ui->scrollArea->setFixedHeight(height);
Should I have to deal with the case of dynamically set text, I could wrap this in a function to be called anytime the text of lblNotes is set.
I'm still open to solutions that involve using the layout features Qt has natively as I believe that would be preferred if a solution exists. Some QScrollArea contents may not be as straight-forward to determine the height from in the future.

Flex Slider full height and width without stretching

I need Flex Slider to occupy the entire page, like the one on this website: http://webfire.co.uk/
I've set both height and width to 100%, but when I re-size the page, it causes the image to distort and stretch. However, setting the height to auto leaves a white space underneath the slider, so it doesn't fill up the full page. The same thing happens with background-size:cover - the width becomes responsive but the height stays the same.
On the website above, they manage to sort of re-center the image when the window is re-sized.
Any suggestions? :)

Resize QToolButton with text

I have a QToolButton with a text using toolButton->setText(....). However, the text is truncated when the button is rendered. I have tried increasing the width of the button using resize() and setFixedSize but the text is centered and still truncated. Any ideas how to make the button follow the width of the text ?
You can use QFontMetrics to calculate the minimum size needed to display the whole text. The boundingRect method returns a QRect corresponding to the size of your text. You can specify flags like Qt::AlignHCenter.
http://qt-project.org/doc/qt-5.0/qtgui/qfontmetrics.html#boundingRect-4
You can subclass QToolButton and reimplement the setText() method to include a call to resize() or manage the size when you call setText().
Try to set the same minimumSize(w,h) and maximumSize(w,h) with correct values, I mean, for example:
In Design, in the property window of your button:
width and height in geometry - 80x88, minimum and maximum must the
same.
It works for me in my case. And pay attention on icon size of the button, if it is.

Get the "padding" around a control

I use win32 to generate my interface.
I'm looking to get the padding that windows naturally puts around controls. For example, in a tabcontrol the height of the tabcontrol includes the height of the border at the top and the height of the tab headers at the top. Same goes for buttons.
I'd like to know how I can find the exact height of these extra paddings before I create the actual control, as I need to add them to the height and width so that the client area of the control is the right size after creation to host content which has a static exact size.
Refer to AdjustWindowRect for adjusting windows for padding.