0
QTextEdit沒有顯示在窗口上,也沒有顯示「hello」。不知道這裏有什麼問題嗎?QTextEdit不顯示
#define MAINWINDOW_H
#include <QtGui/QMainWindow>
#include <QtGui/QTextEdit>
namespace Ui {
class MainWindow;
}
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
explicit MainWindow(QWidget *parent = 0);
private:
QTextEdit *m_textint;
};
#endif // MAINWINDOW_H
-------------
#include "mainwindow.h"
#include <QtGui/QApplication>
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow mainWindow;
mainWindow.setGeometry(QRect(QPoint(100, 100),
QSize(400, 600)));
mainWindow.show();
return app.exec();
}
------------------
#include "mainwindow.h"
#include <QtCore/QCoreApplication>
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
m_textint = new QTextEdit("hello");
m_textint->setGeometry(QRect(QPoint(10, 10),
QSize(50, 200)));
}
m_textint = new QTextEdit(「hello」,this); //需要「這個」...你的代碼幫助我看到這.. thx – jdl