C++ (Qt)void MainWindow::nameNewText(){ MainDialog *dialog = new MainDialog; connect(findButton, SIGNAL(clicked()), dialog, SLOT(on_rescanText_triggered())); dialog->show();}
C++ (Qt)void MainWindow::nameNewText(){ MainDialog *dialog = new MainDialog; connect(dialog->addButton, SIGNAL(clicked()), this, SLOT(on_rescanText_triggered())); dialog->show();}
ну так высылай сигнал при нажатии на add, а к этому сигналу приконнектишься в MainWindow::nameNewText():void MainWindow::nameNewText(){ MainDialog *dialog = new MainDialog; connect(dialog->addButton, SIGNAL(clicked()), this, SLOT(on_rescanText_triggered())); dialog->show();}
C++ (Qt)void MainDialog::mainClicked(){... ... QString destFileName1(savePath + "/" + text + ".mfl"); QFile::copy(":/MyTexionaries.mfl", destFileName1); QFile destFile1(destFileName1); destFile1.setPermissions(destFile1.permissions() | QFile::ReadOther | QFile::WriteOther); QString destFileName2(savePath + "/" + text + "_abrv.mfl"); QFile::copy(":/MyTexionaries_abrv.mfl", destFileName2); QFile destFile2(destFileName2); destFile2.setPermissions(destFile2.permissions() | QFile::ReadOther | QFile::WriteOther); QString destFileName3(savePath + "/" + text + ".atx"); QFile::copy(":/MyTexionaries.atx", destFileName3); QFile destFile3(destFileName3); destFile3.setPermissions(destFile3.permissions() | QFile::ReadOther | QFile::WriteOther); }... ... if (caseCheckBox->isChecked()) { QString command3( cfg.editTxtCommandLine ); command3.replace( "%EDIT%", "" + destFileName3 + "" ); if( !QProcess::startDetached( command3 ) ) QApplication::beep(); QString command2( cfg.editTxtCommandLine ); command2.replace( "%EDIT%", "" + destFileName2 + "" ); if( !QProcess::startDetached( command2 ) ) QApplication::beep(); QString command1( cfg.editTxtCommandLine ); command1.replace( "%EDIT%", "" + destFileName1 + "" ); if( !QProcess::startDetached( command1 ) ) QApplication::beep(); } }
C++ (Qt)#include <QtGui>#include <QtTest/QtTest>#include "mfldialog.hh"... ... if (caseCheckBox->isChecked()) { QString command3( cfg.editTxtCommandLine ); command3.replace( "%EDIT%", "" + destFileName3 + "" ); if( !QProcess::startDetached( command3 ) ) QApplication::beep(); QTest::Sleep (200); QString command2( cfg.editTxtCommandLine ); command2.replace( "%EDIT%", "" + destFileName2 + "" ); if( !QProcess::startDetached( command2 ) ) QApplication::beep(); QString command1( cfg.editTxtCommandLine ); command1.replace( "%EDIT%", "" + destFileName1 + "" ); if( !QProcess::startDetached( command1 ) ) QApplication::beep(); } }
C++ (Qt) if (caseCheckBox->isChecked()) { QString command3( cfg.editTxtCommandLine ); command3.replace( "%EDIT%", "" + destFileName3 + "" ); if( !QProcess::startDetached( command3 ) ) QApplication::beep(); QEventLoop loop3; QTimer::singleShot(100, &loop3, SLOT(quit())); loop3.exec(); QString command2( cfg.editTxtCommandLine ); command2.replace( "%EDIT%", "" + destFileName2 + "" ); if( !QProcess::startDetached( command2 ) ) QApplication::beep(); QEventLoop loop2; QTimer::singleShot(100, &loop2, SLOT(quit())); loop2.exec(); QString command1( cfg.editTxtCommandLine ); command1.replace( "%EDIT%", "" + destFileName1 + "" ); if( !QProcess::startDetached( command1 ) ) QApplication::beep();
C++ (Qt) dirComboBox3 = new QComboBox(); QDir dir( cfg.projectTexionaryFolder ); QFileInfoList list = dir.entryInfoList(QDir::NoFilter, QDir::NoSort); for (int i = 2; i < list.size(); ++i) { QFileInfo fInfo = list.at(i); QString fPath = fInfo.filePath(); fPath.remove(QRegExp("/*.*_")); dirComboBox3 ->addItem(fPath); }
C++ (Qt)void MainDialog::mainClicked(){... ... dictComboBox3->clear(); QFileInfoList list = dir.entryInfoList(QDir::NoFilter, QDir::NoSort); for (int i = 2; i < list.size(); ++i) { QFileInfo fInfo = list.at(i); QString fPath = fInfo.filePath(); fPath.remove(QRegExp("/*.*_")); if ( !fPath.contains(".") ) { dictComboBox3->addItem(fPath); } } }
C++ (Qt)... dictComboBox3->clear(); QFileInfoList list = dir.entryInfoList(QDir::Dirs, QDir::NoSort); for (int i = 2; i < list.size(); ++i) { QFileInfo fInfo = list.at(i); QString fPath = fInfo.filePath(); fPath.remove(QRegExp("/*.*_")); dirComboBox3->addItem(fPath); } }