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)));
}