本文整理汇总了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);
}