3 // Part of the Architektonas Project
4 // Originally part of QCad Community Edition by Andrew Mustun
5 // Extensively rewritten and refactored by James L. Hammons
6 // Portions copyright (C) 2001-2003 RibbonSoft
7 // Copyright (C) 2010 Underground Software
8 // See the README and GPLv2 files for licensing and warranty information
10 // JLH = James L. Hammons <jlhamm@acm.org>
13 // --- ---------- -----------------------------------------------------------
14 // JLH 05/10/2010 Added this text. :-)
24 * Default Constructor. You must call init manually if you choose
25 * to use this constructor.
27 FontBox::FontBox(QWidget * parent/*= 0*/, const char */*name = 0*/): QComboBox(parent)
39 * Initialisation (called from constructor or manually but only
46 for(Font * f=FONTLIST->firstFont(); f!=NULL; f=FONTLIST->nextFont())
47 fonts.append(f->getFileName());
50 // insertStringList(fonts);
53 connect(this, SIGNAL(activated(int)), this, SLOT(slotFontChanged(int)));
57 // slotFontChanged(currentItem());
58 slotFontChanged(currentIndex());
61 Font * FontBox::getFont()
67 * Sets the currently selected width item to the given width.
69 void FontBox::setFont(const QString & fName)
71 DEBUG->print("FontBox::setFont %s\n", fName.toLatin1().data());
72 // setCurrentText(fName);
73 setItemText(currentIndex(), fName);
74 // slotFontChanged(currentItem());
75 slotFontChanged(currentIndex());
79 * Called when the font has changed. This method
80 * sets the current font to the value chosen.
82 void FontBox::slotFontChanged(int index)
84 DEBUG->print("FontBox::slotFontChanged %d\n", index);
85 currentFont = FONTLIST->requestFont(currentText());
87 if (currentFont != NULL)
88 DEBUG->print("Current font is (%d): %s\n", index, currentFont->getFileName().toLatin1().data());
90 emit fontChanged(currentFont);