Пример #1
0
void QLineEditPrivate::init(const QString& txt)
{
    Q_Q(QLineEdit);
    control = new QWidgetLineControl(txt);
    control->setParent(q);
    control->setFont(q->font());
    QObject::connect(control, SIGNAL(textChanged(QString)),
            q, SIGNAL(textChanged(QString)));
    QObject::connect(control, SIGNAL(textEdited(QString)),
            q, SLOT(_q_textEdited(QString)));
    QObject::connect(control, SIGNAL(cursorPositionChanged(int,int)),
            q, SLOT(_q_cursorPositionChanged(int,int)));
    QObject::connect(control, SIGNAL(selectionChanged()),
            q, SLOT(_q_selectionChanged()));
    QObject::connect(control, SIGNAL(accepted()),
            q, SIGNAL(returnPressed()));
    QObject::connect(control, SIGNAL(editingFinished()),
            q, SIGNAL(editingFinished()));
#ifdef QT_KEYPAD_NAVIGATION
    QObject::connect(control, SIGNAL(editFocusChange(bool)),
            q, SLOT(_q_editFocusChange(bool)));
#endif
    QObject::connect(control, SIGNAL(cursorPositionChanged(int,int)),
            q, SLOT(updateMicroFocus()));

    QObject::connect(control, SIGNAL(textChanged(QString)),
            q, SLOT(updateMicroFocus()));

    // for now, going completely overboard with updates.
    QObject::connect(control, SIGNAL(selectionChanged()),
            q, SLOT(update()));

    QObject::connect(control, SIGNAL(selectionChanged()),
            q, SLOT(updateMicroFocus()));

    QObject::connect(control, SIGNAL(displayTextChanged(QString)),
            q, SLOT(update()));

    QObject::connect(control, SIGNAL(updateNeeded(QRect)),
            q, SLOT(_q_updateNeeded(QRect)));

    QStyleOptionFrame opt;
    q->initStyleOption(&opt);
    control->setPasswordCharacter(q->style()->styleHint(QStyle::SH_LineEdit_PasswordCharacter, &opt, q));
    control->setPasswordMaskDelay(q->style()->styleHint(QStyle::SH_LineEdit_PasswordMaskDelay, &opt, q));
#ifndef QT_NO_CURSOR
    q->setCursor(Qt::IBeamCursor);
#endif
    q->setFocusPolicy(Qt::StrongFocus);
    q->setAttribute(Qt::WA_InputMethodEnabled);
    //   Specifies that this widget can use more, but is able to survive on
    //   less, horizontal space; and is fixed vertically.
    q->setSizePolicy(QSizePolicy(QSizePolicy::Expanding, QSizePolicy::Fixed, QSizePolicy::LineEdit));
    q->setBackgroundRole(QPalette::Base);
    q->setAttribute(Qt::WA_KeyCompression);
    q->setMouseTracking(true);
    q->setAcceptDrops(true);

    q->setAttribute(Qt::WA_MacShowFocusRect);
}
Пример #2
0
void TextAnnotation::initUpdateTextString()
{
  if (mpComponent) {
    if (mOriginalTextString.contains("%") || mDynamicTextString.count() > 0) {
      updateTextString();
      connect(mpComponent, SIGNAL(displayTextChanged()), SLOT(updateTextString()), Qt::UniqueConnection);
    }
  }
}
Пример #3
0
CarPI::CarPI(QObject * parent): QObject(parent) {
    qDebug() << "CarPI: Starting";

    _sourceCurrent = sourceUnknown;
    _sourcePaused = false;

    /* Kontroler płyty głównej urządzenia */
    _mainboard = MainBoard::getInstance();

    /* Emulator wyświetlacza radia */
    _displayEmulator = DisplayEmulator::getInstance();

    /* Emulator zmieniarki CD */
    _changerEmulator = ChangerEmulator::getInstance();

    /* Kontroler modułu bluetooth */
    _bluetooth = Bluetooth::getInstance();

    /* Odtwarzacz MP3 */
    _mp3Player = MP3Player::getInstance();

    /* Nawigacja */
    _navit = Navit::getInstance();

    /* Interfejs OBD II */
    _elm327 = Elm327::getInstance();

    _atmosphericPressure = 100; /* Zakładamy ciśnienie 1000hPa */

    connect(_mainboard, SIGNAL(radioPowerChanged(bool)), _displayEmulator, SLOT(radioPowerChanged(bool)));
    connect(_mainboard, SIGNAL(keyStateChanged(int)), this, SLOT(_pilotKeyStateChanged(int)));
    connect(_mainboard, SIGNAL(ignitionChanged(bool)), this, SLOT(_ignitionStateChanged(bool)));
    connect(_mainboard, SIGNAL(shutdown()), this, SLOT(shutdown()));

    connect(_displayEmulator, SIGNAL(displayTextChanged(QString)), this, SLOT(_displayTextChanged(QString)));
    connect(_displayEmulator, SIGNAL(displayIconsChanged(int)), this, SLOT(_displayIconsChanged(int)));
    connect(_displayEmulator, SIGNAL(displayMenuShow(int)), this, SLOT(_displayMenuShow(int)));
    connect(_displayEmulator, SIGNAL(displayMenuHide()), this, SLOT(_displayMenuHide()));
    connect(_displayEmulator, SIGNAL(displayMenuItemUpdate(int,QString,bool)), this, SLOT(_displayMenuSetItem(int,QString,bool)));
    connect(this, SIGNAL(radioNewKeyEvent(int)), _displayEmulator, SLOT(sendKeyEvent(int)));

    connect(_bluetooth, SIGNAL(connectionStateChanged(bool)), this, SLOT(_bluetoothConnectionStateChanged(bool)));
    connect(_bluetooth, SIGNAL(callStateChanged(BluetoothCallState,QString)), this, SLOT(_bluetoothCallStateChanged(BluetoothCallState,QString)));

    connect(_changerEmulator, SIGNAL(playbackStarted()), _mp3Player, SLOT(play()));
    connect(_changerEmulator, SIGNAL(playbackPaused()), _mp3Player, SLOT(pause()));
    connect(_changerEmulator, SIGNAL(playbackStopped()), _mp3Player, SLOT(stop()));
    connect(_changerEmulator, SIGNAL(nextTrack()), _mp3Player, SLOT(nextTrack()));
    connect(_changerEmulator, SIGNAL(prevTrack()), _mp3Player, SLOT(prevTrack()));
    connect(_changerEmulator, SIGNAL(loadCD(int)), this, SLOT(_changerEmulatorLoadCD(int)));

    connect(_mp3Player, SIGNAL(textChanged(QString)), this, SLOT(_mp3PlayerTextChanged(QString)));
    connect(this, SIGNAL(mp3PlayerNextAlbum()), _mp3Player, SLOT(nextAlbum()));
    connect(this, SIGNAL(mp3PlayerPrevAlbum()), _mp3Player, SLOT(prevAlbum()));
    connect(this, SIGNAL(mp3PlayerSwitchDisplayMode()), _mp3Player, SLOT(switchDisplayMode()));

    connect(_elm327, SIGNAL(pidValueChanged(int,QVector<int>)), this, SLOT(_elm327PidChanged(int,QVector<int>)));
    connect(_elm327, SIGNAL(voltageChanged(double)), this, SLOT(_elm327VoltageChanged(double)));
    connect(this, SIGNAL(elm327addWatchPid(int)), _elm327, SLOT(addWatchPid(int)));
    connect(this, SIGNAL(elm327start()), _elm327, SLOT(start()));
    connect(this, SIGNAL(elm327stop()), _elm327, SLOT(stop()));

    _mainboard->readState();

    emit elm327addWatchPid(0x05); /* Temperatura wody */
    emit elm327addWatchPid(0x04); /* Obciążenie silnika */
    emit elm327addWatchPid(0x0B); /* Ciśnienie absolutne w kolektorze dolotowym */
    emit elm327addWatchPid(0x0F); /* Temperatura powietrza w dolocie */
    emit elm327addWatchPid(0x23); /* Ciśnienie paliwa */
}