Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 4

Qt-interest Archive, March 2008
With Qt4 how to get system default fixed width font?


Message 1 in thread

Hi all,
I've written a program using Qt4.3.3 and I need to get the system
settings about the fixed width font.

If I try this:

  QFont font;
  font.setStyleHint(QFont::TypeWriter);
  QString font_name = font.defaultFamily();

Whatever font I set in the KDE System Settings/Appearance/Fonts/Fixed Width,
the result font_name is always "Courier".

Would you kindly give any hints on how to get the fixed width font
system setting?
And is there a portable approach to get this system setting on Linux,
MacOS X and Windows with Qt4?

Thanks in advance!

- Hua

--
 [ signature omitted ] 

Message 2 in thread

Could someone kindly help give any clue?

2008/3/24, FQ Term <fqterm@xxxxxxxxx>:
> Hi all,
>  I've written a program using Qt4.3.3 and I need to get the system
>  settings about the fixed width font.
>
>  If I try this:
>
>   QFont font;
>   font.setStyleHint(QFont::TypeWriter);
>   QString font_name = font.defaultFamily();
>
>  Whatever font I set in the KDE System Settings/Appearance/Fonts/Fixed Width,
>  the result font_name is always "Courier".
>
>  Would you kindly give any hints on how to get the fixed width font
>  system setting?
>  And is there a portable approach to get this system setting on Linux,
>  MacOS X and Windows with Qt4?
>
>  Thanks in advance!
>
>  - Hua
>

--
 [ signature omitted ] 

Message 3 in thread

On Mon, Mar 24, 2008 at 9:40 PM, FQ Term <fqterm@xxxxxxxxx> wrote:
> Could someone kindly help give any clue?
>
> 2008/3/24, FQ Term <fqterm@xxxxxxxxx>:
>
>
>
> > Hi all,
> >  I've written a program using Qt4.3.3 and I need to get the system
> >  settings about the fixed width font.
> >
> >  If I try this:
> >
> >   QFont font;
> >   font.setStyleHint(QFont::TypeWriter);
> >   QString font_name = font.defaultFamily();
> >
> >  Whatever font I set in the KDE System Settings/Appearance/Fonts/Fixed Width,
> >  the result font_name is always "Courier".
> >
> >  Would you kindly give any hints on how to get the fixed width font
> >  system setting?
> >  And is there a portable approach to get this system setting on Linux,
> >  MacOS X and Windows with Qt4?
> >
> >  Thanks in advance!
> >
> >  - Hua
> >
>
> --
> To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with "unsubscribe" in the subject or the body.
> List archive and information: http://lists.trolltech.com/qt-interest/
>
>

Have you tried the qtconfig app? It lets you configure visual aspects
of your Qt apps. I'm not completely sure if it's included in the win32
Qt4 installer, since I'm on Ubuntu right now. If you use Ubuntu or any
Debian based distro, install the package qt4-qtconfig.

You can have a look at this snapshot to see what I'm talking about.

http://img101.imageshack.us/img101/2980/qtconfigll7.png

Hope this helps.

--
 [ signature omitted ] 

Message 4 in thread

Thank Diego.

I just tried the qt4-qtconfig. There is a tab to set Qt applications'
default fonts, but there isn't place to specify fixed width font for Qt
applications.

2008/3/25, Diego Schulz <dschulz@xxxxxxxxx>:
>
> On Mon, Mar 24, 2008 at 9:40 PM, FQ Term <fqterm@xxxxxxxxx> wrote:
> > Could someone kindly help give any clue?
> >
> > 2008/3/24, FQ Term <fqterm@xxxxxxxxx>:
> >
> >
> >
> > > Hi all,
> > >  I've written a program using Qt4.3.3 and I need to get the system
> > >  settings about the fixed width font.
> > >
> > >  If I try this:
> > >
> > >   QFont font;
> > >   font.setStyleHint(QFont::TypeWriter);
> > >   QString font_name = font.defaultFamily();
> > >
> > >  Whatever font I set in the KDE System Settings/Appearance/Fonts/Fixed
> Width,
> > >  the result font_name is always "Courier".
> > >
> > >  Would you kindly give any hints on how to get the fixed width font
> > >  system setting?
> > >  And is there a portable approach to get this system setting on Linux,
> > >  MacOS X and Windows with Qt4?
> > >
> > >  Thanks in advance!
> > >
> > >  - Hua
> > >
> >
>
> > --
> > To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
> "unsubscribe" in the subject or the body.
> > List archive and information: http://lists.trolltech.com/qt-interest/
> >
> >
>
>
> Have you tried the qtconfig app? It lets you configure visual aspects
> of your Qt apps. I'm not completely sure if it's included in the win32
> Qt4 installer, since I'm on Ubuntu right now. If you use Ubuntu or any
> Debian based distro, install the package qt4-qtconfig.
>
> You can have a look at this snapshot to see what I'm talking about.
>
> http://img101.imageshack.us/img101/2980/qtconfigll7.png
>
> Hope this helps.
>