PDA

View Full Version : macros in QT



Noxxik
19th March 2009, 21:38
how can I find out if operation system has some font? how i can use this construction?

Can I use this construction for finding font?

#ifndef SOMETHING
#define SOMETHING
/*some code*/
#endif

Is somewhere some example with qt how can I use it?
thanks

edit: existing some this macros for recognising operating system? thanks

Lykurg
19th March 2009, 21:51
edit: Existing some this macros for recognising operating system? Thanks
q_ws_mac, q_ws_qws, q_ws_win, q_ws_x11

For finding a font you can use QFontDatabase, but this is no macro. I would wonder if there were one to check for fonts. By the way, why do you need that (in a macro)?

init2null
19th March 2009, 22:14
You're right about the macros, Lykurg, but they do need to be in all-caps:


#ifdef Q_WS_WIN
#endif

See here (http://doc.trolltech.com/4.5/qtglobal.html) for a list of the defined constants.

wysota
19th March 2009, 22:37
I would wonder if there were one to check for fonts.

It wouldn't make sense because you can move the font away (or install it) after you build the application. Things that vary between installations should be checked at run time, not compile time which obviously can't be done through a preprocessor macro.

Lykurg
20th March 2009, 10:07
you're right about the macros, lykurg, but they do need to be in all-caps

Jepp, but the board doesn't like me. It converted all caps to lower. Like "AAAAHHHHH" (<- was written in capitals). And I'm not willing to get forced to use the CODE-Tag (also was written in capitals). (The real reason was, I was yesterday too tired to change, and I thought Noxxik could figure it out :))

EDIT: Hä? don't understand it..
ASDFJKLAJG GIAUJ ASL ILJ IGAUIDGH KIU HDSKLSDG
now it works...

Lykurg
20th March 2009, 10:09
This sample text was written in capitals!