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


C++ TabBar::tabAt方法代码示例

本文整理汇总了C++中TabBar::tabAt方法的典型用法代码示例。如果您正苦于以下问题:C++ TabBar::tabAt方法的具体用法?C++ TabBar::tabAt怎么用?C++ TabBar::tabAt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TabBar的用法示例。


在下文中一共展示了TabBar::tabAt方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: updatePlaybackModeButton

/** Default constructor. */
TabPlaylist::TabPlaylist(QWidget *parent) :
	QTabWidget(parent), _closePlaylistPopup(new ClosePlaylistPopup(this)), _mainWindow(NULL)
{
	TabBar *tabBar = new TabBar(this);
	this->setTabBar(tabBar);
	this->setMovable(true);
	messageBox = new TracksNotFoundMessageBox(this);

	//SettingsPrivate *settings = SettingsPrivate::instance();

	// Add a new playlist
	connect(this, &QTabWidget::currentChanged, this, [=]() {
		emit updatePlaybackModeButton();
	});

	// Removing a playlist
	connect(_closePlaylistPopup->buttonBox, &QDialogButtonBox::clicked, this, &TabPlaylist::execActionFromClosePopup);
	connect(this, &QTabWidget::tabCloseRequested, this, &TabPlaylist::closePlaylist);

	/// FIXME: when changing font for saved and untouched playlists, overwritting to normal instead of disabled
	/// Reducing size is ok, inreasing size is ko
	/*connect(settings, &SettingsPrivate::fontHasChanged, this, [=](const SettingsPrivate::FontFamily ff, const QFont &) {
		if (ff == SettingsPrivate::FF_Playlist) {
			for (int i = 0; i < count() - 1; i++) {
				if (playlist(i)->mediaPlaylist()->isEmpty()) {
					this->setTabIcon(i, this->defaultIcon(QIcon::Disabled));
				} else {
					this->setTabIcon(i, this->defaultIcon(QIcon::Normal));
				}
			}
		}
	});*/

	// Context menu to add few actions for each playlist
	_contextMenu = new QMenu(this);
	QAction *renamePlaylist = new QAction(tr("Rename playlist"), _contextMenu);
	QAction *loadBackground = new QAction(tr("Load background..."), _contextMenu);
	QAction *clearBackground = new QAction(tr("Clear background"), _contextMenu);
	loadBackground->setEnabled(false);
	clearBackground->setEnabled(false);

	_contextMenu->addAction(renamePlaylist);
	_contextMenu->addSeparator();
	_contextMenu->addAction(loadBackground);
	_contextMenu->addAction(clearBackground);

	connect(renamePlaylist, &QAction::triggered, this, [=]() {
		QPoint p = _contextMenu->property("mouseRightClickPos").toPoint();
		int index = tabBar->tabAt(p);
		this->setCurrentIndex(index);
		tabBar->editTab(index);
	});
	connect(loadBackground, &QAction::triggered, this, [=]() {
		qDebug() << Q_FUNC_INFO << "Load background not implemented yet";
	});
	this->setAcceptDrops(true);

	CornerWidget *corner = new CornerWidget(this);
	this->setCornerWidget(corner, Qt::TopRightCorner);
	connect(corner, &CornerWidget::innerButtonClicked, this, &TabPlaylist::addPlaylist);
	corner->installEventFilter(this);
}
开发者ID:ravloony,项目名称:Miam-Player,代码行数:63,代码来源:tabplaylist.cpp


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