尊龙凯时人生就是博

ʹÓÃQtCreator¾ÙÐÐLinuxͼÐνçÃ濪·¢µÄ»ù±¾ÉèÖÃÖ¸ÄÏ

ʹÓÃqtcreator¾ÙÐÐlinuxͼÐνçÃ濪·¢µÄ»ù±¾ÉèÖÃÖ¸ÄÏ

СÐò£º

QtCreatorÊÇÒ»¿îÇ¿Ê¢µÄ¿çƽ̨¼¯³É¿ª·¢ÇéÐΣ¨IDE£© £¬ËüÌṩÓÃÓÚ¿ª·¢Í¼ÐνçÃæÓ¦ÓóÌÐòµÄ¹¤¾ßºÍ¹¦Ð§¡£±¾ÎĽ«ÏÈÈÝÔõÑùÔÚLinuxϵͳÉÏÉèÖÃQtCreator £¬ÒÔ±ã×îÏÈʹÓÃËü¾ÙÐÐͼÐνçÃ濪·¢¡£

°ì·¨Ò»£º×°ÖÃQtCreator

Ê×ÏÈ £¬ÐèÒªÔÚLinuxϵͳÉÏ×°ÖÃQtCreator¡£¿ÉÒÔͨ¹ýÔÚÖÕ¶ËÖÐÔËÐÐÒÔÏÂÏÂÁîÀ´×°ÖÃQtCreator£º

sudo apt-get install qtcreator

µÇ¼ºó¸´ÖÆ

°ì·¨¶þ£º×°ÖÃQt¿â

QtCreatorÐèÒªQt¿âÀ´Ö§³ÖͼÐνçÃ濪·¢¡£¿ÉÒÔͨ¹ýÒÔÏÂÏÂÁîÀ´×°ÖÃQt¿â£º

sudo apt-get install qt5-default

µÇ¼ºó¸´ÖÆ

°ì·¨Èý£ºÉèÖÃQtCreator

×°ÖÃÍê³Éºó £¬·­¿ªQtCreator¡£Ê×´ÎÔËÐÐQtCreatorʱ £¬ÐèÒªÉèÖÃһЩ³£ÓÃÉèÖãº

Ñ¡Ôñ”Tools”->”Options”·­¿ªÑ¡Ïî¶Ô»°¿ò¡£

ÔÚ×ó²àÃæ°åÖÐÑ¡Ôñ”Build & Run”Ñ¡Ïî¡£

ÔÚÓÒ²àÃæ°åÖÐÑ¡Ôñ”Kits”Ñ¡Ï¡£

µã»÷”Add”°´Å¥ £¬Ñ¡Ôñ”Desktop”¡£

ÔÚ”Compiler”ÏÂÀ­²Ëµ¥ÖÐÑ¡Ôñ¿ÉÓõıàÒëÆ÷¡£

ÔÚ”Debugger”ÏÂÀ­²Ëµ¥ÖÐÑ¡Ôñ¿ÉÓõĵ÷ÊÔÆ÷¡£

µã»÷”Apply”°´Å¥ÉúÑÄÉèÖá£

°ì·¨ËÄ£º½¨ÉèÐÂÏîÄ¿

ÔÚQtCreatorÖн¨ÉèÐÂÏîÄ¿ÊǺÜÊǼòÆӵġ£Çëƾ֤ÒÔÏ°취£º

·­¿ªQtCreator¡£

Ñ¡Ôñ”File”->”New File or Project”¡£

ÔÚ¶Ô»°¿òÖÐÑ¡Ôñ”Qt Widgets Application”¡£

µã»÷”Choose”°´Å¥¡£

ÊäÈëÏîÄ¿µÄÃû³ÆºÍ·¾¶¡£

µã»÷”Next”°´Å¥ £¬Ñ¡ÔñËùÐèµÄÀࣨÀýÈ磺MainWindow£©¡£

µã»÷”Next”ºÍ”Finish”°´Å¥¡£

Ò»µ©½¨ÉèÁËÐÂÏîÄ¿ £¬QtCreator½«×Ô¶¯ÌìÉúÏîÄ¿µÄ»ù±¾¿ò¼Ü¡£¿ÉÒÔÔÚ×ó²àµÄ”Projects”Ãæ°åÖп´µ½ÏîÄ¿Îļþ¡£

°ì·¨Î壺Éè¼Æ½çÃæ

ʹÓÃQtCreator¿ÉÒÔÀû±ãµØÉè¼ÆºÍ½á¹¹Í¼ÐνçÃæ¡£Çëƾ֤ÒÔÏ°취£º

ÔÚ”Projects”Ãæ°åÖÐÑ¡ÕªÒª±à¼­µÄ.uiÎļþ¡£

