Qt命名規(guī)范以及快捷鍵

untitled.pro

//Qt 包含的模塊
QT       += core gui

//大于4版本以上包含 widget 模塊
greaterThan(QT_MAJOR_VERSION, 4): QT += widgets

//目標  模板生成的.exe程序的名稱
TARGET = untitled_second
//模板  應用程序模板 Application
TEMPLATE = app

# The following define makes your compiler emit warnings if you use
# any feature of Qt which as been marked as deprecated (the exact warnings
# depend on your compiler). Please consult the documentation of the
# deprecated API in order to know how to port your code away from it.
DEFINES += QT_DEPRECATED_WARNINGS

# You can also make your code fail to compile if you use deprecated APIs.
# In order to do so, uncomment the following line.
# You can also select to disable deprecated APIs only up to a certain version of Qt.
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000    # disables all the APIs deprecated before Qt 6.0.0


SOURCES += \
        main.cpp \ //源文件
        mainwindow.cpp

HEADERS += \
        mainwindow.h //頭文件

FORMS += \
        mainwindow.ui

mainwindow.h

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

//包含頭文件 QMainWindow 窗口類
#include <QMainWindow>

namespace Ui {
class MainWindow;
}

class MainWindow : public QMainWindow
{
    Q_OBJECT //Q_OBJECT宏,允許類中使用信號和槽的機制

public:
    explicit MainWindow(QWidget *parent = 0); //構造函數(shù)
    ~MainWindow(); //析構函數(shù)

private:
    Ui::MainWindow *ui;
};

#endif // MAINWINDOW_H
// 命名規(guī)范
// 類名 首字母大寫,單詞和單詞之間首字母大寫
// 函數(shù)名 變量名稱 首字母小寫, 單詞和單詞之間首字母大寫

// 快捷鍵
// 注釋 Ctrl + /
// 運行 Ctrl + r
// 編譯 Ctrl + b
// 字體縮放 Ctrl +鼠標滾輪
// 查找 Ctrl + l 
// 整行移動 Ctrl + shift + 1或者的 l
// 幫助文檔 F1
// 自動對齊 Ctrl + i
// 同名之間的 .h 和 cpp 切換 F4

//幫助文檔 第一種方式 F1 第二種 左鍵按鈕 第三種 C:\Qt\Qt5.9.0\5.9\mingw53_32\bin\assistant.exe
?著作權歸作者所有,轉載或內容合作請聯(lián)系作者
【社區(qū)內容提示】社區(qū)部分內容疑似由AI輔助生成,瀏覽時請結合常識與多方信息審慎甄別。
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發(fā)布,文章內容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務。

相關閱讀更多精彩內容

友情鏈接更多精彩內容