void ElidedLabel::setText(const QString& txt) { if(_text == txt) return; _text = txt; autoAdjustFontSize(); }
void Strip::setLabelFont() { return; // Use the new font #6 I created just for these labels (so far). // Set the label's font. label->setFont(config.fonts[6]); // Dealing with a horizontally constrained label. Ignore vertical. Use a minimum readable point size. autoAdjustFontSize(label, label->text(), false, true, config.fonts[6].pointSize(), 5); }
ElidedLabel::ElidedLabel(QWidget* parent, Qt::TextElideMode elideMode, //int maxFontPoint, int minFontPoint, bool ignoreHeight, bool ignoreWidth, const QString& text, Qt::WindowFlags flags) : QFrame(parent, flags), _elideMode(elideMode), //_fontPointMax(maxFontPoint), _fontPointMin(minFontPoint), _fontIgnoreHeight(ignoreHeight), _fontIgnoreWidth(ignoreWidth), _text(text) { _id = -1; setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); // updateSizeHint(); _curFont = font(); autoAdjustFontSize(); }
ElidedLabel::ElidedLabel(QWidget* parent, Qt::TextElideMode elideMode, Qt::Alignment alignment, //int maxFontPoint, int minFontPoint, bool ignoreHeight, bool ignoreWidth, const QString& text, Qt::WindowFlags flags) : QFrame(parent, flags), _elideMode(elideMode), //_fontPointMax(maxFontPoint), _fontPointMin(minFontPoint), _fontIgnoreHeight(ignoreHeight), _fontIgnoreWidth(ignoreWidth), _text(text) { setMouseTracking(true); setEnabled(true); setFocusPolicy(Qt::StrongFocus); //setAutoFillBackground(false); //setAttribute(Qt::WA_NoSystemBackground); //setAttribute(Qt::WA_StaticContents); // This is absolutely required for speed! Otherwise painfully slow because of full background // filling, even when requesting small udpdates! Background is drawn by us. //setAttribute(Qt::WA_OpaquePaintEvent); _id = -1; _hasOffMode = false; _off = false; _hovered = false; _alignment = alignment; setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Preferred); // updateSizeHint(); _curFont = font(); autoAdjustFontSize(); }
void ElidedLabel::setFontPointMin(int point) { _fontPointMin = point; autoAdjustFontSize(); }
void ElidedLabel::setFontIgnoreDimensions(bool ignoreHeight, bool ignoreWidth) { _fontIgnoreWidth = ignoreWidth; _fontIgnoreHeight = ignoreHeight; autoAdjustFontSize(); }
void ElidedLabel::resizeEvent(QResizeEvent* e) { e->ignore(); QFrame::resizeEvent(e); autoAdjustFontSize(); }