Respublikasi oliy va o’rta-maxsus ta’lim vazirligi samarqand davlat universiteti raqamli texnologiyalar



Download 3,04 Mb.
bet9/9
Sana03.03.2022
Hajmi3,04 Mb.
#480852
1   2   3   4   5   6   7   8   9
Bog'liq
MuhriddinTohirov Dasturiy injinering

Dasturimizning umumiy ko’rinishi

22-rasm
My SQL malumotlar bazasini Qt Creator bilan ulash kodlari

#include "mainwindow.h"


#include "ui_mainwindow.h"
#include "QString"
#include
#include
#include
#include
#include
#include
#include
#include
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
QSqlDatabase db;

QSqlQueryModel *m=new QSqlQueryModel();


db = QSqlDatabase::addDatabase("QODBC");
db.setDatabaseName("DRIVER={Microsoft Access Driver (*.mdb)};FIL={MS Access};DBQ=Teatr.mdb");
db.open();
if(!db.open())
{
QMessageBox::critical(this,tr("Ошибка"),db.lastError().text());

}
}

MainWindow::~MainWindow()
{
delete ui;

}


void MainWindow::on_pushButton_clicked()
{
model = new QSqlTableModel(this);
model->setTable("teatr");
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableView->resizeColumnsToContents();
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->horizontalHeader()->setStretchLastSection(true);

model->select();


ui->tableView->setModel(model);
ui->tableView->show();
}

void MainWindow::on_pushButton_5_clicked()


{
Model = new QSqlTableModel(this);
model->setTable(“spe");
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableView->resizeColumnsToContents();
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->horizontalHeader()->setStretchLastSection(true);

model->select();


ui->tableView->setModel(model);
ui->tableView->show();
}

void MainWindow::on_pushButton_4_clicked()


{
model = new QSqlTableModel(this);
model->setTable("xodimlar");
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableView->resizeColumnsToContents();
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->horizontalHeader()->setStretchLastSection(true);

model->select();


ui->tableView->setModel(model);
ui->tableView->show();

}


void MainWindow::on_pushButton_2_clicked()
{
model = new QSqlTableModel(this);
model->setTable("spektakllar)");
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableView->resizeColumnsToContents();
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->horizontalHeader()->setStretchLastSection(true);

model->select();


ui->tableView->setModel(model);
ui->tableView->show();

}


void MainWindow::on_pushButton_3_clicked()
{
model = new QSqlTableModel(this);
model->setTable("Xodimlar");
ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
ui->tableView->setSelectionMode(QAbstractItemView::SingleSelection);
ui->tableView->resizeColumnsToContents();
ui->tableView->setEditTriggers(QAbstractItemView::NoEditTriggers);
ui->tableView->horizontalHeader()->setStretchLastSection(true);

model->select();


ui->tableView->setModel(model);
ui->tableView->show();
}

Xulosa
Xulosa qilib shuni ta’kidlash mumkin men tayyorlagan ushbu kurs ishimda qt dasturlash muhitidan foydalangan holatda teatr uchun foydanadigan dasturni ishlab chiqdim.Ushbu dastur keng omma foydalanishi uchun yaratildi.Ushbu dastur orqali biz chipta sotib olish,namoyish etiladigan sahna ko’rinshlari ro’yxati,ishlaydigan xodimlar ro’yxati bilan tanishishlari,anonslar,teatr tarixi haqida bilib olishlari mumkin.Ushbu dastur orqali keng omma teatr haqida katta ma’lumotga ega bo’ladilar va bu hamma uchun foydali bo’ladi degan umiddaman!
Xozirgi fan-texnika xamda informatsion texnologiyalarining jadal rivojlanayotgan vaqtida ATlarga bo`lgan talablar juda xam kuchli bo`lib, bu talablarni to`laqonli qondirish biz va bizga o`xshash yosh dasturchilarning oldida turgan ulkan vazifalardan biri bo`lib xisoblanadi. Menga berilgan loyiha <> loyihasi bunda <> haqida dastur tuzdim bu dasturni tuzshim uchun birinchi navbatda MySQL malumotlar bazasini yaratib oldim va Qt Creatorga ulanish kodlarini terib ulab dasturni tuzdim.Bunda tugmalar va vedjetlardan foydalandim dizayn qismini qilsh uchun Background color bo’limidan foydalanib tuzdim.Bu kurs ishida asosan tableWidget foydalaniladi.Bu dasturni ishlatishdan maqsad foydalanuchi ishini osonlashtiradi.







Download 3,04 Mb.

Do'stlaringiz bilan baham:
1   2   3   4   5   6   7   8   9




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