下記のウィンドウでデータを表示するにはどうしたらいいですか?これはコンソールアプリケーションで、すべて正常に動作します。私は出力をコンソールの代わりに作成されたウィンドウに入れたいだけです。コンソールの代わりにQLabelにプログラム出力をリダイレクト
#include <QApplication>
#include <QLabel>
#include <QString>
#include "Prob3TableInherited.h"
int main(int argc, char *argv[]) {
cout << "Entering problem number 3" << endl;
int rows = 5;
int cols = 6;
Prob3TableInherited tab("Problem3.txt", rows, cols);
const int *naugT = tab.getTable();
for (int i = 0; i < rows; i++)
{
for (int j = 0; j < cols; j++)
{
cout << naugT[i*cols + j] << " ";
}
cout << endl;
}
cout << endl;
const int *augT = tab.getAugTable();
for (int i = 0; i <= rows; i++)
{
for (int j = 0; j <= cols; j++)
{
cout << augT[i*(cols + 1) + j] << " ";
}
cout << endl;
}
// How can I pass the data?
QString data("Need To Pass Data Here");
//Create the Window Application
QApplication a(argc, argv);
QLabel *label=new QLabel(data);
//Make it visible
label->show();
return a.exec();
}
あなたはQtウィンドウ内に表示されるようにラベルを取得できましたか? – Jose