Exemple #1
0
caScriptButton::caScriptButton(QWidget *parent) : QWidget(parent)
{

    QGridLayout *l = new QGridLayout;
    l->setMargin(0);
    displayScript = new QCheckBox();
    displayScript->setText("");
    displayScript->setGeometry(0,0,15,15);
    displayScript->setSizePolicy(QSizePolicy::Fixed, QSizePolicy::Fixed);
    buttonScript = new EPushButton( "Action", this );
    buttonScript->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    setFontScaleModeL(EPushButton::WidthAndHeight);

    l->addWidget(buttonScript, 0, 0);
    l->addWidget(displayScript, 0, 1);
    setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);

    setLayout(l);

    thisForeColor = Qt::black;
    thisBackColor = Qt::gray;

    thisShowExecution = false;

    connect(displayScript, SIGNAL(clicked()), this, SLOT(buttonToggled()) );
    connect(buttonScript, SIGNAL(clicked()), this, SLOT(scriptButtonClicked()) );

    installEventFilter(this);
    setAccessW(true);

    setElevation(on_top);

    setCheckboxDisplay(true);
}
Exemple #2
0
void caScriptButton::changeEvent(QEvent *e) {
    Q_UNUSED(e);
    setFontScaleModeL(thisScaleMode);
}
Exemple #3
0
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);
}