µã»÷”Design”±êÇ© £¬½øÈëÉè¼ÆÆ÷ÊÓͼ¡£

´Ó”Widget Box”ÖÐÍÏק¿Ø¼þµ½Ö÷´°¿ÚÇøÓò¡£

ʹÓýṹÖÎÀíÆ÷£¨Èçˮƽ»ò±ÊÖ±½á¹¹£©À´×éÖ¯¿Ø¼þ¡£

ͨ¹ýË«»÷»òÊôÐԱ༭Æ÷À´ÉèÖÿؼþµÄÊôÐÔ¡£

°ì·¨Áù£º±àд´úÂë

ÔÚQtCreatorÖбàд´úÂëÒ²ºÜÊǼòÆÓ¡£Çëƾ֤ÒÔÏ°취£º

ÔÚ”Projects”Ãæ°åÖÐÑ¡ÕªÒª±à¼­µÄ.cpp»ò.hÎļþ¡£

Ôڱ༭Æ÷ÖбàдËùÐèµÄ´úÂë¡£

ÒÔÏÂÊÇÒ»¸ö¼òÆÓµÄʾÀý³ÌÐò £¬ÑÝʾÔõÑùÔÚQtCreatorÖн¨ÉèÒ»¸ö°´Å¥ £¬²¢ÅþÁ¬µ½Ò»¸ö²Ûº¯Êý£º

main.cpp:

#include <QApplication>
#include "mainwindow.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    MainWindow w;
    w.show();
    return a.exec();
}

µÇ¼ºó¸´ÖÆ

mainwindow.h:

#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void handleButton();

private:
    QPushButton *button;
};

#endif // MAINWINDOW_H

µÇ¼ºó¸´ÖÆ

mainwindow.cpp:

#include "mainwindow.h"
#include <QPushButton>

MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    button = new QPushButton("Click me", this);
    connect(button, &QPushButton::clicked, this, &MainWindow::handleButton);
}

MainWindow::~MainWindow()
{
}

void MainWindow::handleButton()
{
    button->setText("Clicked!");
}

µÇ¼ºó¸´ÖÆ

×ܽ᣺

ͨ¹ýÉÏÊö°ì·¨ £¬ÎÒÃÇÒѾ­ÀÖ³ÉÉèÖÃÁËQtCreatorÓÃÓÚLinuxͼÐνçÃ濪·¢ £¬²¢½¨ÉèÁËÒ»¸ö¼òÆÓµÄʾÀý³ÌÐò¡£ÏÖÔÚ £¬Äú¿ÉÒÔ¼ÌÐøʹÓÃQtCreator¾ÙÐиüÖØ´óµÄͼÐνçÃ濪·¢ÁË¡£×£Äú±à³ÌÓä¿ì£¡

ÒÔÉϾÍÊÇʹÓÃQtCreator¾ÙÐÐLinuxͼÐνçÃ濪·¢µÄ»ù±¾ÉèÖÃÖ¸ÄϵÄÏêϸÄÚÈÝ £¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡

ÃâÔð˵Ã÷£ºÒÔÉÏչʾÄÚÈÝȪԴÓÚÏàÖúýÌå¡¢ÆóÒµ»ú¹¹¡¢ÍøÓÑÌṩ»òÍøÂçÍøÂçÕûÀí £¬°æȨÕùÒéÓë±¾Õ¾ÎÞ¹Ø £¬ÎÄÕÂÉæ¼°¿´·¨Óë¿´·¨²»´ú±í尊龙凯时人生就是博ÂËÓÍ»úÍø¹Ù·½Ì¬¶È £¬Çë¶ÁÕß½ö×ö²Î¿¼¡£±¾ÎĽӴýתÔØ £¬×ªÔØÇë˵Ã÷À´ÓÉ¡£ÈôÄúÒÔΪ±¾ÎÄÇÖÕ¼ÁËÄúµÄ°æȨÐÅÏ¢ £¬»òÄú·¢Ã÷¸ÃÄÚÈÝÓÐÈκÎÉæ¼°ÓÐÎ¥¹«µÂ¡¢Ã°·¸Ö´·¨µÈÎ¥·¨ÐÅÏ¢ £¬ÇëÄúÁ¬Ã¦ÁªÏµ尊龙凯时人生就是博ʵʱÐÞÕý»òɾ³ý¡£

Ïà¹ØÐÂÎÅ

ÁªÏµ尊龙凯时人生就是博

18523999891

¿É΢ÐÅÔÚÏß×Éѯ

ÊÂÇéʱ¼ä£ºÖÜÒ»ÖÁÖÜÎå £¬9:30-18:30 £¬½ÚãåÈÕÐÝÏ¢

QR code
sitemap¡¢ÍøÕ¾µØͼ