コード例 #1
0
ファイル: GpsConnection.cpp プロジェクト: winr7x/CodeExamples
		GpsConnection::GpsConnection (QObject *parent)
			: QObject (parent)
			, isExpired_ (true)
			, gpsPort_ (AbstractGpsPort::createGpsPort (ComPortSettings::isMockPort ()
														? AbstractGpsPort::MOCK_GPS_PORT
														: AbstractGpsPort::REAL_GPS_PORT))
		{
			constexpr int currentCoordinatesExpireTime = 1500;
			coordinatesExpireTimer_.setInterval (currentCoordinatesExpireTime);

			connect (&coordinatesExpireTimer_, SIGNAL (timeout ()), SLOT (setExpired ()));

			connect (gpsPort_.get (), SIGNAL (ggaSentenceReceived (GgaSentence)),
					 SLOT (rememberCoordinates (GgaSentence)));

			connect (gpsPort_.get (), SIGNAL (sentenceReady (QString)), SLOT (showSentence (QString)));
		}
コード例 #2
0
ReadFromFileWidget::ReadFromFileWidget(QWidget *parent)
    : QWidget(parent)
{
    sl = new QHBoxLayout;
    QVBoxLayout * vl = new QVBoxLayout; {

        sentenses = readFile();
        showSentence(0);
    }

    QPushButton * next = new QPushButton("Далее", this); {
        connect(next, SIGNAL(clicked()), this, SLOT(nextSentence()) );
    }
    vl->addWidget(next);
    vl->addLayout(sl);

    setLayout(vl);
}
コード例 #3
0
void ReadFromFileWidget::nextSentence()
{
    current++;
    showSentence(current % sentenses.count());
}