Set font color in a tr() function - qt

I am thinking of changing the color of some text in a tr() function.I am thinking of
tableModel->setHeaderData(2, Qt::Horizontal, tr("<font color=red><i>Org. Name</i></font>"));
Will it be possible to change the font color?.

I don't think that providing an HTML string will change the appearence of the text and even if it works it is not the best approach to mix the content with the styling. You should use stylesheets and change the color of the header view of your QTableView.
QString styleSheet = "QHeaderView::section {"
"color: red;"
"background-color: black; }";
tableView->horizontalHeader()->setStyleSheet(styleSheet);

Yes, the whole HTML string will be offered for translation, including the markup. If you want translators to mess with the HTML, your approach just works. Usually one wouldn't want translators to mess with (and possibly break) the HTML markup, then one would use something like this:
QString::fromLatin1("<font color=red><i>%1</i></font>").arg(tr("Org. Name"))
I.e. mark only the actual text for translation, instad of the whole html string.

Related

change color by text in css3

i came across the following code. this code should automatically change the color of the text by specific word or other characters. the code does not work for me, is really supposed to work or is it not true
#text [all "(" ] {
color: blue;
}
The code is at the bottom of this page.
No. If you want to do that, you need to do something awful like giving each character a span with itself as the class, or (my preference) use Javascript. Knockout is a great library that can let you apply classes or CSS styling based on the values of variables or functions (among many other useful things), so if you have a table and want negative numbers to appear in red, your <TD> tags would look something like:
<td data-bind="with: someObject, text: someProperty, css: {'isRed':someProperty()<0}"></td>
and you'd need a JavaScript object like
var someObject = {
someProperty: ko.observable(0);
}
Then you just need to apply your Knockout bindings and you're set!

Can I Add Custom Formatting Markup to MediaWiki?

Is it possible to add custom formatting markup to MediaWiki?
Say, for example, I have a div style I use quite often and I'd like to make markup to apply it more quickly than using <div id="frequentlyusedstyle">Title</div> -- like surrounding the text with ##Title## instead of typing out the div id. Is that possible?
(I realize that there is already heading markup; that's just an example. Thank you in advance!)
Just create a new page named "Template:name", where 'name' is whatever you want to name it, with the following text (as per your example):
< div id="frequentlyusedstyle">{{{1|}}}< /div>
(minus the extra spaces, since I don't know how to keep html from
parsing here.)
You would then use it by adding {{template name|Title}} to an article, and it will invoke the style.
You will need to have a style defined in MediaWiki:Common.css or similar, in order to style that div, such as:
#frequentlyusedstyle {
color: red;
}
Hope that helps.

Visual Studio Standard Style as CSS

I'm searching for the correct style to configure CopySourceAsHtml to change my Selenitic style to default Visual Studio style when I copy and paste it to e.g. an e-mail. Does anybody know what CSS style(s) I need to use to set it up correctly?
When I copy & paste source code an e-mail I get a dark background. If I set it to white it will show all text in light colours which are hard to read. So I need to change the complete style.
How does your plugin expect the CSS to look like? If you open the theme I referred to in the comments above in a text editor you'll see a lot of lines like this:
<Item Name="outlining.collapsehintadornment" Foreground="0x00E8DDD7" Background="0x00FAF7F6" BoldFont="No"/>
Now since I don't know how exactly your plugin is expecting the CSS I will go ahead and give an example of what this might look like in CSS:
.outlining-collapsehintadornment
{
color: #D7DDE8;
background-color: #F6F7FA;
}
Or:
<Item Name="String" Foreground="0x001515A3" Background="0x02000000" BoldFont="No"/>
Becomes
.String
{
color: #A31515;
background-color: #000000;
}
How did I get this?
Visual Studio settings file save color codes as "code hex" values. And they use BGR instead of RGB. This means that you can convert this VS color hexes very simple to HTML color hexes. And since HTML uses RGB don't forget to invert the code. So for example:
0x00E8DDD7. Replace the 0x00 (sometimes this may be 0x02) with a #. And then swap the first 2 and the last 2 characters (BGR to RGB). So you get #E8DDD7 = #D7DDE8. And of course "Foreground" is text-color and "Background" is background-color...If your plugin supports it you might even consider to write font-size: bold if you see BoldFont="Yes" in your XML.
Summarized: Open the VSSettings file I referred to in my comment above in a texteditor. Then convert everything to CSS. Write a simple program to do this, or do it by hand, whatever you prefer. Just remember that this is just an example of what it might look like. I don't know what "CopySourceAsHtml" is expecting your CSS to look like.

How to remove undesirable text/HTML tags from FLEX LineChart's custom dataTips?

I wrote a function to override my FLEX LineChart's datatips because the default datatips were ugly and rather boring.
I finally set the style I wanted but am now having some problems removing un-necessary tags from being displayed in the custom datatips.
For example, the datatips now display things like this:
"<b>Humidity</b></BR>2010-07-05T00:15:00"
I can always perform a "Replace()" to remove those break and bold HTML tags, but that seems really un-necessary and anti-development.
I am using this to set the dataTip's label text:
var hd:HitData = value as HitData;
var item:LineSeriesItem = hd.chartItem as LineSeriesItem;
_xAxisText = String(hd.displayText + ' ' + item.xValue);
Why is [displayText] displaying HTML tags I must parse out? How can I format those tags out of my text's value? Is there a setting?
I understand the HTML tag's purpose, although they are not being used by FLEX (apparently). I just dont understand how to remove them from the text. I already set my style attributes in the container, which I think would override these tags? Could that be why they are appearing?
Any ideas or suggestions? Thanks!
Flex should definitely be using the HTML tags to format your dataTip. Check this article.
Because you are seeing HTML tags in your dataTips, I am wondering if you perhaps implemented the dataTipFunction incorrectly. If you are able to, you should post a little bit more code.

persistent header of text (CSS) in a div

I have a div called "appHeader"... and the content of it is subject to change dynamically.
I'd like some static text at the top of that div that is highlighted ... and have this done in css.
The text is going to say something like "Property of such and such... etc" but it is static.
Can you create static content within CSS?
Is this possible?
TIA,
Kirby
p.s. I can only edit my apps CSS. :-p
Well you can always use the content property.
So something like
.appHeader:before {
content: "My static text that will appear";
}
Though it is generally not advisable. (I'm not sure which browsers support it edit: The content property is supported in all major browsers. It is an accessibility bad practice).
You can insert some content with CSS, like this:
#header.after {
content: "Text after";
}
But it's terrible. This is a big hack.
Another option, besides a #header.after solution, would be to make an image containing the text you want and use it in the background-image property.

Resources