C++ (Qt)class MainWindow: public QMainWindow, public DataCommitter{ Q_OBJECT......private:...... QToolButton * addNewText;......class Dialog: public QWidget{ Q_OBJECT public: Dialog(QWidget * parent = 0); private slots: void setText();};
C++ (Qt) addNewText = new QToolButton ( navToolbarBefore ); addNewText->setIcon( QIcon (":/icons/book.png") ); navToolbarBefore->addWidget( addNewText ); connect(addNewText, SIGNAL(clicked()), this, SLOT(setText()));
C++ (Qt)void Dialog::setText(){ bool ok; QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"), tr("User name:"), QLineEdit::Normal, "", &ok);}
C++ (Qt)class MainWindow: public QMainWindow, public DataCommitter{ Q_OBJECT...private:... QToolButton * addNewText;...private slots: void setText();...};
C++ (Qt)void MainWindow::setText(){ bool ok; QString text = QInputDialog::getText(this, tr("QInputDialog::getText()"), tr("User name:"), QLineEdit::Normal, "", &ok);}
C++ (Qt)void MainWindow::nameNewText(){ bool ok; QString text = QInputDialog::getText(this, tr("New Text"), tr("Text Name:"), QLineEdit::Normal, "", &ok); QString savePath; savePath = QDir::currentPath(); QString rootP(savePath); savePath += "/content"; QDir dir( savePath ); dir.mkdir(text); savePath += "/" + text; QDir dir1( savePath ); QString contPath; contPath = text + ".txt.files"; dir1.mkdir(contPath); QFile file; QString saveFile; saveFile = ":/MyText.txt"; QString contFile; contFile = savePath + "/" + text + ".txt"; file.copy(saveFile, contFile); file.open(QIODevice::ReadWrite);}
C++ (Qt)/* QFile file; QString saveFile; saveFile = ":/MyText.txt"; QString contFile; contFile = savePath + "/" + text + ".txt"; file.copy(saveFile, contFile); file.open(QIODevice::ReadWrite);*/ QString destFileName(savePath + "/" + text + ".txt");QFile::copy(":/MyText.txt", destFileName); QFile destFile(destFileName);if (destFile,open(QIODevice::ReadWrite)) {...
C++ (Qt)QFile destFile(destFileName);destFile.setPermissions(destFile.permissions() | QFile::ReadOther | QFile::WriteOther);