There's anyway to add a custom font (Such as Console Font) to Qt? How? And how do we set it to a Text Editor (QPlainTextEdit, QTextEdit, etc)?
Thanks
Qt uses your window system as a font provider. You can find out all the fonts available by using the QFontDatabase class. Anyway, it is possible to add a specific custom font for your application to use using QFontDatabase::addApplicationFont from C++ (available under X11 only if fontconfig is available) or using the FontLoader component in QML.
For QTextEdit you can use this and for QPlainTextEdit you might try the font property.
Related
How can i open printdialog in this style?
thanks,
That's the GTK print dialog. To use that style in Qt you would need to write your own class and encapsulate GtkPrintUnixDialog (and link in the GTK libraries)
How can I specify a default css file for a QML WebView in Qt 5.5? I am looking for a solution similar to the one provided by BlackBerry for their Cascades framework https://developer.blackberry.com/native/reference/cascades/bb__cascades__websettings.html#property-userstylesheetlocation
It seems like this is currently not supported by the APIs provide by Qt 5
how can i add "Segoe UI" font in Ajax html editor extendor? i searched lot and find the option to customize Editor only but not able customize Editor Extendor. could any one tell me how do overwrite HtmlEditorExtendor property to Add cutom font and font-size?
Thanks,
Saravanan
You need to download ajaxcontroltoolkit sources from the codeplex site and tweak a bit HtmlEditorExtenderBehavior.pre.js file in Client/MicrosoftAjax.Extended project (this is a link to this file on codeplex: HtmlEditorExtenderBehavior.pre.js
Add your font families and font sized to appropriate arrays in _createButton function.
After that, you can rebuild project and use custom AjaxControlToolkit dll
For a large project I have the following setup:
a content editor made with Flex SDK 3.5
a content viewer made with Flex SDK 4.1
Both need to work with dynamically loaded fonts as the user can use the fonts he wants.
So we used this approach:
convert the font files with Flash Professional to SWF-files (Creating a Font SWF)
editor: load the fonts with Loader (Loading a SWF font)
the fonts can then be perfectly used within the application to generate htmlText
viewer: the same approach to load the fonts + register them with Font.registerFont (Flex 4 Embed font from swf)
Now the problems: although the loaded fonts are listed when you trace Font.enumerateFonts(false), they are not used in the textarea. There the text is shown with the default font.
Maybe the problem is the fonts are loaded as embedAsCFF for the Text Layout Framework, and that way are not usable in an mx.controls.TextArea? But as I can not change that to a spark TextArea for multiple reasons, I need a solution to use the loaded fonts in that mx.controls.TextArea.
Any ideas? Thanks a lot in advance!
Frank
Apparantly the problem was located in the project properties.
In "Flex Compiler" settings, the checkbox "Use Flash Text Engine in MX components" must be unchecked!
I'm not sure why you're using Flash Pro to create a font swf. You could just as easily done it using CSS by embedding the fonts and compiling it as a themed swf which could be loaded on runtime.
This should work for both Flex 3 and Flex 4 (with TLF).
This CSS code effectively retrofits mx textarea to accept CFF fonts:
mx|global{
textFieldClass: ClassReference("mx.core.UIFTETextField");
}
from the docs: "When MX components use FTE, they can use the same embedded fonts as Spark components, which always use FTE. Otherwise, a font must be embedded with embedAsCFF="false" for use by TextField-based components, and with embedAsCFF="true" for use by FTE-based components." http://help.adobe.com/en_US/FlashPlatform/reference/actionscript/3/mx/core/UIFTETextField.html
Is there a stylesheet available for use in Qt applications (through Qt Creator) that makes your GUI use the stylesheet you see in Qt Creator itself, as well as in AutoCAD and some other applications?
What is the name of that stylesheet or where can I get it? It looks much like the Vista stylesheet though...
And whenever you set a custom stylesheet to your Qt application, will it display the same style on all platforms, or will it still display native GUI parts?
To the people that may want to find out more: The style seems to be called manhattanstyle and extends QWindowsStyle. It is not a css-stylesheet and therefore not just copy and paste to set up. It seems to have some other dependencies in the source code, so I don't know how much it will take to adapt it.
The source is found in the [qt-creator source code]/src/plugins/coreplugin/manhattanstyle.cpp
And btw: if you are running debian/ubuntu: type apt-get source qt-creator to get the source ;)
I can't say as to how you would get style sheets that match Qt Creator or AutoCAD but to answer your other question: When you apply a style sheet, it applies to the object you applied it to, and the child hierarchy of that object. Any widget not addressed by the style sheet in some way will maintain the native look and feel that matches the Style (not style sheet) chosen by Qt as most appropriate for you application based on the user's platform and desktop environment.
yes, somebody has separated it out.
see this Manhattan style