コード例 #1
0
ファイル: UserEdit.cpp プロジェクト: Apieture/mumble
void UserEdit::on_qlwUserList_customContextMenuRequested(const QPoint &point) {
	QMenu *menu = new QMenu(this);

	QAction *action = menu->addAction(tr("Rename"));
	connect(action, SIGNAL(triggered()), this, SLOT(renameTriggered()));

	menu->addSeparator();

	action = menu->addAction(tr("Remove"));
	connect(action, SIGNAL(triggered()), this, SLOT(on_qpbRemove_clicked()));

	menu->exec(qlwUserList->mapToGlobal(point));
	delete menu;
}
コード例 #2
0
ファイル: UserEdit.cpp プロジェクト: Breekenz/mumble
void UserEdit::on_qtvUserList_customContextMenuRequested(const QPoint &point) {
	QMenu *menu = new QMenu(this);

	if (qtvUserList->selectionModel()->currentIndex().isValid()) {
		QAction *renameAction = menu->addAction(tr("Rename"));
		connect(renameAction, SIGNAL(triggered()),
		        this, SLOT(on_qpbRename_clicked()));

		menu->addSeparator();
	}

	QAction *removeMenuAction = menu->addAction(tr("Remove"));
	connect(removeMenuAction, SIGNAL(triggered()),
	        this, SLOT(on_qpbRemove_clicked()));

	menu->exec(qtvUserList->mapToGlobal(point));
	delete menu;
}