Source Code (Use browser search to find items of interest.)

Class Index

kdevelop'Attribute (./kdevelop/kdevelop/kwrite/kwdoc.h:188)

class Attribute {
  public:
    Attribute();
//    Attribute(const char *aName, const QColor &, const QColor &, const QFont &);
//    QString name;
    QColor col;
    QColor selCol;
    void setFont(const QFont &);
    QFont font;
    QFontMetrics fm;
    //workaround for slow QFontMetrics::width()
    int width(QChar c) {return (fontWidth < 0) ? fm.width(c) : fontWidth;}
    int width(QString s) {return (fontWidth < 0) ? fm.width(s) : s.length()*fontWidth;}
  protected:
    int fontWidth;
};


kdevelop'Attribute::Attribute() (./kdevelop/kdevelop/kwrite/kwdoc.cpp:332)

Attribute::Attribute() : font(), fm(font) {
}


kdevelop'Attribute::setFont() (./kdevelop/kdevelop/kwrite/kwdoc.cpp:335)

void Attribute::setFont(const QFont &f) {
  font = f;
  fm = QFontMetrics(f);
//workaround for slow QFontMetrics::width(), QFont::fixedPitch() doesn't seem to work
  if ((fontWidth = fm.width('W')) != fm.width('i')) fontWidth = -1;
}