学习QT Example and Demo One by One 001——Application
来源:互联网 发布:淘宝开店宝贝怎么上架 编辑:程序博客网 时间:2024/05/22 14:54
突然决定好好学习QT,我打算把QT Example and Demo中的代码都学习一遍。一什么样的形式记录我的学习过程呢,暂时还没有好的想法,先走一步看一步吧。今天从MainWindow中的Application开始。
先看看MainWindow.h文件中的内容
#ifndef MAINWINDOW_H
#define MAINWINDOW_H
#include <QMainWindow>
QT_BEGIN_NAMESPACE
class QAction;
class QMenu;
class QPlainTextEdit;
QT_END_NAMESPACE
//! [0]
class MainWindow : public QMainWindow
{
Q_OBJECT
public:
MainWindow();
protected:
void closeEvent(QCloseEvent *event);
private slots:
void newFile();
void open();
bool save();
bool saveAs();
void about();
void documentWasModified();
private:
void createActions();
void createMenus();
void createToolBars();
void createStatusBar();
void readSettings();
void writeSettings();
bool maybeSave();
void loadFile(const QString &fileName);
bool saveFile(const QString &fileName);
void setCurrentFile(const QString &fileName);
QString strippedName(const QString &fullFileName);
QPlainTextEdit *textEdit;
QString curFile;
QMenu *fileMenu;
QMenu *editMenu;
QMenu *helpMenu;
QToolBar *fileToolBar;
QToolBar *editToolBar;
QAction *newAct;
QAction *openAct;
QAction *saveAct;
QAction *saveAsAct;
QAction *exitAct;
QAction *cutAct;
QAction *copyAct;
QAction *pasteAct;
QAction *aboutAct;
QAction *aboutQtAct;
};
从上面的代码可以看出,一般来说一个Mainwindow的类构造了如下内容:
1、public:声明了构造函数
2、private slots:声明了5个槽
3、private:声明了主窗口所包含的一些widget的指针;声明了完成本窗口功能的若干动作
另外还有几个函数留到实现MainWindow时在叙述。。
- 学习QT Example and Demo One by One 001——Application
- xd.one Demo and Tutorial
- One example for learning "for and while"
- one page one application
- One Page,One Application
- one by one note
- a complete example of using One to Many and One to One associations using MyBatis annotations
- Linux Programming by Example:The Fundamentals(Notes One)
- 转载 “one page, one application”
- one mvc example
- [python]example-one-bug
- 《Expert one-on-one J2EE design and development》学习笔记1——JavaEE常用架构设计
- COPY CHAR ONE BY ONE
- Hibernate – One-To-One Example (Annotation)
- Hibernate – One-to-One example (Annotation)
- Hibernate – One-to-One example (Annotation)
- Hibernate – One-to-One example (Annotation)
- Hibernate – One-to-One example (Annotation)
- 自己积累的一些东西
- PHP+memcached配置
- eclipse转换编码
- protel常用元件封装
- 设计模式:Flyweight模式(享元模式)
- 学习QT Example and Demo One by One 001——Application
- 非MFC的DLL[转载](待消化)
- Qt使用QGraphicsView实现滑动窗体效果
- 页面的静态化学习笔记
- Linux常见信号
- spring的依赖注入
- 短成使方说
- gdb基本命令
- HOOK&DLL编写