예제 #1
0
SettingsDialog::SettingsDialog(QWidget *parent, QString hostIP/*=SERVERNAME*/, int port/*=SERVERPORT*/, int camera_port/*=SERVERCAMERAPORT*/) :
    QDialog(parent)
{
     QPushButton *closeButton = new QPushButton(tr("Close"));

     connect(closeButton, SIGNAL(clicked()), this, SLOT(close()));

     QLabel* hostLabel = new QLabel(tr("IP of the Wall-E Host"), this);

     // Get saved network configuration
     QSettings settings(QSettings::UserScope, QLatin1String(SETTING_STR));
     settings.beginGroup(QLatin1String("Host"));
     hostIP = settings.value(QLatin1String(SETTING_HOST_IP_STR), hostIP).toString();
     port = settings.value(QLatin1String(SETTING_PORT_STR), port).toInt();
     camera_port = settings.value(QLatin1String(SETTING_CAMERA_PORT_STR), camera_port).toInt();
     settings.endGroup();

     mIPNumberWidget = new IPNumberWidget(this, hostIP);
     connect(mIPNumberWidget, SIGNAL(signalTextChanged(QString)), this, SLOT(hostIPChanged(QString)));


     QWidget *hostWidget= new QWidget(this);
     QHBoxLayout *hostlLayout = new QHBoxLayout(hostWidget);
     hostlLayout->addWidget(hostLabel,100);
     hostlLayout->addWidget(mIPNumberWidget, 700, Qt::AlignRight);

     QLabel* portLabel = new QLabel(tr("Port"), this);
     mPortNumber = new QLineEdit(this);
     mPortNumber->setText(QString::number(port));
     connect(mPortNumber, SIGNAL(textEdited (const QString)), this, SLOT(portChanged(const QString)));

     QLabel* cameraPortLabel = new QLabel(tr("Camera Port"), this);
     mCameraPortNumber = new QLineEdit(this);
     mCameraPortNumber->setText(QString::number(camera_port));
     connect(mCameraPortNumber, SIGNAL(textEdited (const QString)), this, SLOT(cameraPortChanged(const QString)));


     QWidget *portWidget= new QWidget(this);
     QHBoxLayout *portlLayout = new QHBoxLayout(portWidget);
     portlLayout->addWidget(portLabel);
     portlLayout->addWidget(mPortNumber, 200, Qt::AlignRight );

     QWidget *cameraPortWidget= new QWidget(this);
     QHBoxLayout *cameraPortLayout = new QHBoxLayout(cameraPortWidget);
     cameraPortLayout->addWidget(cameraPortLabel);
     cameraPortLayout->addWidget(mCameraPortNumber, 200, Qt::AlignRight );

     QVBoxLayout *mainLayout = new QVBoxLayout;
     mainLayout->addWidget(hostWidget);
     //mainLayout->addStretch(1);
     //mainLayout->addSpacing(12);
     mainLayout->addWidget(portWidget);
     mainLayout->addWidget(cameraPortWidget);

     mainLayout->addWidget(closeButton, 20, Qt::AlignRight);
     setLayout(mainLayout);

     setWindowTitle(tr("Settings"));
}
예제 #2
0
void NMGChartSeries::setText(QString text)
{ 
  if(currentText != text)
  {
    currentText = text;
    // update is not necessary because currentText is not a visible element but must be notified
    // to other potencial visible elements
    emit signalTextChanged(id, currentText);
  }
}
예제 #3
0
void AdvancedRenameLineEdit::slotParseTimer()
{
    emit signalTextChanged(toPlainText());
}
예제 #4
0
bool IPCtrl::eventFilter(QObject *obj, QEvent *event)
{
    bool bRes = QFrame::eventFilter(obj, event);

    if ( event->type() == QEvent::KeyPress )
    {
        QKeyEvent* pEvent = dynamic_cast<QKeyEvent*>( event );
        if ( pEvent )
        {
            for ( unsigned int i = 0; i != QTUTL_IP_SIZE; ++i )
            {
                QLineEdit* pEdit = m_pLineEdit[i];
                if ( pEdit == obj )
                {
                    switch ( pEvent->key() )
                    {
                    case Qt::Key_Left:
                        if ( pEdit->cursorPosition() == 0 )
                        {
                            // user wants to move to previous item
                            MovePrevLineEdit(i);
                        }
                        break;

                    case Qt::Key_Right:
                        if ( pEdit->text().isEmpty() || (pEdit->text().size() == pEdit->cursorPosition()) )
                        {
                            // user wants to move to next item
                            MoveNextLineEdit(i);
                        }
                        break;

                    case Qt::Key_0:
                        if ( pEdit->text().isEmpty() || pEdit->text() == "0" )
                        {
                            pEdit->setText("0");
                            // user wants to move to next item
                            MoveNextLineEdit(i);
                        }
                        emit signalTextChanged( pEdit );
                        break;

                    case Qt::Key_Backspace:
                        if ( pEdit->text().isEmpty() || pEdit->cursorPosition() == 0)
                        {
                            // user wants to move to previous item
                            MovePrevLineEdit(i);
                        }
                        break;

                    case Qt::Key_Comma:
                    case Qt::Key_Period:
                        MoveNextLineEdit(i);
                        break;

                    default:
                        emit signalTextChanged( pEdit );
                        break;

                    }
                }
            }
        }
    }

    return bRes;
}