caTextEntry::caTextEntry(QWidget *parent) : caLineEdit(parent) { connect(this, SIGNAL(returnPressed()), this, SLOT(dataInput())); clearFocus(); setAccessW(true); installEventFilter(this); newFocusPolicy(Qt::ClickFocus); }
caLineEdit::caLineEdit(QWidget *parent) : QLineEdit(parent), FontScalingWidget(this) { // we want this font, while nice and monospace QFont font("Lucida Sans Typewriter"); // if this font does not exist then try a next one QFontInfo info(font); //font.setStyleStrategy(QFont::NoAntialias); QString family = info.family(); //printf("got font %s\n", qasc(family)); if(!family.contains("Lucida Sans Typewriter")) { QFont newfont("Monospace"); // not very nice, while a a dot inside the zero to distinguish from o newfont.setStyleHint(QFont::TypeWriter); setFont(newfont); } else { setFont(font); } isShown = false; oldStyle = ""; thisStyle = ""; setColorMode(Default); setAlarmHandling(onForeground); thisFormatC[0] = '\0'; setUnitsEnabled(false); thisBackColor = Qt::gray; thisForeColor = Qt::black; oldBackColor = Qt::black; oldForeColor = Qt::gray; thisFrameColor = Qt::black; oldFrameColor = Qt::gray; thisFramePresent = false; thisFrameLineWidth = 0; oldFrameLineWidth = 0; Alarm = 0; // default colors will be defined in my event handler by taking them from the palette defined by stylesheet definitions //defBackColor = QColor(255, 248, 220, 255); //defForeColor = Qt::black; defSelectColor = Qt::red; // this does not appear in the palette setPrecisionMode(Channel); setLimitsMode(Channel); setPrecision(0); setFormatType(decimal); setFormat(0); setMinValue(0.0); setMaxValue(1.0); setFrame(false); keepText = ""; unitsLast = ""; setTextLine(keepText); setValueType(false); setFontScaleModeL(WidthAndHeight); newFocusPolicy(Qt::NoFocus); d_rescaleFontOnTextChanged = true; installEventFilter(this); }