本文整理汇总了C++中TextEdit::GetCurrentFile方法的典型用法代码示例。如果您正苦于以下问题:C++ TextEdit::GetCurrentFile方法的具体用法?C++ TextEdit::GetCurrentFile怎么用?C++ TextEdit::GetCurrentFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextEdit
的用法示例。
在下文中一共展示了TextEdit::GetCurrentFile方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: NewFileSlot
void MainWindow::NewFileSlot()
{
TextEdit* child = CreateTextEdit();
child->NewFile();
//child->show();
tabWidget->addTab(child, child->GetCurrentFileName());
int index = tabWidget->count();
//tabWidget->addTab(child, child->GetCurrentFileName());
tabWidget->setTabToolTip(index, child->GetCurrentFile());
}
示例2: UpdateWindowMenuSlot
void MainWindow::UpdateWindowMenuSlot()
{
menuWindow->clear();
menuWindow->addAction(actionClose);
menuWindow->addAction(actionClose_All_Windows);
menuWindow->addSeparator();
menuWindow->addAction(actionTile);
menuWindow->addAction(actionStack);
menuWindow->addSeparator();
menuWindow->addAction(actionNext_Window);
menuWindow->addAction(actionPrevious_Window);
menuWindow->addAction(m_acSeparator);
int num = tabWidget->count();
if( num > 0)
{
m_acSeparator->setVisible(true);
for(int i=0; i < tabWidget->count(); ++i)
{
TextEdit* child = qobject_cast<TextEdit*> (tabWidget->widget(i));
QString text;
if(i < 9){
text = tr("&%1 %2").arg(i+1).arg(child->GetCurrentFile());
} else {
text = tr("%1 %2").arg(i+1).arg(child->GetCurrentFile());
}
QAction* action = menuWindow->addAction(text);
action->setCheckable(true);
action->setChecked(child == GetCurrentTextEdit());
connect(action, SIGNAL(triggred()), m_windowMapper, SLOT(map()));
m_windowMapper->setMapping(action, tabWidget->widget(i));
}
}
}
示例3: FindTextEdit
TextEdit* MainWindow::FindTextEdit(const QString& fileName)
{
QString canonicalFilePath = QFileInfo(fileName).canonicalFilePath();
int nums = tabWidget->count();
if (nums > 0)
{
for (int i = 0; i < nums; ++i )
{
TextEdit* textEdit = static_cast<TextEdit*>( tabWidget->widget(i) );
if (textEdit->GetCurrentFile() == canonicalFilePath)
{
return textEdit;
}
}
}
return NULL;
}
示例4: OpenTextEdit
void MainWindow::OpenTextEdit( const QString fileName )
{
TextEdit *existedTextEdit = FindTextEdit(fileName);
if (existedTextEdit)
{
tabWidget->setCurrentWidget(existedTextEdit);
return;
}
TextEdit* child = CreateTextEdit();
if ( child->LoadFile(fileName) )
{
int index = tabWidget->count();
tabWidget->addTab(child, child->GetCurrentFileName());
tabWidget->setTabToolTip(index, child->GetCurrentFile());
//child->show();
}
else
{
child->close();
}
}