Скачать 0.81 Mb.
|
7 СПИСОК ИСПОЛЬЗОВАННЫХ ИСТОЧНИКОВ1 Дьяков И.А., Базы данных. Язык SQL-ТГТУ, 2004
документация-2010.-Режим доступа: http://doc.qt.nokia.com/, свободный. ПРИЛОЖЕНИЕ – ИСХОДНЫЙ КОД ПРИЛОЖЕНИЯ# ------------------------------------------------- # Project created by QtCreator 2010-04-13T16:43:20 # ------------------------------------------------- QT += sql TEMPLATE = app TARGET = VideoShop unix:DESTDIR = bin win32:DESTDIR = ../bin unix:MOC_DIR = moc win32:MOC_DIR = ../moc unix:OBJECTS_DIR = obj win32:OBJECTS_DIR = ../obj TRANSLATIONS += cw_ru.ts SOURCES += main.cpp \ cw.cpp \ supplier.cpp \ isupplier.cpp \ customer.cpp \ icustomer.cpp \ product.cpp \ iproduct.cpp \ seproduct.cpp \ sproduct.cpp \ supplys.cpp \ shop.cpp \ eshop.cpp \ admin.cpp \ newacc.cpp \ employs.cpp \ iemploys.cpp \ getdate.cpp \ raspisanie.cpp \ poolback.cpp HEADERS += cw.h \ supplier.h \ isupplier.h \ customer.h \ icustomer.h \ product.h \ iproduct.h \ seproduct.h \ sproduct.h \ supplys.h \ shop.h \ eshop.h \ admin.h \ newacc.h \ employs.h \ iemploys.h \ getdate.h \ raspisanie.h \ poolback.h FORMS += cw.ui \ supplier.ui \ isupplier.ui \ customer.ui \ icustomer.ui \ product.ui \ iproduct.ui \ seproduct.ui \ sproduct.ui \ supplys.ui \ shop.ui \ eshop.ui \ admin.ui \ newacc.ui \ employs.ui \ iemploys.ui \ getdate.ui \ raspisanie.ui \ poolback.ui #ifndef ADMIN_H #define ADMIN_H #include #include "customer.h" #include "supplier.h" #include "product.h" #include "supplys.h" #include "employs.h" #include "raspisanie.h" namespace Ui { class admin; } class admin : public QDialog { Q_OBJECT public: admin(QWidget *parent = 0); ~admin(); protected: void changeEvent(QEvent *e); private slots: void on_productPushButton_clicked(); void on_supplierPushButton_clicked(); void on_customerPushButton_clicked(); void on_quitPushButton_clicked(); void on_supplyPushButton_clicked(); void on_employsPushButton_clicked(); void on_raspPushButton_clicked(); private: Ui::admin *ui; }; #endif // ADMIN_H #ifndef CUSTOMER_H #define CUSTOMER_H #include "cw.h" #include #include #include namespace Ui { class customer; } class customer : public QDialog { Q_OBJECT public: customer(QWidget *parent = 0); ~customer(); protected: void changeEvent(QEvent *e); private: Ui::customer *ui; QSqlTableModel *model; QPrinter _printer; private: QString tableViewToHtml(); QString htmlAlign( int a ); private slots: void on_previewPushButton_clicked(); void on_removePushButton_clicked(); void on_insertPushButton_clicked(); void on_printPushButton_clicked(); void on_updatePushButton_clicked(); void on_quitPushButton_clicked(); public: QPrinter *printer(); private slots: void submitAll(); void check(QSqlDatabase db); void print(); void insert(); void remove(); void preview(); void pPreview(QPrinter *p); }; #endif // CUSTOMER_H #ifndef CW_H #define CW_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "customer.h" #include "supplier.h" #include "product.h" #include "supplys.h" #include "eshop.h" #include "shop.h" #include "admin.h" namespace Ui { class cw; } class cw : public QDialog { Q_OBJECT public: cw(QWidget *parent = 0); ~cw(); protected: void changeEvent(QEvent *e); private: Ui::cw *ui; private slots: void on_eshopPushButton_clicked(); void on_shopPushButton_clicked(); void on_adminPushButton_clicked(); void on_productPushButton_clicked(); void on_supplierPushButton_clicked(); void on_customerPushButton_clicked(); void on_quitPushButton_clicked(); void on_salePushButton_clicked(); void on_supplyPushButton_clicked(); }; #endif // CW_H #ifndef employs_H #define employs_H #include "cw.h" #include #include #include namespace Ui { class employs; } class employs : public QDialog { Q_OBJECT public: employs(QWidget *parent = 0); ~employs(); protected: void changeEvent(QEvent *e); private: Ui::employs *ui; QSqlTableModel *model; QPrinter _printer; QSqlDatabase db2; private: QString tableViewToHtml(); QString htmlAlign( int a ); private slots: void on_previewPushButton_clicked(); void on_removePushButton_clicked(); void on_insertPushButton_clicked(); void on_printPushButton_clicked(); void on_updatePushButton_clicked(); void on_quitPushButton_clicked(); void on_newPushButton_clicked(); public: QPrinter *printer(); private slots: void submitAll(); void print(); void insert(QSqlDatabase db); void remove(); void preview(); void pPreview(QPrinter *p); }; #endif // employs_H #ifndef ESHOP_H #define ESHOP_H #include #include "cw.h" namespace Ui { class eshop; } class eshop : public QDialog { Q_OBJECT public: eshop(QDialog *parent = 0); ~eshop(); protected: void changeEvent(QEvent *e); void save(QString login, QString pass); protected slots: void on_buyPushButton_clicked(); void on_quitPushButton_clicked(); void on_newPushButton_clicked(); void preview(); void pPreview(QPrinter *p); private: Ui::eshop *ui; QSqlDatabase db; QPrinter _printer; QDate data_postavki; public: QPrinter *printer(); private: QString tableViewToHtml(); QString htmlAlign( int a ); }; #endif // ESHOP_H #ifndef GETDATE_H #define GETDATE_H #include #include "QDate" namespace Ui { class getdate; } class getdate : public QDialog { Q_OBJECT public: getdate(QWidget *parent = 0); ~getdate(); QDate getDateText(); protected: void changeEvent(QEvent *e); private slots: void on_okPushButton_clicked(); private: Ui::getdate *ui; }; #endif // GETDATE_H #ifndef ICUSTOMER_H #define ICUSTOMER_H #include #include #include #include "QDate" namespace Ui { class icustomer; } class icustomer : public QDialog { Q_OBJECT public: icustomer(QWidget *parent = 0); ~icustomer(); protected: void changeEvent(QEvent *e); public: QString getNameText(); QString getAddressText(); QString getPhoneText(); QDate getDateText(); bool emptyField( QLineEdit *le, QString name); bool noNum(QLineEdit *le, QString name ); bool noChar(QLineEdit *le, QString name ); private: Ui::icustomer *m_ui; private slots: bool on_okPushButton_clicked(); void on_quitPushButton_clicked(); }; #endif // ICUSTOMER_H #ifndef iemploys_H #define iemploys_H #include #include #include #include "cw.h" namespace Ui { class iemploys; } class iemploys : public QDialog { Q_OBJECT public: iemploys(QWidget *parent = 0); ~iemploys(); protected: void changeEvent(QEvent *e); public: QString getNameText(); QString getAddressText(); QString getPhoneText(); QDate getDateText(); QString getEmployText(); bool emptyField( QLineEdit *le, QString name); bool noNum(QLineEdit *le, QString name ); bool noChar(QLineEdit *le, QString name ); private: Ui::iemploys *m_ui; QSqlQueryModel *supModel; private slots: bool on_okPushButton_clicked(); void on_quitPushButton_clicked(); }; #endif // iemploys_H #ifndef IPRODUCT_H #define IPRODUCT_H #include namespace Ui { class iproduct; } class iproduct : public QDialog { Q_OBJECT public: iproduct(QWidget *parent = 0); ~iproduct(); protected: void changeEvent(QEvent *e); private: Ui::iproduct *m_ui; public: QString getNameText(); private slots: void on_okPushButton_clicked(); void on_quitPushButton_clicked(); }; #endif // IPRODUCT_H #ifndef ISUPPLIER_H #define ISUPPLIER_H #include namespace Ui { class isupplier; } class isupplier : public QDialog { Q_OBJECT public: isupplier(QWidget *parent = 0); ~isupplier(); protected: void changeEvent(QEvent *e); public: QString getNameText(); QString getAddressText(); QString getPhoneText(); QString getFaxText(); bool emptyField( QLineEdit *le, QString name); bool noNum(QLineEdit *le, QString name ); bool noChar(QLineEdit *le, QString name ); private: Ui::isupplier *m_ui; private slots: bool on_okPushButton_clicked(); void on_quitPushButton_clicked(); }; #endif // ISUPPLIER_H #ifndef NEWACC_H #define NEWACC_H #include #include #include #include "cw.h" namespace Ui { class newAcc; } class newAcc : public QDialog { Q_OBJECT public: newAcc(QWidget *parent = 0); ~newAcc(); bool emptyField( QLineEdit *le, QString name); bool noNum(QLineEdit *le, QString name ); bool noChar(QLineEdit *le, QString name ); protected: void changeEvent(QEvent *e); protected slots: void on_quitPushButton_clicked(); void on_okPushButton_clicked(); private: Ui::newAcc *ui; QSqlDatabase db; }; #endif // NEWACC_H #ifndef poolback_H #define poolback_H #include "cw.h" #include "sproduct.h" #include "iproduct.h" #include "poolback.h" namespace Ui { class poolback; } class poolback : public QDialog { Q_OBJECT public: poolback(QWidget *parent = 0); ~poolback(); protected: void changeEvent(QEvent *e); private: Ui::poolback *ui; QSqlTableModel *model; QSqlTableModel *model2; QSqlQueryModel *supModel; QSqlQueryModel *prodModel; QSqlQueryModel *markamodel; private slots: void on_updatePushButton_clicked(); void on_quitPushButton_clicked(); public: QPrinter *printer(); }; #endif // poolback_H #ifndef PRODUCT_H #define PRODUCT_H #include "cw.h" #include "sproduct.h" #include "iproduct.h" #include "seproduct.h" namespace Ui { class product; } class product : public QDialog { Q_OBJECT public: product(QWidget *parent = 0); ~product(); protected: void changeEvent(QEvent *e); private: Ui::product *ui; QSqlTableModel *model; QPrinter _printer; QSqlDatabase db2; private: QString tableViewToHtml(); QString htmlAlign( int a ); private slots: void on_suppliedProductionPushButton_clicked(); void on_sellingProductionPushButton_clicked(); /* void on_suppliedProductionPushButton_clicked(); */ void on_previewPushButton_clicked(); void on_removePushButton_clicked(); void on_insertPushButton_clicked(); void on_printPushButton_clicked(); void on_updatePushButton_clicked(); void on_quitPushButton_clicked(); public: QPrinter *printer(); private slots: void submitAll(); void print(); void insert(); void remove(); void preview(); void pPreview(QPrinter *p); }; #endif // PRODUCT_H #ifndef raspisanie_H #define raspisanie_H #include "cw.h" #include #include #include namespace Ui { class raspisanie; } class raspisanie : public QDialog { Q_OBJECT public: raspisanie(QWidget *parent = 0); ~raspisanie(); protected: void changeEvent(QEvent *e); private: Ui::raspisanie *ui; QSqlTableModel *model; QPrinter _printer; private: QString tableViewToHtml(); QString htmlAlign( int a ); private slots: void on_previewPushButton_clicked(); void on_removePushButton_clicked(); void on_insertPushButton_clicked(); void on_printPushButton_clicked(); void on_updatePushButton_clicked(); void on_quitPushButton_clicked(); public: QPrinter *printer(); private slots: void submitAll(); void check(QSqlDatabase db); void print(); void insert(); void remove(); void preview(); void pPreview(QPrinter *p); }; #endif // raspisanie_H #ifndef seproduct_H #define seproduct_H #include "cw.h" #include "sproduct.h" #include "iproduct.h" #include "seproduct.h" namespace Ui { class seproduct; } class seproduct : public QDialog { Q_OBJECT public: seproduct(QWidget *parent = 0); ~seproduct(); protected: void changeEvent(QEvent *e); private: Ui::seproduct *ui; QSqlTableModel *model; QSqlTableModel *model2; QSqlQueryModel *supModel; QSqlQueryModel *prodModel; QSqlQueryModel *searchmodel; QPrinter _printer; private: QString tableViewToHtml(); QString htmlAlign( int a ); public: int a; private slots: void on_searchPushButton_clicked(); void on_confirmPushButton_clicked(); void on_removePushButton_clicked(); void on_insertPushButton_clicked(); void on_printPushButton_clicked(); void on_updatePushButton_clicked(); void on_quitPushButton_clicked(); public: QPrinter *printer(); int confirm(); private slots: void submitAll(); void print(); void insert(); void remove(); void preview(); void pPreview(QPrinter *p); void update(); }; #endif // seproduct_H #ifndef SHOP_H #define SHOP_H #include #include "cw.h" namespace Ui { class shop; } class shop : public QDialog { Q_OBJECT public: shop(QDialog *parent = 0); ~shop(); protected: void changeEvent(QEvent *e); private: Ui::shop *ui; QSqlDatabase db; protected slots: void on_buyPushButton_clicked(); void on_quitPushButton_clicked(); void on_nbuyPushButton_clicked(); void on_backPushButton_clicked(); void insert(); }; #endif // SHOP_H #ifndef SPRODUCT_H #define SPRODUCT_H #include "cw.h" namespace Ui { class sproduct; } class sproduct : public QDialog { Q_OBJECT public: sproduct(QWidget *parent = 0); ~sproduct(); protected: void changeEvent(QEvent *e); private: Ui::sproduct *m_ui; QSqlTableModel *model; QSqlQueryModel *supModel; QSqlQueryModel *prodModel; QSqlDatabase db; public: QPrinter *printer(); private slots: void on_pushButton_clicked(); void on_quitPushButton_clicked(); void update(); // void on_addPushButton_clicked(); // void preview(); // void pPreview(QPrinter *p); private: // QString tableViewToHtml(); // QString htmlAlign( int a ); }; #endif // SPRODUCT_H #ifndef supplier_H #define supplier_H #include "cw.h" #include #include #include namespace Ui { class supplier; } class supplier : public QDialog { Q_OBJECT public: supplier(QWidget *parent = 0); ~supplier(); protected: void changeEvent(QEvent *e); private: Ui::supplier *ui; QSqlTableModel *model; QPrinter _printer; private: QString tableViewToHtml(); QString htmlAlign( int a ); private slots: void on_previewPushButton_clicked(); void on_removePushButton_clicked(); void on_insertPushButton_clicked(); void on_printPushButton_clicked(); void on_updatePushButton_clicked(); void on_quitPushButton_clicked(); public: QPrinter *printer(); private slots: void submitAll(); void print(); void insert(); void remove(); void preview(); void pPreview(QPrinter *p); }; #endif // supplier_H #ifndef supplys_H #define supplys_H #include "cw.h" #include #include #include namespace Ui { class supplys; } class supplys : public QDialog { Q_OBJECT public: supplys(QWidget *parent = 0); ~supplys(); protected: void changeEvent(QEvent *e); private: Ui::supplys *ui; QSqlTableModel *model; QPrinter _printer; private: QString tableViewToHtml(); QString htmlAlign( int a ); private slots: void on_previewPushButton_clicked(); void on_removePushButton_clicked(); void on_insertPushButton_clicked(); void on_printPushButton_clicked(); void on_updatePushButton_clicked(); void on_quitPushButton_clicked(); public: QPrinter *printer(); private slots: void submitAll(); void print(); void insert(); void remove(); void preview(); void pPreview(QPrinter *p); }; #endif // supplys_H #include "admin.h" #include "ui_admin.h" admin::admin(QWidget *parent) : QDialog(parent), ui(new Ui::admin) { ui->setupUi(this); } admin::~admin() { delete ui; } void admin::changeEvent(QEvent *e) { QDialog::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } } void admin::on_quitPushButton_clicked() { close(); } void admin::on_customerPushButton_clicked() { customer customer; customer.setWindowTitle(trUtf8("Доставки")); customer.exec(); } void admin::on_supplierPushButton_clicked() { supplier supplier; supplier.setWindowTitle(trUtf8("Наши поставщики")); supplier.exec(); } void admin::on_supplyPushButton_clicked() { supplys supplys; supplys.setWindowTitle(trUtf8("Предстоящие поставки")); supplys.exec(); } void admin::on_productPushButton_clicked() { product product; product.setWindowTitle(trUtf8("Нашы товары")); product.exec(); } void admin::on_employsPushButton_clicked() { employs employs; employs.setWindowTitle(trUtf8("Нашы сотрудники")); employs.exec(); } void admin::on_raspPushButton_clicked() { raspisanie raspisanie; raspisanie.setWindowTitle(trUtf8("Расписание")); raspisanie.exec(); } #include "admin.h" #include "ui_admin.h" admin::admin(QWidget *parent) : QDialog(parent), ui(new Ui::admin) { ui->setupUi(this); } admin::~admin() { delete ui; } void admin::changeEvent(QEvent *e) { QDialog::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } } void admin::on_quitPushButton_clicked() { close(); } void admin::on_customerPushButton_clicked() { customer customer; customer.setWindowTitle(trUtf8("Доставки")); customer.exec(); } void admin::on_supplierPushButton_clicked() { supplier supplier; supplier.setWindowTitle(trUtf8("Наши поставщики")); supplier.exec(); } void admin::on_supplyPushButton_clicked() { supplys supplys; supplys.setWindowTitle(trUtf8("Предстоящие поставки")); supplys.exec(); } void admin::on_productPushButton_clicked() { product product; product.setWindowTitle(trUtf8("Нашы товары")); product.exec(); } void admin::on_employsPushButton_clicked() { employs employs; employs.setWindowTitle(trUtf8("Нашы сотрудники")); employs.exec(); } void admin::on_raspPushButton_clicked() { raspisanie raspisanie; raspisanie.setWindowTitle(trUtf8("Расписание")); raspisanie.exec(); } #include "cw.h" #include "ui_cw.h" #include cw::cw(QWidget *parent) : QDialog(parent), ui(new Ui::cw) { QSqlDatabase _db = QSqlDatabase::addDatabase("QIBASE", "connection"); _db.setConnectOptions("CHARSET=UTF8"); _db.setHostName("localhost"); _db.setDatabaseName("C:\\Users\\user\\Desktop\\KURSOVIK_DB.GDB"); _db.setUserName("SYSDBA"); _db.setPassword("masterkey"); // _db.setPort(3306); if (!_db.open()) { QString error = _db.lastError().text(); QMessageBox::critical( this, "IBase error", error); } else ui->setupUi(this); } cw::~cw() { delete ui; } void cw::changeEvent(QEvent *e) { QDialog::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } } void cw::on_quitPushButton_clicked() { close(); } void cw::on_customerPushButton_clicked() { customer customer; customer.setWindowTitle(tr("Our Customers")); customer.exec(); } void cw::on_supplierPushButton_clicked() { supplier supplier; supplier.setWindowTitle(tr("Our Suppliers")); supplier.exec(); } void cw::on_salePushButton_clicked() { supplys supplys; supplys.setWindowTitle(tr("Our Suppliers")); supplys.exec(); } void cw::on_supplyPushButton_clicked() { supplys supplys; supplys.setWindowTitle(trUtf8("Предстоящие поставки")); supplys.exec(); } void cw::on_productPushButton_clicked() { product product; product.setWindowTitle(tr("Our Production")); product.exec(); } void cw::on_eshopPushButton_clicked() { eshop eshop; eshop.setWindowTitle((trUtf8("Электронная версия"))); eshop.exec(); } void cw::on_shopPushButton_clicked() { shop shop; shop.setWindowTitle(trUtf8("Магазин")); shop.exec(); } void cw::on_adminPushButton_clicked() { admin admin; admin.setWindowTitle(trUtf8("Администратору")); admin.exec(); } #include "employs.h" #include "ui_employs.h" #include "cw.h" #include "iemploys.h" #include #include #include #include #include #include "QInputDialog" employs::employs(QWidget *parent) : QDialog(parent), ui(new Ui::employs) { ui->setupUi(this); // Creating a model QSqlDatabase db = QSqlDatabase::database("connection",1); model = new QSqlTableModel(this, db); model->setTable("SOTRUDNIKI_TABLE1"); model->setEditStrategy(QSqlTableModel::OnManualSubmit); model->setHeaderData(1, Qt::Horizontal, QObject::trUtf8("Ф.И.О сотрудника")); model->setHeaderData(2, Qt::Horizontal, QString::fromUtf8("Должность")); model->setHeaderData(3, Qt::Horizontal, QObject::trUtf8("Дата рождения")); model->setHeaderData(4, Qt::Horizontal, QObject::trUtf8("Домашний адрес")); model->setHeaderData(5, Qt::Horizontal, QObject::trUtf8("Контактный телефон")); model->select(); // Creating a view ui->tableView->setModel(model); ui->tableView->setSortingEnabled(true); ui->tableView->hideColumn(0); ui->tableView->resizeColumnsToContents(); } employs::~employs() { delete ui; } void employs::changeEvent(QEvent *e) { QDialog::changeEvent(e); switch (e->type()) { case QEvent::LanguageChange: ui->retranslateUi(this); break; default: break; } } void employs::on_quitPushButton_clicked() { close(); } void employs::submitAll() { if ( ! model->submitAll() ) { QMessageBox::critical(this,tr("Error"), tr("Can't submit data: ") + model->lastError().text() ); } } void employs::on_updatePushButton_clicked() { submitAll(); } void employs::on_printPushButton_clicked() { print(); } void employs::insert(QSqlDatabase db) { iemploys iemploys; iemploys.setWindowTitle(trUtf8("Новый сотрудник")); int res = iemploys.exec(); if ( res != QDialog::Accepted ) return; QSqlRecord rec = model->record(); rec.setValue(1, iemploys.getNameText()); rec.setValue(2, iemploys.getEmployText()); rec.setValue(3, iemploys.getDateText()); rec.setValue(4, iemploys.getAddressText()); rec.setValue(5, iemploys.getPhoneText()); rec.setValue(0, model->rowCount()+1); model->insertRecord(model->rowCount(), rec); submitAll(); QString empty="0"; QString str = "INSERT INTO Raspisanie_TABLE " "VALUES ('" + iemploys.getNameText() + "' ," + "'"+ iemploys.getEmployText() + "' ," + "" "'" + empty + "' ," + "'" + empty + "' ," + "'" + empty + "' ," + "'" + empty + "" "'," + "'"+ empty + "' ," + "'"+ empty + "' ," + "'" + empty + "')"; QSqlQuery query(str, db); qDebug()< } void employs::on_insertPushButton_clicked() { QSqlDatabase db = QSqlDatabase::database("connection",1); insert(db); } void employs::on_newPushButton_clicked() { bool ok; QString text = QInputDialog::getText(this, trUtf8("Новая Должность"), trUtf8("Должность:"), QLineEdit::Normal, QDir::home().dirName(), &ok); if (ok && !text.isEmpty()) { db2 = QSqlDatabase::database("connection",1); QString string = "SELECT MAX(DOLGNOST_ID) " "FROM DOLGNOST_TABLE "; QSqlQuery q(string, db2); q.exec(string); QSqlQueryModel m; m.setQuery(q); int ID = m.index(0,0).data(Qt::DisplayRole).toInt(); qDebug() << "ID" << ID; QString id; id = id.setNum(ID+1); QString str = "INSERT INTO DOLGNOST_TABLE " "VALUES ('" + id + "' ," + "'"+ text + "' ," + "'10000');"; qDebug()< QSqlQuery query(str, db2); //query.exec(); qDebug() << query.lastError(); } } void employs::remove() { int row; QItemSelectionModel *selectModel; QModelIndexList indexes; QModelIndex index; // Узнаем выделенную строку selectModel = ui->tableView->selectionModel(); indexes = selectModel->selectedIndexes(); foreach(index, indexes) { QString str; row = index.row(); if (!model->removeRows(row,1)) { qDebug() << str << "\n"; break; } else { ui->tableView->setRowHidden(row, true); } } } void employs::on_removePushButton_clicked() { remove(); } void employs::preview() { QPrintPreviewDialog preview( printer(), this ); connect(&preview, SIGNAL(paintRequested(QPrinter *)), this, SLOT(pPreview(QPrinter *))); preview.resize(640, 480); preview.exec(); } QString employs::tableViewToHtml() { int firstRow = 0; int lastRow = ui->tableView->model()->rowCount(); int firstColumn = 0; int lastColumn = ui->tableView->model()->columnCount(); bool selectionOnly = ui->tableView->selectionModel()->hasSelection(); if ( selectionOnly ) { firstRow = -1; lastRow = -1; firstColumn = -1; lastColumn = -1; QModelIndexList indexList = ui->tableView->selectionModel()->selection().indexes(); foreach( QModelIndex index, indexList ) { if ( index.row() < firstRow || firstRow == -1 ) firstRow = index.row(); if ( index.row() > lastRow || lastRow == -1 ) lastRow = index.row(); if ( index.column() < firstColumn || firstColumn == -1 ) firstColumn = index.column(); if ( index.column() > lastColumn || lastColumn == -1 ) lastColumn = index.column(); } lastRow = lastRow +1; lastColumn = lastColumn +1; } QString title = tr("Our employss:"); QDateTime dt; QString time = dt.currentDateTime().toString(); QString value; QString string; QString employs = "" " " + time + " " +title + """" " "width='98%' cellspacing='0' cellpadding='1'>"; employs += " // head for (int head = firstColumn; head != lastColumn; head++) { value += " if ( ui->tableView->isColumnHidden(head) == true) continue; QString al = ui->tableView->model()->headerData(head, Qt::Horizontal, Qt::TextAlignmentRole).toString(); if (al != "") value += " align=" + al; QString bgc = ui->tableView->model()->headerData(head, Qt::Horizontal, Qt::BackgroundRole).toString(); if (bgc != "") value += " bgcolor=" + bgc; value += ">"; QString tc = ui->tableView->model()->headerData(head, Qt::Horizontal, Qt::ForegroundRole).toString(); if (tc != "") value += ""; value += ui->tableView->model()->headerData(head, Qt::Horizontal, Qt::DisplayRole).toString(); if (tc != "") value += ""; value += ""; } employs += value; //strings employs += " for (int row = firstRow; row != lastRow; ++row) { string += " QString cell; for (int col = firstColumn; col != lastColumn; ++col) { if ( ui->tableView->isColumnHidden(col) == true) continue; cell += " int a = ui->tableView->model()->index(row, col). data(Qt::TextAlignmentRole).toInt(); cell += htmlAlign(a); QString bgc = ui->tableView->model()->index(row, col). data(Qt::BackgroundRole).toString(); if (bgc != "") cell += " bgcolor=" + bgc; cell += ">"; QString tc = ui->tableView->model()->index(row, col). data(Qt::ForegroundRole).toString(); if (tc != "") cell += ""; QString d = ui->tableView->model()->index(row, col). data(Qt::DisplayRole).toString(); cell += d; if (tc != "") cell += ""; cell += ""; } string += cell; string += " } employs += string; employs += " |
---|
Пояснительная записка к курсовому проекту по дисциплине «Разработка... Курсовой проект содержит: страниц – 22, источников – 8, рисунков – 9, таблиц – 1 | Пояснительная записка к курсовой работе по дисциплине «Разработка... Курсовая работа содержит: страниц – 20, источников – 8, рисунков – 7, таблиц – 2 | ||
Пояснительная записка к курсовому проекту по дисциплине «Разработка... Курсовой проект содержит: страниц –19, источников – 5, рисунков – 6, таблиц – 2 | Пояснительная записка к курсовой работе по дисциплине «Разработка... Курсовой проект содержит: страниц –22, источников – 5, рисунков – 6, таблиц – 2 | ||
Пояснительная записка к курсовой работе по дисциплине «Разработка... Курсовой проект содержит: страниц –20, источников – 5, рисунков – 6, таблиц – 2 | Дипломная работа содержит 6 разделов, в которых рассмотрены: анализ... Пояснительная записка дипломной работы состоит из 101 листа, содержит 12 рисунков и 5 таблиц | ||
Реферат в работе изложены теоретические вопросы, проведен анализ... Работа содержит 69 страниц, 15 рисунков, 11 таблиц, 18 приложений, 48 источников | Реферат Отчет содержит 234 страницы, 80 рисунков, 10 таблиц, 103 источника Пав, предмицеллярные сферические агрегаты, глобулярные и малые сфероцилиндрические мицеллы, но отсутствуют сферические мицеллы. Полученные... | ||
Исследование модели фрактального броуновского движения Дипломная работа содержит 96 страниц, 24 рисунка, 5 таблиц, 11 источников, 1 приложение | Реферат Дипломный проект : страниц 117, рисунков 7, таблиц 28, источников 15 В дипломном проекте решается важная техническая задача – модернизация ректификационной колонны | ||
Реферат Отчет 20 с., 3 раздела, рисунков, таблиц, 4 источника, 4 приложения Содержание деятельности и результаты Мероприятия «Реализация программ исследовательского обучения для обучающихся и педагогов на... | Реферат Курсовой проект содержит 35 страниц, 14 таблиц, 25 источников Состояние и перспективы развития молочной промышленности на примере Республики Мордовия | ||
Реферат Курсовой проект выполнен в объеме 32 страниц, содержит двенадцать... При проектировании были разработаны и рассчитаны интегратор на оу, симметричный мультивибратор, ключевое устройство и эмиттерный... | Реферат Отчет содержит 90 машинописных страниц, включая 18 таблиц Государственный научно-исследовательский институт озерного и речного рыбного хозяйства (Госниорх) | ||
Блок … … Структура и объем диссертации. Диссертация состоит из 120 страниц текста, содержит введение, четыре главы, заключение, список литературы... | Дуглас Грэхем 80/10/10 Структура и объем диссертации. Диссертация состоит из 120 страниц текста, содержит введение, четыре главы, заключение, список литературы... |