0

GUIからの値がターミナルインターフェイスに「出力」されるターミナルから実行される別のプログラムに値を与えるためにQT DesignerからのGUIが必要な問題があります(GCCコンパイラを備えたLinux)

私は pthread について調査しましたが、その適用例は In-Application での使用に限定されています。メインファイルのコードは次のとおりです。

#include "main_window.h"

#include <QApplication>

#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
#include <iostream>


void *thr_func(void *thread_id)
{
    int tid = thread_id;
    pthread_mutex_lock(&lock_x);
    cout << "thread" << tid << end1;
    cout << xValue << end1;
    cout << yValue << end1;
    cout << zValue << end1;
    pthread_mutex_unlock(&lock_x);
}

int main(int argc, char *argv[])
{
    pthread_create(thread_1, NULL, thr_func, NULL)

    while(true)
    {
        QApplication a(argc, argv);
        MainWindow w;
        w.show();
        return a.exec();
    }
    pthread_exit(NULL);
}

** xValue、yValue、および zValue は、QT アプリケーションから既にテキスト ファイルにストリームされていることに注意してください。私は端末の実行と制御のためにアプリケーションを適応させています。

4

0 に答える 0