How to limit QPushButton from bieng smaller then the size of its text? - qt

Unexpectedly for myself I found out that buttons impudently ignore the size of the text and easily cut it with a decrease.
Is there something like sizeAdjustPolicy as at QComboBox? If not, what is the correct decision?
In Google and other places I didn't find anything intelligible.
Thanks in advance!
edit2:
I used Qt Style Sheets, cleaned - works fine. Have to give up beauty.
Solution: it was in Qt Style Sheets. If there to use min-width property then something spoils and the button ignores the text size.

To prevent a button from getting too small, set its horizontal size policy to MinimumExpanding. I don't see a reason to use stylesheets for that.
If you wish to manage the size of the button yourself, you can get the minimum size hint of any control by using the minimumSizeHint method.

It was in Qt Style Sheets. If there to use min-width property then something spoils and the button ignores the text size.

You can refer to this question to determine the text size and set the button width according to it using QFontMetrics.

Related

bulma - adjusting typography sizing efficiently

I'm having a hard time figuring out the most efficient way to resize text for mobile. I know per the documentation, making the text size responsive to the screen is fairly straightforward, simply add the is-size-*-mobile class to an element to reset the text size to the value of * (1-7) for mobile devices. What elements are the best place to do this? For example, I would like to be able to have all the text on screen change to size 7 on mobile, but so far I've had to add the is-size-7-mobile class to almost every text container on the page. While it's not impossible to do, it seems to be defeating the purpose of having such a class available through CSS.
Any tips would be greatly appreciated.
Although they lack a specific example, those Typography helpers are meant to be added to the element that holds the content you want to modify.
For example, if you want to modify the whole document consider adding it right to the body element:
<body class="is-size-7-mobile layout-documentation page-helpers">
The above example works on their documentation page you liked in your question. Just hit F12, add the modifier, and voilĂ , all the page changes text size.

how to apply css to the input type file for setting width?

i want to set the width of the html tag . And also apply css on the browse button which is provided in the input type file.
I referred the following -
Is there a way to set width of for showing in Firefox?
also referred following-
Setting uniform width in all browsers
but it is for specific browser. It should work on the mozila firefox , netscape navigator, google crome,safari etc. and i don't want to hide the original input control.
how to do this?
The short answer is that you can not really style the input file, and it's like this by design.
how ever, some tricks are available for you, for example:
http://www.quirksmode.org/dom/inputfile.html
You don't. It doesn't work that way.
You can specify the size of the element, but the browser chooses itself how to use that space to display the input field and the button. You can't style the intput field and the button separately.
It's not even specified in the standard that the file input should have an input box and a button. The browser can display the control any way it sees fit, and some browsers displays it differently, for example using a button and a text label.

QTableWidget colors, styles

I'm quite new to Qt and I'd appreciate the ability to customize a QTableWidget. I found a nice CSS-like interface using the stylesheets as shown here
http://doc.trolltech.com/4.3/stylesheet-examples.html#customizing-qtablewidget
However, I need to change some more specific styles (like grid color, items background color and so on).
I couldn't find any documentation describing the properties that might be changed via stylesheets.
Thanks for any help.
EDIT
Thanks, it helped a bit...however i still missed some other properties as grid thickness, but i "solved" it by inserting a row/column with 1px height/width to double the gridline :) And the QTableWidgetItem::setBackgroundColor() was also helpful.
However, I'm still facing some issues with QTableWidgetItem, the text keeps hiding if the column is too slim...only 3 dots appear. Dont you have an idea? I need the text to be visible, even if a bit clipped, but from the problem definition I cannot resize the column.
Isn't
http://doc.trolltech.com/4.3/stylesheet-reference.html#list-of-properties
the list you are looking for?

sifr: Opera-Bug: Flash Object too wide

I have used sifr to replace the fonts for headlines. It works fine in Firefox and IE.
http://design.speak-friend.com/
In Opera however, the headlines of the articles (object-tag within a-tag with-in h1-tag) get as wide as the used text is. If I limit the size of the object-tag via css, it just get's cut off (meaning some text is not displayed at all).
Is there any solution to this?
thanks
I had this same problem. I used jQuery to increase the size of the embeds by some set number of pixels, like +40px. I guess you could also grow them linearly, like by 120%.
I'm curious to see how other people solved this problem.
That's odd! I'm going to assume that Flash doesn't suddenly behave differently, so the problem is in reading out the width of the HTML element. I supposed you could try limiting the width of the main element you're replacing to see if that helps. Or perhaps place the text in a <span> and replace that?

underline line thickness always one pixel

...regardless of font size.
Its an mx:Text object. (The Text object is actually being used as a mask so don't know if that's the problem.) If underline is set with the <u> tag in Text.htmlText, or Text.textField.setTextFormat, the underline thickness is always just one pixel which is not acceptable. (There are other problems with <u> so I'm limited to using setTextFormat currently.)
Can the thickness of an underline be set through CSS? (textField.styleSheet, etc.)
I may have another problem as I already use setTextFormat extensively, and the documentation says you can't use textField.setTextFormat if you use textField.setStyleSheet.
I primarily need the underline to simulate correctly the look for an anchor tag.
its not even possible to do in html (you need to use border-bottom). i don't think this is possible.
Not possible with CSS or TextFormat.
A possible workaround would be using the textfield metrics (probably through getCharBoundaries()) to manually draw a line under the desired text. It can get quite messy for multiline text though.

Resources