本文整理汇总了C++中Pane::getBuffer方法的典型用法代码示例。如果您正苦于以下问题:C++ Pane::getBuffer方法的具体用法?C++ Pane::getBuffer怎么用?C++ Pane::getBuffer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pane
的用法示例。
在下文中一共展示了Pane::getBuffer方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
editor::Buffer *BufferWidget::currentBuffer() const
{
Pane *pane = dynamic_cast<Pane *>(tabWidget->currentWidget());
if(pane == nullptr)
return nullptr;
return pane->getBuffer();
}
示例2: doTabClosing
void BufferWidget::doTabClosing(int i)
{
Pane *p = dynamic_cast<Pane *>(tabWidget->widget(i));
if(p == nullptr)
return;
if(p->getBuffer()->hasBeenSaved())
{
ClosedBufferDescriptor desc = {
p->getBuffer()->getFileDescriptor(),
p->getBuffer()->textCursor().position()};
closedTabs.push(desc);
while(closedTabs.count() > 20)
closedTabs.remove(0);
}
}
示例3: moveBuffer
void BufferWidget::moveBuffer(int f, int t)
{
Pane *p = dynamic_cast<Pane *>(tabWidget->widget(f));
if(p == nullptr)
return;
tabWidget->removeTab(f);
tabWidget->insertTab(t, p, p->getBuffer()->getTitle());
}
示例4: Pane
Pane *BufferWidget::newPane()
{
Pane *p = new Pane(this);
QObject::connect(p->getBuffer(), &editor::Buffer::titleChanged, this,
&BufferWidget::doTabTitleChanged);
QObject::connect(p->getBuffer(), &editor::Buffer::pathChanged, this,
&BufferWidget::doTabPathChanged);
QObject::connect(p->getBuffer(), &editor::Buffer::encodingChanged, this,
&BufferWidget::doBufferEncodingChanged);
QObject::connect(p->getBuffer(), &editor::Buffer::searchWrapped, this,
&BufferWidget::searchWrapped);
int i = tabWidget->addTab(p, p->getBuffer()->getTitle());
tabWidget->setCurrentIndex(i);
tabs.insert(p);
return p;
}
示例5: doTabChanged
void BufferWidget::doTabChanged(int i)
{
Q_EMIT bufferChanged();
Pane *p = dynamic_cast<Pane *>(tabWidget->widget(i));
if(p != nullptr)
{
QTextCursor curs = p->getBuffer()->textCursor();
p->getBuffer()->setFocus(Qt::OtherFocusReason);
Q_EMIT pathChanged(p->getBuffer()->getPath());
Q_EMIT encodingChanged(p->getBuffer()->getEncoding());
}
else
{
Q_EMIT pathChanged("");
Q_EMIT encodingChanged("UTF-8");
}
}
示例6: pathOpened
editor::Buffer *BufferWidget::doOpenDescriptor(const FileDescriptor &d)
{
// If we only have one "Untitled" buffer, we'll replace it.
if(tabs.count() == 1)
{
QSet<Pane *>::iterator i = tabs.begin();
Pane *p = *i;
int idx = tabWidget->indexOf(p);
if((!p->getBuffer()->hasBeenSaved()) &&
(!p->getBuffer()->isModified()))
{
tabWidget->removeTab(idx);
delete p;
tabs.clear();
}
}
// Open each of the files.
int existing = findBufferWithPath(d.fileName);
if(existing != -1)
{
tabWidget->setCurrentIndex(existing);
return nullptr;
}
Pane *p = newPane();
p->getBuffer()->open(d);
Q_EMIT pathOpened(d.fileName);
return p->getBuffer();
}
示例7: doTabTitleChanged
void BufferWidget::doTabTitleChanged(const QString &t)
{
editor::Buffer *b = dynamic_cast<editor::Buffer *>(sender());
if(b == nullptr)
return;
for(int i = 0; i < count(); ++i)
{
Pane *p = dynamic_cast<Pane *>(tabWidget->widget(i));
if(p == nullptr)
continue;
if(p->getBuffer() == b)
{
tabWidget->setTabText(i, t);
break;
}
}
}