Esempio n. 1
0
void ElidedLabel::setText(const QString& txt) 
{ 
  if(_text == txt)
    return;
  _text = txt; 
  autoAdjustFontSize();
}
Esempio n. 2
0
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);
}
Esempio n. 3
0
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();
}
Esempio n. 4
0
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();
}
Esempio n. 5
0
void ElidedLabel::setFontPointMin(int point)
{
  _fontPointMin = point;
  autoAdjustFontSize();
}
Esempio n. 6
0
void ElidedLabel::setFontIgnoreDimensions(bool ignoreHeight, bool ignoreWidth)
{
  _fontIgnoreWidth = ignoreWidth;
  _fontIgnoreHeight = ignoreHeight;
  autoAdjustFontSize();
}
Esempio n. 7
0
void ElidedLabel::resizeEvent(QResizeEvent* e)
{
  e->ignore();
  QFrame::resizeEvent(e);
  autoAdjustFontSize();
}