int QTabBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { if (_id < 8) qt_static_metacall(this, _c, _id, _a); _id -= 8; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< Shape*>(_v) = shape(); break; case 1: *reinterpret_cast< int*>(_v) = currentIndex(); break; case 2: *reinterpret_cast< int*>(_v) = count(); break; case 3: *reinterpret_cast< bool*>(_v) = drawBase(); break; case 4: *reinterpret_cast< QSize*>(_v) = iconSize(); break; case 5: *reinterpret_cast< Qt::TextElideMode*>(_v) = elideMode(); break; case 6: *reinterpret_cast< bool*>(_v) = usesScrollButtons(); break; case 7: *reinterpret_cast< bool*>(_v) = tabsClosable(); break; case 8: *reinterpret_cast< SelectionBehavior*>(_v) = selectionBehaviorOnRemove(); break; case 9: *reinterpret_cast< bool*>(_v) = expanding(); break; case 10: *reinterpret_cast< bool*>(_v) = isMovable(); break; case 11: *reinterpret_cast< bool*>(_v) = documentMode(); break; } _id -= 12; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setShape(*reinterpret_cast< Shape*>(_v)); break; case 1: setCurrentIndex(*reinterpret_cast< int*>(_v)); break; case 3: setDrawBase(*reinterpret_cast< bool*>(_v)); break; case 4: setIconSize(*reinterpret_cast< QSize*>(_v)); break; case 5: setElideMode(*reinterpret_cast< Qt::TextElideMode*>(_v)); break; case 6: setUsesScrollButtons(*reinterpret_cast< bool*>(_v)); break; case 7: setTabsClosable(*reinterpret_cast< bool*>(_v)); break; case 8: setSelectionBehaviorOnRemove(*reinterpret_cast< SelectionBehavior*>(_v)); break; case 9: setExpanding(*reinterpret_cast< bool*>(_v)); break; case 10: setMovable(*reinterpret_cast< bool*>(_v)); break; case 11: setDocumentMode(*reinterpret_cast< bool*>(_v)); break; } _id -= 12; } else if (_c == QMetaObject::ResetProperty) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 12; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 12; } #endif // QT_NO_PROPERTIES return _id; }
PlaylistTabBar::PlaylistTabBar(QWidget* parent) : QTabBar(parent), manager_(nullptr), menu_(new QMenu(this)), menu_index_(-1), suppress_current_changed_(false), initialized_(false), rename_editor_(new RenameTabLineEdit(this)) { setAcceptDrops(true); setElideMode(Qt::ElideRight); setUsesScrollButtons(true); setTabsClosable(true); close_ = menu_->addAction(IconLoader::Load("list-remove", IconLoader::Base), tr("Close playlist"), this, SLOT(Close())); rename_ = menu_->addAction(IconLoader::Load("edit-rename", IconLoader::Base), tr("Rename playlist..."), this, SLOT(Rename())); save_ = menu_->addAction(IconLoader::Load("document-save", IconLoader::Base), tr("Save playlist..."), this, SLOT(Save())); menu_->addSeparator(); rename_editor_->setVisible(false); connect(rename_editor_, SIGNAL(editingFinished()), SLOT(RenameInline())); connect(rename_editor_, SIGNAL(EditingCanceled()), SLOT(HideEditor())); connect(this, SIGNAL(currentChanged(int)), SLOT(CurrentIndexChanged(int))); connect(this, SIGNAL(tabMoved(int, int)), SLOT(TabMoved())); // We can't just emit Close signal, we need to extract the playlist id first connect(this, SIGNAL(tabCloseRequested(int)), SLOT(CloseFromTabIndex(int))); }
TabBar::TabBar(QWidget *parent) : QTabBar(parent) , m_viewTabBarAction(0) , m_showTabBarWhenOneTab(true) { setContextMenuPolicy(Qt::CustomContextMenu); setAcceptDrops(true); setElideMode(Qt::ElideRight); setUsesScrollButtons(true); connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(contextMenuRequested(const QPoint &))); QString alt = QLatin1String("Ctrl+%1"); for (int i = 0; i < 10; ++i) { int key = i == 9 ? 0 : i + 1; TabShortcut *tabShortCut = new TabShortcut(i, alt.arg(key), this); connect(tabShortCut, SIGNAL(activated()), this, SLOT(selectTabAction())); } m_viewTabBarAction = new QAction(this); updateViewToolBarAction(); connect(m_viewTabBarAction, SIGNAL(triggered()), this, SLOT(viewTabBar())); #if QT_VERSION >= 0x040500 setMovable(true); #endif }
QTabDrawer::QTabDrawer(QTabContainer* tabContainer) : QTabBar(tabContainer), tabContainer(tabContainer), pressedIndex(-1) { //setMovable(true); setTabsClosable(true); setUsesScrollButtons(true); setElideMode(Qt::ElideRight); connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); }
int QTabBar::qt_metacall(QMetaObject::Call _c, int _id, void **_a) { _id = QWidget::qt_metacall(_c, _id, _a); if (_id < 0) return _id; if (_c == QMetaObject::InvokeMetaMethod) { switch (_id) { case 0: currentChanged((*reinterpret_cast< int(*)>(_a[1]))); break; case 1: selected((*reinterpret_cast< int(*)>(_a[1]))); break; case 2: setCurrentIndex((*reinterpret_cast< int(*)>(_a[1]))); break; case 3: setCurrentTab((*reinterpret_cast< int(*)>(_a[1]))); break; case 4: d_func()->_q_scrollTabs(); break; } _id -= 5; } #ifndef QT_NO_PROPERTIES else if (_c == QMetaObject::ReadProperty) { void *_v = _a[0]; switch (_id) { case 0: *reinterpret_cast< Shape*>(_v) = shape(); break; case 1: *reinterpret_cast< int*>(_v) = currentIndex(); break; case 2: *reinterpret_cast< int*>(_v) = count(); break; case 3: *reinterpret_cast< bool*>(_v) = drawBase(); break; case 4: *reinterpret_cast< QSize*>(_v) = iconSize(); break; case 5: *reinterpret_cast< Qt::TextElideMode*>(_v) = elideMode(); break; case 6: *reinterpret_cast< bool*>(_v) = usesScrollButtons(); break; } _id -= 7; } else if (_c == QMetaObject::WriteProperty) { void *_v = _a[0]; switch (_id) { case 0: setShape(*reinterpret_cast< Shape*>(_v)); break; case 1: setCurrentIndex(*reinterpret_cast< int*>(_v)); break; case 3: setDrawBase(*reinterpret_cast< bool*>(_v)); break; case 4: setIconSize(*reinterpret_cast< QSize*>(_v)); break; case 5: setElideMode(*reinterpret_cast< Qt::TextElideMode*>(_v)); break; case 6: setUsesScrollButtons(*reinterpret_cast< bool*>(_v)); break; } _id -= 7; } else if (_c == QMetaObject::ResetProperty) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyDesignable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyScriptable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyStored) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyEditable) { _id -= 7; } else if (_c == QMetaObject::QueryPropertyUser) { _id -= 7; } #endif // QT_NO_PROPERTIES return _id; }
FooTabBar::FooTabBar (QWidget *parent) : QTabBar (parent), m_showTabBarWhenOneTab(true) { setContextMenuPolicy (Qt::CustomContextMenu); setAcceptDrops (true); setElideMode (Qt::ElideRight); setUsesScrollButtons (true); connect(this, SIGNAL (customContextMenuRequested (const QPoint &)), this, SLOT (contextMenuRequested (const QPoint &))); setMovable(true); }
TabWidget::TabWidget(QWidget *parent) : QTabWidget(parent) { setDocumentMode(true); setElideMode(Qt::ElideRight); setMovable(true); setTabsClosable(true); setTabShape(QTabWidget::Rounded); setTabPosition(QTabWidget::North); setUsesScrollButtons(true); }
TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget) : ComboTabBar() , m_window(window) , m_tabWidget(tabWidget) , m_tabPreview(new TabPreview(window, window)) , m_showTabPreviews(false) , m_hideTabBarWithOneTab(false) , m_showCloseOnInactive(0) , m_clickedTab(0) , m_normalTabWidth(0) , m_activeTabWidth(0) { setObjectName("tabbar"); setContextMenuPolicy(Qt::CustomContextMenu); setElideMode(Qt::ElideRight); setFocusPolicy(Qt::NoFocus); setTabsClosable(false); setMouseTracking(true); setDocumentMode(true); setAcceptDrops(true); setDrawBase(false); setMovable(true); connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int))); connect(this, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(contextMenuRequested(QPoint))); m_tabPreviewShowTimer = new QTimer(this); m_tabPreviewShowTimer->setInterval(300); m_tabPreviewShowTimer->setSingleShot(true); connect(m_tabPreviewShowTimer, SIGNAL(timeout()), this, SLOT(showTabPreview())); m_tabPreviewHideTimer = new QTimer(this); m_tabPreviewHideTimer->setInterval(300); m_tabPreviewHideTimer->setSingleShot(true); connect(m_tabPreviewHideTimer, SIGNAL(timeout()), m_tabPreview, SLOT(hideAnimated())); // ComboTabBar features setUsesScrollButtons(true); setCloseButtonsToolTip(BrowserWindow::tr("Close Tab")); connect(this, SIGNAL(scrollBarValueChanged(int)), this, SLOT(hideTabPreview())); connect(this, SIGNAL(overFlowChanged(bool)), this, SLOT(overflowChanged(bool))); if (mApp->isPrivate()) { QLabel* privateBrowsing = new QLabel(this); privateBrowsing->setObjectName(QSL("private-browsing-icon")); privateBrowsing->setPixmap(IconProvider::privateBrowsingIcon().pixmap(16, 16)); privateBrowsing->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); privateBrowsing->setFixedWidth(30); addCornerWidget(privateBrowsing, Qt::TopLeftCorner); } }
DatasetsTabWidget::DatasetsTabWidget(QWidget *parent) : QTabWidget(parent) { setUsesScrollButtons(true); setTabsClosable(true); tabBar()->setContextMenuPolicy(Qt::CustomContextMenu); connect(tabBar(), SIGNAL(customContextMenuRequested(const QPoint &)), SLOT(sl_contextMenu(const QPoint &))); #ifdef Q_OS_MACX QString style = "QTabWidget::pane {" "border-top: 1px solid #9B9B9B;" "}" "QTabWidget::tab-bar {" "left: 0px;" "}" "QTabBar::tab {" "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," "stop: 0 #E1E1E1, stop: 0.4 #DDDDDD," "stop: 0.5 #D8D8D8, stop: 1.0 #D3D3D3);" "border: 1px solid #9B9B9B;" "border-bottom: 0px;" "border-top-left-radius: 0px;" "border-top-right-radius: 0px;" "min-width: 10ex;" "padding: 2px;" "}" "QTabBar::tab:selected, QTabBar::tab:hover {" "background: qlineargradient(x1: 0, y1: 0, x2: 0, y2: 1," "stop: 0 #fafafa, stop: 0.4 #f4f4f4," "stop: 0.5 #e7e7e7, stop: 1.0 #fafafa);" "}" "QTabBar::tab:selected {" "border-color: #9B9B9B;" "}"; setStyleSheet(style); #else setDocumentMode(true); #endif }
SeparateTabBar::SeparateTabBar (QWidget *parent) : QTabBar (parent) , Window_ (0) , Id_ (0) , InMove_ (false) , AddTabButton_ (nullptr) { setObjectName ("org_LeechCraft_MainWindow_CentralTabBar"); setExpanding (false); setIconSize (QSize (15, 15)); setContextMenuPolicy (Qt::CustomContextMenu); setElideMode (Qt::ElideRight); setDocumentMode (true); setAcceptDrops (true); setMovable (true); setUsesScrollButtons (false); addTab (QString ()); }
TabView::TabView(QWidget *parent) : QTabWidget{parent}, m_ptrTabBar{std14_stl::make_unique<TabBar>(this)}, m_ptrBtnTabsList{std14_stl::make_unique<QToolButton>(this)}, m_ptrMnuTabsList{std14_stl::make_unique<QMenu>(this)}, m_pLastTab{nullptr} { setTabBar(m_ptrTabBar.get()); m_ptrBtnTabsList->setFixedWidth(20); m_ptrBtnTabsList->setPopupMode(QToolButton::MenuButtonPopup); m_ptrBtnTabsList->setMenu(m_ptrMnuTabsList.get()); setCornerWidget(m_ptrBtnTabsList.get(), Qt::TopRightCorner); setDocumentMode(true); setMovable(true); setTabsClosable(true); setUsesScrollButtons(true); }
TabWidget::TabWidget(QWidget* parent, QString _name) : QTabWidget(parent), tabName(_name) { setFocusPolicy(Qt::NoFocus); /* On Mac OS X this will look similar to * the tabs in Safari or Leopard's Terminal.app . * I love this! */ setDocumentMode(true); tabBar()->setUsesScrollButtons(true); setTabsClosable(false); setMovable(true); setUsesScrollButtons(true); tabBar()->installEventFilter(this); tabBar()->setVisible(false); //connect(this, SIGNAL(tabCloseRequested(int)), this, SLOT(removeTab(int))); }
TabBar::TabBar(BrowserWindow* window, TabWidget* tabWidget) : ComboTabBar() , m_window(window) , m_tabWidget(tabWidget) , m_hideTabBarWithOneTab(false) , m_showCloseOnInactive(0) , m_normalTabWidth(0) , m_activeTabWidth(0) , m_forceHidden(false) { setObjectName("tabbar"); setElideMode(Qt::ElideRight); setFocusPolicy(Qt::NoFocus); setTabsClosable(false); setMouseTracking(true); setDocumentMode(true); setAcceptDrops(true); setDrawBase(false); setMovable(true); connect(this, SIGNAL(currentChanged(int)), this, SLOT(currentTabChanged(int))); // ComboTabBar features setUsesScrollButtons(true); setCloseButtonsToolTip(BrowserWindow::tr("Close Tab")); connect(this, SIGNAL(overFlowChanged(bool)), this, SLOT(overflowChanged(bool))); tabMetrics()->init(); if (mApp->isPrivate()) { QLabel* privateBrowsing = new QLabel(this); privateBrowsing->setObjectName(QSL("private-browsing-icon")); privateBrowsing->setPixmap(IconProvider::privateBrowsingIcon().pixmap(16)); privateBrowsing->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter); privateBrowsing->setFixedWidth(30); addCornerWidget(privateBrowsing, Qt::TopLeftCorner); } }
TabLogViewsWidget::TabLogViewsWidget(QWidget *parent) : QTabWidget(parent) , d(new TabLogViewsWidgetPrivate()) { d->contextMenu = NULL; QPushButton *tabNewTabButton = new QPushButton(SmallIcon(QStringLiteral("tab-new")), QLatin1String(""), this); connect(tabNewTabButton, &QAbstractButton::clicked, this, &TabLogViewsWidget::createTab); tabNewTabButton->setToolTip(i18n("Create a new tab")); tabNewTabButton->setWhatsThis(i18n("Creates a new tab which can display another log.")); QPushButton *tabCloseTabButton = new QPushButton(SmallIcon(QStringLiteral("tab-close")), QLatin1String(""), this); connect(tabCloseTabButton, &QAbstractButton::clicked, this, &TabLogViewsWidget::closeTab); tabCloseTabButton->setToolTip(i18n("Close the current tab")); tabCloseTabButton->setWhatsThis(i18n("Closes the current tab.")); setCornerWidget(tabNewTabButton, Qt::TopLeftCorner); setCornerWidget(tabCloseTabButton, Qt::TopRightCorner); setUsesScrollButtons(true); // The context menu is managed manually setContextMenuPolicy(Qt::ActionsContextMenu); // connect(this, SIGNAL(mouseDoubleClick()), this, SLOT(createTab())); // connect(this, SIGNAL(contextMenu(QPoint)), this, SLOT(showContextMenu(QPoint))); // connect(this, SIGNAL(contextMenu(QWidget*,QPoint)), this, SLOT(showContextMenu(QWidget*,QPoint))); // TODO Use this (need to connect to movedTab(int, int) signal and update the QList // setTabReorderingEnabled(true); connect(this, &QTabWidget::currentChanged, this, &TabLogViewsWidget::changeCurrentTab); }
TabBar::TabBar(QWidget* parent) : QTabBar(parent) { setUsesScrollButtons(true); setAcceptDrops(true); }