C++ (Qt)sText = TextBook->textCursor().selection().toHtml();
while(iNumberPage < ListPages.count()) { lFind: if(TextBook->find(sFindText) == false) { slotNextPage(); //iNumberPage++ if(iNumberPage == ListPages.count() - 1) break; goto lFind; } else break; }
QFont TextFont; TextFont = QFontDialog::getFont(&Accept, TextFont); QTextCharFormat tcf; tcf.setFont(TextFont); TextBook->textCursor().setCharFormat(tcf);
connect(ListAdditionallyWidget, SIGNAL(doubleClicked(QModelIndex)), SLOT(slotRunFile())); void ListAdditionally::slotRunFile() { if(*sItem == tr("Documents") && gRegime == true) { QString sTmp; sTmp = ListAdditionallyWidget->item(ListAdditionallyWidget->currentRow())->text(); int ipos = sTmp.lastIndexOf("/") + 1; sTmp.remove(0, ipos); QFile ifile(ListAdditionallyWidget->item(ListAdditionallyWidget->currentRow())->text()); QDataStream idata(&ifile); QByteArray bfile; ifile.open(QIODevice::ReadOnly); bfile = ifile.readAll(); QFile ofile("/tmp/xwel/tempfile/" + sTmp); QDataStream odata(&ofile); ofile.open(QIODevice::WriteOnly); ofile.write(bfile); ifile.close(); ofile.close(); QDesktopServices::openUrl(QUrl::fromLocalFile("/tmp/xwel/tempfile/" + sTmp));//Открытие копии документа } else //Открытие оригинала документа QDesktopServices::openUrl(QUrl::fromLocalFile(ListAdditionallyWidget->item(ListAdditionallyWidget->currentRow())->text())); }
C++ (Qt)void ElectronicLibrary::slotPrint(){ QPrinter printer; QPrintDialog *pPrintDialog = new QPrintDialog(&printer); if(pPrintDialog->exec() == QDialog::Accepted) { QPainter painter(&printer); QRect r(painter.viewport()); if(ListPages.count() > 0) { for(int i = 0; i < ListPages.count(); i++) { TextBook->setHtml(ListPages.at(i)); painter.drawText(r, TextBook->toPlainText()); printer.newPage(); } painter.end(); } TextBook->setHtml(ListPages.at(0)); sbNumberPage.setValue(1); } delete pPrintDialog;}