本文整理汇总了C++中setCurrentFile函数的典型用法代码示例。如果您正苦于以下问题:C++ setCurrentFile函数的具体用法?C++ setCurrentFile怎么用?C++ setCurrentFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setCurrentFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setCurrentFile
void MainWindow::newFile()
{
//if (okToContinue()) {
renderArea->clearAll(); // wyczyść pixmapę
historyList->clear();
cmdLineEdit->clear();
setCurrentFile("");
//}
}
示例2: HdrViewer
void MainGui::addHdrViewer(pfs::Frame* hdr_pfs_frame, QString fname) {
HdrViewer *newhdr=new HdrViewer(this, qtpfsgui_options->negcolor, qtpfsgui_options->naninfcolor, false);
newhdr->updateHDR(hdr_pfs_frame);
newhdr->filename=fname;
newhdr->setWindowTitle(fname);
mdiArea->addSubWindow(newhdr);
newhdr->show();
setCurrentFile(fname);
}
示例3: setCurrentFile
bool MainWindow::loadFile(const QString &fileName)
{
if(spreadsheet->readFile(fileName))
{
setCurrentFile(fileName);
return true;
}
return false;
}
示例4: statusBar
bool MainWindow::saveFile(const QString &fileName)
{
if(!spreadsheet->writeFile(fileName)) {
statusBar()->showMessage(tr("Saving canceled"), 2000);
return false;
}
setCurrentFile(fileName);
statusBar()->showMessage(tr("File saved"), 2000);
return true;
}
示例5: repaint
void FilenameComponent::filesDropped (const StringArray& filenames, int, int)
{
isFileDragOver = false;
repaint();
const File f (filenames[0]);
if (f.exists() && (f.isDirectory() == isDir))
setCurrentFile (f, true);
}
示例6: setCurrentFile
void MainWindow::openDir(const QDir & dir)
{
if(db->open(dir)) {
setCurrentFile(dir.path());
pisoar->setCurrentDir(db->dirBase());
tabs->show();
}
else
tabs->hide();
}
示例7: writer
bool MyChild::saveFile(QString fileName)
{
if (!(fileName.endsWith(".htm", Qt::CaseInsensitive) || fileName.endsWith(".html", Qt::CaseInsensitive))) {
fileName += ".html"; // 默认保存为 HTML 文档
}
QTextDocumentWriter writer(fileName);
bool success = writer.write(this->document());
if (success)
setCurrentFile(fileName);
return success;
}
示例8: statusBar
bool MainWindow::loadFile(const QString &fileName)
{
if (!spreadsheet->readFile(fileName)) {
statusBar()->showMessage(tr("Loading canceled"), 2000);
return false;
}
setCurrentFile(fileName);
statusBar()->showMessage(tr("File loaded"), 2000);
return true;
}
示例9: loadProject
void MainWindow::
loadProject(
QString filename)
{
setCurrentFile(filename);
QApplication::setOverrideCursor(Qt::WaitCursor);
QFile file(filename);
if(!file.open(QFile::ReadOnly | QFile::Text))
{
QMessageBox::warning(NULL, "Load project", "Cannot open project file.");
QApplication::restoreOverrideCursor();
return;
}
config.setProjectDirFromFile(filename);
QDomDocument doc;
QString errorStr;
int errorLine, errorColumn;
if(!doc.setContent(&file, false, &errorStr, &errorLine, &errorColumn))
{
QMessageBox::warning(NULL, "Load project",
QString("Parse error at line %1 column %2 :").arg(errorLine).
arg(errorColumn) + errorStr);
QApplication::restoreOverrideCursor();
return;
}
QDomElement root = doc.documentElement();
if(root.tagName() == WarperController::xmlTag2D)
{
controler = new WarperController(this, &projectSettings);
controler->set3D(false);
bool success=controler->parseProject(root);
projectSettings.m_fileName = filename;
actionSaveProject->setEnabled(true);
checkAndSwitch(success, ProjectProperties::warpingProject);
}
else if(root.tagName() == WarperController::xmlTag3D)
{
controler = new WarperController(this, &projectSettings);
controler->set3D(true);
bool success=controler->parseProject(root);
projectSettings.m_fileName = filename;
actionSaveProject->setEnabled(true);
checkAndSwitch(success, ProjectProperties::warpingProject);
}
else
{
QMessageBox::warning(NULL, "Load project",
QString("Not a warping project"));
}
QApplication::restoreOverrideCursor();
file.close();
return;
}
示例10: readFile
bool Editor::openFile(const QString &fileName)
{
bool ok = readFile(fileName);
if (ok) {
setCurrentFile(fileName);
emit message(tr("File loaded"), 2000);
} else {
emit message(tr("Loading canceled"), 2000);
}
return ok;
}
示例11: tr
void WMain::saveFileAction(bool saveas) {
if(cDocument->filename=="" || saveas) {
cDocument->filename=QFileDialog::getSaveFileName(wMain,
tr("Choose file"), "./");
}
if(!cDocument->filename.endsWith(".dic") && !cDocument->filename.endsWith(".txt")) {
cDocument->filename.append(".dic");
}
cDocument->saveToFile();
setCurrentFile(cDocument->filename);
}
示例12: setCurrentFile
bool ImageDisplay::openFile(const QString &fileName)
{
if (readFile(fileName))
{
setCurrentFile(fileName);
return true;
}
else
{
return false;
}
}
示例13: TextEditWidget
void PEditor::newFile() {
tabWidget->addTab(new TextEditWidget(tabWidget), "");
switchToTab(tabWidget->count() - 1);
textEdit->getFont()->setPointSize(textSize);
textEdit->getFont()->setFamily(textFont);
textEdit->updateFont();
textEdit->setLineNumbering(lineNumbering);
connect(tabWidget->currentWidget(), SIGNAL(highlighting(bool)), this, SLOT(setSyntaxHighlightingMenuItem(bool)));
setCurrentFile("");
}
示例14: tr
bool MapWindow::saveFile(const QString & fileName)
{
if(! mapData.saveMapXML(fileName))
{
QMessageBox::warning(this, tr("Map Editor"), tr("Cannot write file %1.").arg(fileName));
return saveAs();
}
setCurrentFile(fileName);
return true;
}
示例15: QMainWindow
JsonEditorMain::JsonEditorMain(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::JsonEditorMain),
newInsertText(tr("Insert new data")),
treeViewColumnKey(tr("Node")),
treeViewColumnValue(tr("Value")),
treeViewColumnType(tr("Type"))
{
ui->setupUi(this);
connect(ui->menuCodeTools, SIGNAL(toggled(bool)), this, SLOT(toggleCodeToolbar(bool)));
connect(ui->menuFindTools, SIGNAL(toggled(bool)), this, SLOT(toggleFindToolbar(bool)));
connect(ui->menuFileTools, SIGNAL(toggled(bool)), this, SLOT(toggleFileToolbar(bool)));
connect(ui->menuEditTools, SIGNAL(toggled(bool)), this, SLOT(toggleEditToolbar(bool)));
connect(ui->menuRefresh, SIGNAL(triggered()), this, SLOT(refreshJsonTree()));
connect(ui->menuInsertNode, SIGNAL(triggered()), this, SLOT(insertTreeNode()));
connect(ui->menuInsertChild, SIGNAL(triggered()), this, SLOT(insertTreeChild()));
connect(ui->menuDeleteNode, SIGNAL(triggered()), this, SLOT(deleteTreeNode()));
connect(ui->jsonTree, SIGNAL(clicked(QModelIndex)), this, SLOT(updateActions()));
connect(ui->menuFormat, SIGNAL(triggered()), this, SLOT(formatCode()));
connect(ui->menuHelp, SIGNAL(triggered()), this, SLOT(showHelp()));
connect(ui->jsonTree, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(dataEdit(QModelIndex)));
// connect(ui->menuNewFile, SIGNAL(triggered()), this, SLOT(newFile()));
connect(ui->menuOpenFile, SIGNAL(triggered()), this, SLOT(open()));
connect(ui->menuSaveFile, SIGNAL(triggered()), this, SLOT(save()));
connect(ui->menuSaveAs, SIGNAL(triggered()), this, SLOT(saveAs()));
JSHighlighter * highlight = new JSHighlighter(ui->jsonCode->document());
setCurrentFile("");
textEdit = ui->jsonCode;
connect(textEdit->document(), SIGNAL(contentsChanged()),
this, SLOT(documentWasModified()));
setUnifiedTitleAndToolBarOnMac(true);
m_findDialog = new FindDialog(this);
m_findDialog->setModal(false);
m_findDialog->setTextEdit(textEdit);
m_findReplaceDialog = new FindReplaceDialog(this);
m_findReplaceDialog->setModal(false);
m_findReplaceDialog->setTextEdit(textEdit);
connect(ui->menuFind, SIGNAL(triggered()), m_findDialog, SLOT(show()));
connect(ui->menuReplace, SIGNAL(triggered()), m_findReplaceDialog, SLOT(show()));
// connect(ui->actionFindNext, SIGNAL(triggered()), m_findDialog, SLOT(findNext()));
// connect(ui->actionFindPrevious, SIGNAL(triggered()), m_findDialog, SLOT(findPrev()));
readSettings();
}