I have a GUI application based on Qt (PyQt) running on Mac OS X (and other platforms). It allows the user to select fonts and has check boxes for bold and italic options.
On updating to the new Cocoa-based Qt, a user found the QFontComboBox no longer displays the different font styles (e.g. condensed, oblique, bold...) and just displays the font family name. Under Carbon it showed both. The user also cannot enter the name with the style in the combo box. Furthermore, I cannot construct the same font passing the name into the QFont constructor.
QFont doesn't seem to know anything about these missing styles. Confusingly it has another different notion of style. It looks like QFontDatabase has the information about the style variants. It can also construct fonts based on a family, style and point size.
So, are the following changes the correct approach?
Rather than have bold and italic buttons, have a combobox filled with the styles from QFontDatabase for the font selected in the QFontComboBox.
Store the style in saved documents (as text), rather than bold or italic.
So
Can I rely on the style being the same on systems with different languages? Can I include it in saved documents?
Is a style "Bold Italic" as robust a way of making a QFont with the desired properties, than setting the bold and italic properties of that QFont?
If I want to retain bold and italic checkboxes, how can I convert these attributes into the correct style? Can I just guess "Bold", "Italic" or "Bold Italic"?
Related
I'm trying to find a way to use styles to set the color of the selected text in a TEdit in Firemonkey.
In Delphi VCL, the text color by default changes to white (or perhaps a windows constant) when the text is selected, so that it shows clearly through the selection highlight.
In FMX, the default style is for the text color not to change. That results in the text being hard to read. I'd like to set it so that it works like VCL, but I can't find anywhere in the style to set the text color of the selected text.
Thanks for any help you can provide.
Scott
Goal: Change font family, and apply new font family to all instances.
Ex: On the image bellow, the Open sans text is set as a component, and the weights, are set as an instance of the component.
Then I wanted to change to another font family, and have the instances reflected that change, showing the new font family with corresponding font weights:
Challenge: If I set everything as font styles (headers, body, etc), then I need to manually one by one when I want to test a new font. That is why would be convent to have a master component that sets the font family and passes that to all typography system.
Question: How can I add instances that change according to the font family?
I'm quite new to Vuetify and struggling to figure out how themes, components and text colors work together (if they do at all).
I want to work with theme color names in my templates like primary, secondary, warning, error and assign colors to those keywords by adding a new theme or overwriting the existing one.
This all works out of the box but the problem is I can't figure out how to set text colors in the same way. I want to assign a primary-text-color, secondary-text-color, etc. and have it automatically use the correct text color by default.
Text colors seem to change automatically when I change the color on buttons but nowhere else.
If I add a theme color to buttons, Vuetify automatically changes the text color to be readable, for example (just using the default theme):
<v-btn color='primary'>Test</v-btn>
Text will change to primary and the button will be perfectly usable
while a lighter color will have dark text:
<v-btn>Test</v-btn>
But other components don't behave the same. For example a v-app-bar component with default color has dark text on a light background, but a primary app bar keeps the dark text on a blue background.
It looks like I need to explicitly change the text color with a helper class or similar, and even then I'd have to use something like white--text instead of primary--text (which just applies the actual primary color to text).
I think I've read all the docs on the website but I can't find any reference to this particular problem
Sorry for the links to images, I don't have enough flair to embed them in my post.
currently, this works primary--text
<v-list-item-title v-if="company_name" class="title primary--text">
{{ company_name.company_name }}
</v-list-item-title>
I'm using Qt Designer to lay out a form with QLabel, QLineEdit and QComboBox controls inside of QFormLayout and QHBoxLayout containers. What do I need to do to have the controls aligned vertically by their text's baselines?
When previewing the dialog on Max OS X, the different controls do not align by their baseline. The following example is using QHBoxLayout, but the same happens with QFormLayout:
Notice how the underscores are not on the same vertical position.
I'm looking for a solution that will work with all widget combinations where baseline adjustment is applicable and where the adjustment is done automatically based on style, platform, widget combination, widget sizes and font settings. Something comparable with CSS's vertical-align: baseline;.
Update
I've done the same test on Windows XP and also applied RA.s suggestion of using a style sheet. But that does not seem to change any of the placement of the controls or their text.
If I understand your question correctly, you need to change the vertical alignment of the QLabels. In Qt Designer, you can accomplish this by clicking on the QLabel, then adjusting the label's alignment property. In this case, I believe that changing the vertical alignment to AlignBottom might fix your problem. If that doesn't work, the label also has a margin property that you can adjust.
Update
Consider using Qt's style sheets for your application. The following style sheet achieved the desired result on the platforms that I could test on (which, unfortunately, does not include OS X):
QLabel, QComboBox, QLineEdit
{
background-position: bottom;
}
I built a very simple application with nothing but a single NSTextView in it in xcode / interface builder. I've done nothing to the text view other than change the font face to "Arial" and increase the font size. However, it looks a lot less bold on OS X 10.5 than it does on 10.7. What's going on here?
(10.5 in the top window, 10.7 in the bottom window)
I've tested with Helvetica and got the same results, so it's not something to do with this specific font.
If you enlarge that image enough, you'll see color fringing on the 10.7 sample. This indicates that the text was rendered with subpixel antialiasing, more specifically, using a RGB subpixel ordering. The 10.5 sample uses grayscale antialiasing. While it is generally a good idea to use subpixel rendering, it can look bad on low-resolution screens or CRTs, and it can't be used in a multi-monitor setup where there is more than one subpixel arrangement to contend with. This means that some users will have subpixel rendering enabled for their system, and some won't. Don't try to circumvent that setting in any way, either by overriding the system preference for font smoothing, or by pre-rendering the text into an image. Users are far more likely to notice the one app whose text looks wrong on their system than they are to notice the difference in rendering between two different machines.