void SeparateTabWidget::handleContextMenuRequested (const QPoint& point)
	{
		if (point.isNull ())
			return;

		QMenu *menu = new QMenu ("", MainTabBar_);
		int index = MainTabBar_->tabAt (point);

		if (index == -1)
			for (auto act : TabBarActions_)
			{
				if (!act)
				{
					qWarning () << Q_FUNC_INFO
							<< "detected null pointer";
					continue;
				}
				menu->addAction (act);
			}
		else if (index == MainTabBar_->count () - 1)
			menu->addActions (AddTabButtonContextMenu_->actions ());
		else
		{
			LastContextMenuTab_ = index;
			delete menu;
			menu = GetTabMenu (index);
		}
		menu->exec (MainTabBar_->mapToGlobal (point));
		delete menu;
	}
Example #2
0
	void SBWidget::handleTabContextMenu (const QPoint& pos)
	{
		QToolButton *but = qobject_cast<QToolButton*> (sender ());
		QWidget *w = sender ()->property ("Sidebar/TabPage").value<QWidget*> ();

		auto tw = Proxy_->GetTabWidget ();
		auto menu = tw->GetTabMenu (tw->IndexOf (w));
		menu->exec (but->mapToGlobal (pos));
		menu->deleteLater ();
	}