對不起,如果這是一個愚蠢的問題。我不懶惰。我正在跟隨C++ GUI編程與Qt 4和書中的一個例子不同於Qt如何爲我工作。如何訪問對象屬性?
它讓我做一個對話框,然後掛鉤一些信號和插槽。那麼這是行不通的,所以我嘗試了一些現實檢查。我甚至無法手動編輯對象屬性。
這裏是主
#include <QApplication>
#include <QDialog>
#include <iostream>
#include "ui_gotocelldialog.h"
using namespace std;
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
Ui::GoToCellDialog ui;
QDialog *d = new QDialog;
ui.setupUi(d);
d->show();
return app.exec();
}
,這裏是我的對話框.cpp文件
#include "gotocelldialog.h"
#include "ui_gotocelldialog.h"
#include <iostream>
using namespace std;
GoToCellDialog::GoToCellDialog(QWidget *parent) :
QWidget(parent),
ui(new Ui::GoToCellDialog)
{
cout << "!!!!!!!!!!!!!!!!!!!!!"; // i never see this
ui->setupUi(this); // but if i comment out this it doesnt init
ui->okButton->setEnabled(true); // this does nothing
}
GoToCellDialog::~GoToCellDialog()
{
delete ui;
}
這裏是GoToCellDialog形式在設計模式
我只是想啓用okButton,默認是禁用的。另外,如果我cout < <「abc」;它不顯示。你能否介紹一下這方面的情況?
我很困惑,但有一點幫助。我可能不得不跳過這一節,因爲它讓我更加困惑。 – user1873073