0
我已經創建了一個qt GUI來執行一些檢出任務,並在標籤中顯示結果。我使用QT創建器,這會創建標題和mainwindow.cpp程序。所以我的問題是我已經在頭文件中聲明瞭更多的方法來完成一些任務,並且結果更新了一個標籤,但是我使用while循環和我的GUI永遠不會啓動的問題。我試圖以順序方式運行(沒有循環),這個工作,但只調用拉斯維加斯函數,程序不遵循序列(例如試圖ping到服務器)。如何在創建qt應用程序時使用ui類
下面是一個類似mianwindow.cpp程序,我有,
#include "mainwindow.h"
#include "ui_mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
while(1)
{
ping2server()
if(ping2server>0)
ui->label->setText("The server is alive");
else
break;
}
/*the server is dead connecting to other one*/
.
.
//and so on
}
MainWindow::~MainWindow()
{
delete ui;
}
int MainWindow::png2server()
{
}
int MainWindow::conn2server()
{
}
任何想法,請讓我知道。我真的很新。
謝謝
好的我做的,但問題是,我使用2個計時器,當我使用它們時,只有其中一個更新,它是最後一個。 GUI不顯示第一個計時器的狀態。爲什麼?? – user1013213
你能發佈你的代碼嗎? –