Removed obsolete ability to fill menu with slots.
This commit is contained in:
		
							parent
							
								
									e6b66158e6
								
							
						
					
					
						commit
						6f097fc571
					
				
					 7 changed files with 9 additions and 21 deletions
				
			
		| 
						 | 
				
			
			@ -50,10 +50,6 @@ void DropdownMenu::init() {
 | 
			
		|||
	hide();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
not_null<QAction*> DropdownMenu::addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon, const style::icon *iconOver) {
 | 
			
		||||
	return _menu->addAction(text, receiver, member, icon, iconOver);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
not_null<QAction*> DropdownMenu::addAction(const QString &text, Fn<void()> callback, const style::icon *icon, const style::icon *iconOver) {
 | 
			
		||||
	return _menu->addAction(text, std::move(callback), icon, iconOver);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,7 +18,6 @@ class DropdownMenu : public InnerDropdown {
 | 
			
		|||
public:
 | 
			
		||||
	DropdownMenu(QWidget *parent, const style::DropdownMenu &st = st::defaultDropdownMenu);
 | 
			
		||||
 | 
			
		||||
	not_null<QAction*> addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
 | 
			
		||||
	not_null<QAction*> addAction(const QString &text, Fn<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
 | 
			
		||||
	not_null<QAction*> addSeparator();
 | 
			
		||||
	void clearActions();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -637,12 +637,17 @@ void FlatLabel::showContextMenu(QContextMenuEvent *e, ContextMenuReason reason)
 | 
			
		|||
	_contextMenu = new PopupMenu(this);
 | 
			
		||||
 | 
			
		||||
	if (fullSelection && !_contextCopyText.isEmpty()) {
 | 
			
		||||
		_contextMenu->addAction(_contextCopyText, this, SLOT(onCopyContextText()));
 | 
			
		||||
		_contextMenu->addAction(
 | 
			
		||||
			_contextCopyText,
 | 
			
		||||
			[=] { onCopyContextText(); });
 | 
			
		||||
	} else if (uponSelection && !fullSelection) {
 | 
			
		||||
		const auto text = Integration::Instance().phraseContextCopySelected();
 | 
			
		||||
		_contextMenu->addAction(text, this, SLOT(onCopySelectedText()));
 | 
			
		||||
		_contextMenu->addAction(
 | 
			
		||||
			Integration::Instance().phraseContextCopySelected(),
 | 
			
		||||
			[=] { onCopySelectedText(); });
 | 
			
		||||
	} else if (_selectable && !hasSelection && !_contextCopyText.isEmpty()) {
 | 
			
		||||
		_contextMenu->addAction(_contextCopyText, this, SLOT(onCopyContextText()));
 | 
			
		||||
		_contextMenu->addAction(
 | 
			
		||||
			_contextCopyText,
 | 
			
		||||
			[=] { onCopyContextText(); });
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (const auto link = ClickHandler::getActive()) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -95,12 +95,6 @@ void Menu::init() {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
not_null<QAction*> Menu::addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon, const style::icon *iconOver) {
 | 
			
		||||
	const auto action = addAction(new QAction(text, this), icon, iconOver);
 | 
			
		||||
	connect(action, SIGNAL(triggered(bool)), receiver, member, Qt::QueuedConnection);
 | 
			
		||||
	return action;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
not_null<QAction*> Menu::addAction(const QString &text, Fn<void()> callback, const style::icon *icon, const style::icon *iconOver) {
 | 
			
		||||
	const auto action = addAction(new QAction(text, this), icon, iconOver);
 | 
			
		||||
	connect(action, &QAction::triggered, action, std::move(callback), Qt::QueuedConnection);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -22,7 +22,6 @@ public:
 | 
			
		|||
	Menu(QWidget *parent, QMenu *menu, const style::Menu &st = st::defaultMenu);
 | 
			
		||||
	~Menu();
 | 
			
		||||
 | 
			
		||||
	not_null<QAction*> addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
 | 
			
		||||
	not_null<QAction*> addAction(const QString &text, Fn<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
 | 
			
		||||
	not_null<QAction*> addAction(const QString &text, std::unique_ptr<QMenu> submenu);
 | 
			
		||||
	not_null<QAction*> addSeparator();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -88,10 +88,6 @@ void PopupMenu::handleMenuResize() {
 | 
			
		|||
	_inner = rect().marginsRemoved(_padding);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
not_null<QAction*> PopupMenu::addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon, const style::icon *iconOver) {
 | 
			
		||||
	return _menu->addAction(text, receiver, member, icon, iconOver);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
not_null<QAction*> PopupMenu::addAction(const QString &text, Fn<void()> callback, const style::icon *icon, const style::icon *iconOver) {
 | 
			
		||||
	return _menu->addAction(text, std::move(callback), icon, iconOver);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -21,7 +21,6 @@ public:
 | 
			
		|||
	PopupMenu(QWidget *parent, const style::PopupMenu &st = st::defaultPopupMenu);
 | 
			
		||||
	PopupMenu(QWidget *parent, QMenu *menu, const style::PopupMenu &st = st::defaultPopupMenu);
 | 
			
		||||
 | 
			
		||||
	not_null<QAction*> addAction(const QString &text, const QObject *receiver, const char* member, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
 | 
			
		||||
	not_null<QAction*> addAction(const QString &text, Fn<void()> callback, const style::icon *icon = nullptr, const style::icon *iconOver = nullptr);
 | 
			
		||||
	not_null<QAction*> addAction(const QString &text, std::unique_ptr<PopupMenu> submenu);
 | 
			
		||||
	not_null<QAction*> addSeparator();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue