8-mustaqil ish Bu shartdan biz bloknotdasturinituzishniko’ribchiqamiz



Download 469,78 Kb.
Sana06.07.2022
Hajmi469,78 Kb.
#750886
Bog'liq
8-topshiriq


8-mustaqil ish
Bu shartdan biz bloknotdasturinituzishniko’ribchiqamiz

  1. Qt dasturigakiramiz

Bloknotdasturiningko’rini Bu shartdan biz bloknotdasturinituzishniko’ribchiqamiz

  1. Qt dasturigakiramiz

  2. Bloknotdasturiningko’rinishinituzibolamiz

  3. Пишитездесъgakiribkeraklifunksiyalarniqo’shamiz

  4. Qo’shilganfunksiyalaruchunkodyozamiz .Buninguchunpastadkeraklifunksiyaningustigakelibsichqonchaning chap tomoninibosib “прейтуслоту” gakelib “triggered”nitanlab enter tugmasibosiladi.

  5. So’ngfunksiyauchunkodyozamiz

Birgina “Yangiyaratish” funcksiyasiuchunquyidagikodniyozamiz
voidMainWindow::on_actionYangi_yaratish_triggered()
{
ui->statusBar->showMessage("Yangisahifaochildi!");
cfile.clear();
ui->textEdit->setText(QString());
}.

  1. Shu zayildabarchafunksiyagakodyozamiz.

  2. Kodniyozibbo’lganimizdanso’ngbufungsiyalarnibajarishuchuntezkorklavishlarinijoylashtiribchiqsak ham bo’ladi. Buninguchun .Kerakliyozuvuchunsichqonchaningo’ngtugmasini 2 martabosib “горяччийкилавиш”deganqatorgateskorkilavishniyozamiz

  3. Bu yazgankodlarimiznihammatushunishiuchunfunksiyalargamosrasmjoylashtiramiz. Buninguchundastursaqlanayotganfaylustigakelibmishkaning chap tugmasinibosib “dabavitnoviy” gakirib



Buyrug’Itanlanadi.

  1. Shundayangi (.qrc)farmatdagipapkahosilbo’ladi.

  2. Hasil bo’lganpapkagarasmlarnitashlaymizvarasmgamosfunksiyanitanlabkiramizvavibratresursgakiribrasmnibelgilabqo’yamiz .

  3. Shu tariqa bloknotdasturinituzamiz.

Bu tayyorbo’lganblaknotdasturini .h fayli

  1. #ifndefMAINWINDOW_H

  2. #defineMAINWINDOW_H


  3. #include

  4. #include

  5. #include

  6. #include

  7. #include

  8. #include

  9. #include

  10. namespaceUi{

  11. classMainWindow;

  12. }


  13. classMainWindow:publicQMainWindow

  14. {

  15. Q_OBJECT


  16. public:

  17. explicitMainWindow(QWidget*parent=0);

  18. ~MainWindow();


  19. privateslots:

  20. voidon_actionChiqish_triggered();


  21. voidon_actionNusxa_olish_triggered();


  22. voidon_actionJoylashtirish_triggered();


  23. voidon_actionYangi_yaratish_triggered();


  24. voidon_actionOchish_triggered();


  25. voidon_actionSaqlash_triggered();


  26. private:

  27. Ui::MainWindow*ui;

  28. QStringcfile="";

  29. };


  30. #endif//MAINWINDOW_H

.cppfayli

  1. #include"mainwindow.h"

  2. #include"ui_mainwindow.h"


  3. MainWindow::MainWindow(QWidget*parent):

  4. QMainWindow(parent),

  5. ui(newUi::MainWindow)

  6. {

  7. ui->setupUi(this);

  8. }


  9. MainWindow::~MainWindow()

  10. {

  11. deleteui;

  12. }


  13. voidMainWindow::on_actionChiqish_triggered()

  14. {

  15. QApplication::quit();

  16. }


  17. voidMainWindow::on_actionNusxa_olish_triggered()

  18. {

  19. ui->textEdit->copy();

  20. }


  21. voidMainWindow::on_actionJoylashtirish_triggered()

  22. {

  23. ui->textEdit->paste();

  24. }


  25. voidMainWindow::on_actionYangi_yaratish_triggered()

  26. {

  27. ui->statusBar->showMessage("Yangisahifaochildi!");

  28. cfile.clear();

  29. ui->textEdit->setText(QString());

  30. }


  31. voidMainWindow::on_actionOchish_triggered()

  32. {

  33. QStringfileName=QFileDialog::getOpenFileName(this,"Openthefile");

  34. QFilefile(fileName);

  35. cfile=fileName;

  36. if(!file.open(QIODevice::ReadOnly|QFile::Text))

  37. {

  38. QMessageBox::warning(this,"warning","Connotopenfile:"+file.errorString());

  39. }

  40. setWindowTitle(fileName);

  41. QTextStreamin(&file);

  42. QStringtext=in.readAll();

  43. ui->textEdit->setText(text);

  44. file.close();

  45. }


  46. voidMainWindow::on_actionSaqlash_triggered()

  47. {

  48. QStringfileName=QFileDialog::getSaveFileName(this,"qandaysaqlash");

  49. QFilefile(fileName+".txt");

  50. if(!file.open(QFile::WriteOnly|QFile::Text))

  51. {

  52. QMessageBox::warning(this,"Xato!","fayisaqlanmadi:"+file.errorString());

  53. return;

  54. }

  55. cfile=fileName;

  56. setWindowTitle(fileName);

  57. QTextStreamout(&file);

  58. QStringtext=ui->textEdit->toPlainText();

  59. out<

  60. file.close();

  61. }

  1. shinituzibolamiz

  2. Пишитездесъgakiribkeraklifunksiyalarniqo’shamiz

  3. Qo’shilganfunksiyalaruchunkodyozamiz .Buninguchunpastadkeraklifunksiyaningustigakelibsichqonchaning chap tomoninibosib “прейтуслоту” gakelib “triggered”nitanlab enter tugmasibosiladi.

  4. So’ngfunksiyauchunkodyozamiz

Birgina “Yangiyaratish” funcksiyasiuchunquyidagikodniyozamiz
voidMainWindow::on_actionYangi_yaratish_triggered()
{
ui->statusBar->showMessage("Yangisahifaochildi!");
cfile.clear();
ui->textEdit->setText(QString());
}.

  1. Shu zayildabarchafunksiyagakodyozamiz.

  2. Kodniyozibbo’lganimizdanso’ngbufungsiyalarnibajarishuchuntezkorklavishlarinijoylashtiribchiqsak ham bo’ladi. Buninguchun .Kerakliyozuvuchunsichqonchaningo’ngtugmasini 2 martabosib “горяччийкилавиш”deganqatorgateskorkilavishniyozamiz

  3. Bu yazgankodlarimiznihammatushunishiuchunfunksiyalargamosrasmjoylashtiramiz. Buninguchundastursaqlanayotganfaylustigakelibmishkaning chap tugmasinibosib “dabavitnoviy” gakirib



Buyrug’Itanlanadi.

  1. Shundayangi (.qrc)farmatdagipapkahosilbo’ladi.

  2. Hasil bo’lganpapkagarasmlarnitashlaymizvarasmgamosfunksiyanitanlabkiramizvavibratresursgakiribrasmnibelgilabqo’yamiz .

  3. Shu tariqa bloknotdasturinituzamiz.

Bu tayyorbo’lganblaknotdasturini .h fayli

  1. #ifndefMAINWINDOW_H

  2. #defineMAINWINDOW_H


  3. #include

  4. #include

  5. #include

  6. #include

  7. #include

  8. #include

  9. #include

  10. namespaceUi{

  11. classMainWindow;

  12. }


  13. classMainWindow:publicQMainWindow

  14. {

  15. Q_OBJECT


  16. public:

  17. explicitMainWindow(QWidget*parent=0);

  18. ~MainWindow();


  19. privateslots:

  20. voidon_actionChiqish_triggered();


  21. voidon_actionNusxa_olish_triggered();


  22. voidon_actionJoylashtirish_triggered();


  23. voidon_actionYangi_yaratish_triggered();


  24. voidon_actionOchish_triggered();


  25. voidon_actionSaqlash_triggered();


  26. private:

  27. Ui::MainWindow*ui;

  28. QStringcfile="";

  29. };


  30. #endif//MAINWINDOW_H

.cppfayli

  1. #include"mainwindow.h"

  2. #include"ui_mainwindow.h"


  3. MainWindow::MainWindow(QWidget*parent):

  4. QMainWindow(parent),

  5. ui(newUi::MainWindow)

  6. {

  7. ui->setupUi(this);

  8. }


  9. MainWindow::~MainWindow()

  10. {

  11. deleteui;

  12. }


  13. voidMainWindow::on_actionChiqish_triggered()

  14. {

  15. QApplication::quit();

  16. }


  17. voidMainWindow::on_actionNusxa_olish_triggered()

  18. {

  19. ui->textEdit->copy();

  20. }


  21. voidMainWindow::on_actionJoylashtirish_triggered()

  22. {

  23. ui->textEdit->paste();

  24. }


  25. voidMainWindow::on_actionYangi_yaratish_triggered()

  26. {

  27. ui->statusBar->showMessage("Yangisahifaochildi!");

  28. cfile.clear();

  29. ui->textEdit->setText(QString());

  30. }


  31. voidMainWindow::on_actionOchish_triggered()

  32. {

  33. QStringfileName=QFileDialog::getOpenFileName(this,"Openthefile");

  34. QFilefile(fileName);

  35. cfile=fileName;

  36. if(!file.open(QIODevice::ReadOnly|QFile::Text))

  37. {

  38. QMessageBox::warning(this,"warning","Connotopenfile:"+file.errorString());

  39. }

  40. setWindowTitle(fileName);

  41. QTextStreamin(&file);

  42. QStringtext=in.readAll();

  43. ui->textEdit->setText(text);

  44. file.close();

  45. }


  46. voidMainWindow::on_actionSaqlash_triggered()

  47. {

  48. QStringfileName=QFileDialog::getSaveFileName(this,"qandaysaqlash");

  49. QFilefile(fileName+".txt");

  50. if(!file.open(QFile::WriteOnly|QFile::Text))

  51. {

  52. QMessageBox::warning(this,"Xato!","fayisaqlanmadi:"+file.errorString());

  53. return;

  54. }

  55. cfile=fileName;

  56. setWindowTitle(fileName);

  57. QTextStreamout(&file);

  58. QStringtext=ui->textEdit->toPlainText();

  59. out<

  60. file.close();

  61. }





Bajardi: Ochilova Mehrangiz


Tekshirdi: Bobonazarov Akmal
Download 469,78 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish