C++ (Qt)//Изменение таблицыvoid KlenLibrary::slotResizeTable(){ if(gRegimeViewing == true) return; InputParametrTable FormInputParametrTable; FormInputParametrTable.setWindowTitle(tr("Change table parametrs")); if(FormInputParametrTable.exec() == QDialog::Accepted) { if(FormInputParametrTable.SpinColumnCount->value() > 0 && FormInputParametrTable.SpinColumnCount->value() > 0) { TextBook->textCursor().currentTable()->resize(FormInputParametrTable.SpinRowCount->value(), FormInputParametrTable.SpinColumnCount->value()); } }}
C++ (Qt)void KlenLibrary::slotBackupLibrary(){ QString sNameBackupLibrary = QFileDialog::getSaveFileName(0, tr("Backup library"), "", "*.xwlbz"); if(sNameBackupLibrary == "") return; if(sNameBackupLibrary.indexOf(".xwlbz") == -1) sNameBackupLibrary += ".xwlbz"; QFile ifile(sNameLibrary); ifile.open(QIODevice::ReadOnly); QByteArray baExport; baExport = ifile.readAll(); ifile.close(); baExport = qCompress(baExport, 9);//Сжатие данных - 9-ая степень QFile ofile(sNameBackupLibrary); ofile.open(QIODevice::WriteOnly); ofile.write(baExport); ofile.close();} void KlenLibrary::slotRestoreLibrary(){ QString sNameBackupLibrary = QFileDialog::getOpenFileName(0, tr("Open backup"), "", "*.xwlbz"); if(sNameBackupLibrary == "") return; QFile ifile(sNameBackupLibrary); ifile.open(QIODevice::ReadOnly); QByteArray baImport; baImport = ifile.readAll(); ifile.close(); baImport = qUncompress(baImport);//Извлечение данных из архива sNameBackupLibrary = QFileDialog::getSaveFileName(0, tr("Restore library"), "", "*.xwlb"); if(sNameBackupLibrary.indexOf(".xwlb") == -1) sNameBackupLibrary += ".xwlb"; if(sNameBackupLibrary == "") return; QFile ofile(sNameBackupLibrary); ofile.open(QIODevice::WriteOnly); ofile.write(baImport); ofile.close();}
C++ (Qt) bool Accept; QFont TextFont; TextFont = TextQuestion->textCursor().charFormat().font(); TextFont = QFontDialog::getFont(&Accept, TextFont); if(Accept) { QTextCharFormat tcf; tcf.setFont(TextFont); TextQuestion->textCursor().setCharFormat(tcf); cbFont.setCurrentFont(TextFont); } else return 1;
C++ (Qt)... int TTextBook::isCountPages() const{ return ListPages.count();} int TTextBook::isNumberBook() const{ return i_NumberBook;} void TTextBook::setNumberBook(int iNumberBook){ i_NumberBook = iNumberBook;} int TTextBook::isYear() const{ return i_Year;} void TTextBook::setYear(int iYear){ i_Year = iYear; sYear.setNum(iYear);} int TTextBook::isCurrentPage() const{ return i_CurrentPage;} void TTextBook::setCurrentPage(int iCurrentPage){ i_CurrentPage = iCurrentPage;} int TTextBook::isModeWork() const{ return b_ModeWork;} void TTextBook::setModeWork(bool bModeWork){ b_ModeWork = bModeWork;} QByteArray TTextBook::isPassword() const{ return ba_Password;} void TTextBook::setPassword(QByteArray baPassword){ ba_Password = baPassword;}... //Исправлена печать - печатается весь текст :)void TTextBook::slotPrint(){ QPrinter printer; QPrintDialog *pPrintDialog = new QPrintDialog(&printer); QTextDocument *textDoc = new QTextDocument; QString sPrint; if(pPrintDialog->exec() == QDialog::Accepted) { sPrint = makeOneHTML(); QImage textImage; for (int i = 0; i < ListImages.count(); i++) { textImage.loadFromData(ListImages.at(i)); textDoc->addResource(QTextDocument::ImageResource, QUrl(slNumberImages.at(i)), textImage); } textDoc->setHtml(sPrint); textDoc->print(&printer); } delete textDoc; delete pPrintDialog;}