当前位置: 首页>>代码示例>>C++>>正文


C++ Pane::getBuffer方法代码示例

本文整理汇总了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();
}
开发者ID:CmdrMoozy,项目名称:qompose,代码行数:7,代码来源:BufferWidget.cpp

示例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);
	}
}
开发者ID:CmdrMoozy,项目名称:qompose,代码行数:18,代码来源:BufferWidget.cpp

示例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());
}
开发者ID:CmdrMoozy,项目名称:qompose,代码行数:9,代码来源:BufferWidget.cpp

示例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;
}
开发者ID:CmdrMoozy,项目名称:qompose,代码行数:20,代码来源:BufferWidget.cpp

示例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");
	}
}
开发者ID:CmdrMoozy,项目名称:qompose,代码行数:21,代码来源:BufferWidget.cpp

示例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();
}
开发者ID:CmdrMoozy,项目名称:qompose,代码行数:36,代码来源:BufferWidget.cpp

示例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;
		}
	}
}
开发者ID:CmdrMoozy,项目名称:qompose,代码行数:19,代码来源:BufferWidget.cpp


注:本文中的Pane::getBuffer方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。