本文整理汇总了C++中setWindowModified函数的典型用法代码示例。如果您正苦于以下问题:C++ setWindowModified函数的具体用法?C++ setWindowModified怎么用?C++ setWindowModified使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setWindowModified函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setWindowModified
void MainWindow::setCurrentFile(const QString &fileName)
{
curFile = fileName;
setWindowModified(false);
QString shownName = "Untitled";
if (!curFile.isEmpty()) {
shownName = strippedName(curFile);
recentFiles.removeAll(curFile);
recentFiles.prepend(curFile);
updateRecentFileActions();
}
setWindowTitle(tr("%1[*] - %2").arg(shownName)
.arg(tr("Spreadsheet")));
}
示例2: tr
void MainWindow::saveFormAs()
{
QString fileName = QFileDialog::getSaveFileName(this, tr("Save As"),
recentFolder,
tr("Jupiter Forms (*.jform);;All Files (*.*)"));
if (fileName != "")
{
if (!fileName.toLower().endsWith(".jform"))
fileName += ".jform";
setWindowFilePath(fileName);
form->saveFile(fileName);
setWindowModified(false);
recentFolder = QFileInfo(fileName).path();
updateRecentFile(fileName);
}
}
示例3: setWindowModified
void QWERTYEditor::setCurrentFile(const QString &fileName) {
/*
Функция установки текущего файла.
Вызывается для сброса состояний переменных при загрузки\сохранения\изменении
и тд файл. Обновляется имя файла. Если имя пустое, то показываем имя new.txt
*/
curFile = fileName;
textEdit->document()->setModified(false);
setWindowModified(false);
QString shownName = curFile;
if (curFile.isEmpty())
shownName = "new.txt";
setWindowFilePath(shownName);
}
示例4: QFileInfo
void MdiChild::setCurrentFile(const QString &fileName)
{
curFile = QFileInfo(fileName).canonicalFilePath();
isUntitled = false;
fileChanged = false;
setWindowModified(false);
updateTitle();
int MaxRecentFiles = g.historySize();
QStringList files = g.recentFiles();
files.removeAll(fileName);
files.prepend(fileName);
while (files.size() > MaxRecentFiles)
files.removeLast();
g.recentFiles( files );
}
示例5: setWindowModified
void VentanaPrincipal::setArchivoActual(const QString &nombreArchivo)
{
archivoActual = nombreArchivo;
editorTexto->document()->setModified(false);
setWindowModified(false);
QString nombreaAMostrar = archivoActual;
if (archivoActual.isEmpty())
{
nombreaAMostrar = "Archivo sin nombre.txt";
}
setWindowFilePath(nombreaAMostrar);
}
示例6: tr
void WordFrequencyForm::exportFrequencyList()
{
if (!wordFrequencyList_)
{
QMessageBox::information(this, tr("Unable to export frequency list"),
tr("Unable to export frequency list. There is no list to export."));
return;
}
QString wflistFilePath = QFileDialog::getSaveFileName(this, tr("Save word frequency list file..."),
workingDirectoryPath_, tr("XML files (*.xml)"));
if (!wflistFilePath.isEmpty())
{
wordFrequencyList_->write_xml(wflistFilePath.toStdString());
setWindowModified(false);
}
}
示例7: QFile
void MainWindow::loadFile(const QString &fileName)
{
//if is empty
if(fileName.isEmpty())
{
//set the file name
this->setFileName(QString ());
ui->AppOutput->append("No file is open");
return;
}
// create a QFile Object with the fileName variable
QFile *qfo=new QFile(fileName);
//if
if(!(qfo->open(QIODevice::Text|QIODevice::ReadOnly)))
{
ui->AppOutput->append("The file "+fileName+" cannot be opened");
QMessageBox::warning(this,"Error","The file cannot be opened",QMessageBox::Ok,QMessageBox::Ok);
setFileName(QString());
return;
}
else
{
ui->AppOutput->append("The file at "+fileName+" is opened");
QTextStream qts(qfo);
//codigo de parseo.
int count_lines=0;
while(!qts.atEnd())
{
//se lee la linea
QString line=qts.readLine();
//se muestra en la pantalla
ui->textEdit->appendPlainText(line);
//se envia a parsearla
lineParser(line);
//se cuenta la cantidad de lineas
count_lines++;
}
ui->AppOutput->append("Lines: "+QString::number(count_lines));
qfo->close();
setFileName(fileName);
setWindowModified(false);
}
}
示例8: setWindowModified
//*****************************************************************************
void mlMainWindow::setCurrentFile(const QString &fileName) {
curFile = fileName;
ui->tbxEditor->document()->setModified(false);
setWindowModified(false);
QString shownName = curFile;
if( curFile.isEmpty() )
shownName = "untitled.txt";
else
shownName = strippedName();
setWindowFilePath(shownName);
setWindowTitle( tr("%1 - %2[*]")
.arg(sAPPNAME)
.arg(shownName) );
}
示例9: saveImgFile
/*--------------------------------------- Private functions -----------------------------------------*/
bool PicEditWindow::saveFile(const QString &fileName){
// !!! if here the cursor state change hasn't been used, the program will announce abnormal ending
// once close the program ??? why
// set cursor as wait state
QApplication::setOverrideCursor(Qt::WaitCursor);
// emit save file signal
emit saveImgFile(fileName);
settitle(fileName);
// restore cursor state
QApplication::restoreOverrideCursor();
// restore window modify state
setWindowModified(false);
return true;
}
示例10: tr
void ArchiverWindow::slotFileOpen()
{
QString fileName =
QFileDialog::getOpenFileName(this, tr("Open Archive"),
QString(), tr("Tar Archives (*.tar *.tar.gz *.tar.xz *.tar.bz2 *.tgz *.tbz2"));
if (!fileName.isEmpty()) {
setBusy(true);
if (m_model->openArchive(fileName)) {
setWindowModified(false);
setWindowFilePath(fileName);
setBusy(false);
ui->actionFileSaveAs->setEnabled(false);
}
}
}
示例11: setWindowModified
void MeshSubWindow::setCurrentFile(const QString &fileName)
{
curFile = fileName;
setWindowModified(false);
QString shownName = tr("Untitled");
if (!curFile.isEmpty())
{
shownName = strippedName(curFile);
recentFiles.removeAll(curFile);
recentFiles.prepend(curFile);
//emit current_file_changed();
}
setWindowTitle(tr("%1[*] - %2").arg(shownName)
.arg(tr("Simplex Spline")));
updateStatusBar();
}
示例12: tr
bool MainWindow::resize()
{
bool ok;
int width = QInputDialog::getInt(this, tr("Painter"),
tr("Please enter the width"
"(less than 1024)"),
painter->curSize().width(), 0,
1024, 1, &ok);
if(!ok) return ok;
int height = QInputDialog::getInt(this, tr("Painter"),
tr("Please enter the height"
"(less than 1024)"),
painter->curSize().height(), 0,
1024, 1, &ok);
if(!ok) return ok;
setWindowModified(painter->setSize(QSize(width, height)));
return ok;
}
示例13: fileSaveAs
bool HtmlEditor::fileSave()
{
if (fileName.isEmpty() || fileName.startsWith(QLatin1String(":/")))
return fileSaveAs();
QFile file(fileName);
bool success = file.open(QIODevice::WriteOnly);
if (success) {
// FIXME: here we always use UTF-8 encoding
QString content = ui->webView->page()->mainFrame()->toHtml();
QByteArray data = content.toUtf8();
qint64 c = file.write(data);
success = (c >= data.length());
}
setWindowModified(false);
return success;
}
示例14: QFileInfo
void HtmlEditor::setCurrentFileName(const QString &fileName)
{
this->fileName = fileName;
QString shownName;
if (fileName.isEmpty())
shownName = "untitled";
else
shownName = QFileInfo(fileName).fileName();
setWindowTitle(tr("%1[*] - %2").arg(shownName).arg(tr("HTML Editor")));
setWindowModified(false);
bool allowSave = true;
if (fileName.isEmpty() || fileName.startsWith(QLatin1String(":/")))
allowSave = false;
ui->actionFileSave->setEnabled(allowSave);
}
示例15: QFileInfo
//////////////////////////////////////////////////////////////////
//单文档实现。
void CMainWindow::setCurrentFile(const QString& fileName)
{
curFile = QFileInfo(fileName).canonicalFilePath();
isUntitled = false;
setWindowTitle(curFile + "[*]");
textEdit->document()->setModified(false);
setWindowModified(false);
QSettings settings("709", "SDI example");
QStringList files = settings.value("recentFiles").toStringList();
files.removeAll(fileName);
files.prepend(fileName);
while (files.size() > MaxRecentFiles)
files.removeLast();
settings.setValue("recentFiles", files);
updateRecentFiles();
}