void OBSBasicFilters::CustomContextMenu(const QPoint &pos, bool async)
{
	QListWidget *list = async ? ui->asyncFilters : ui->effectFilters;
	QListWidgetItem *item = list->itemAt(pos);

	QMenu popup(window());

	QPointer<QMenu> addMenu = CreateAddFilterPopupMenu(async);
	if (addMenu)
		popup.addMenu(addMenu);

	if (item) {
		const char *renameSlot = async ?
			SLOT(RenameAsyncFilter()) : SLOT(RenameEffectFilter());
		const char *removeSlot = async ?
			SLOT(on_removeAsyncFilter_clicked()) :
			SLOT(on_removeEffectFilter_clicked());

		popup.addSeparator();
		popup.addAction(QTStr("Rename"), this, renameSlot);
		popup.addAction(QTStr("Remove"), this, removeSlot);
	}

	popup.exec(QCursor::pos());
}
Example #2
0
void MainWindow::focusAssistant()
{
    QListWidget* widget = qobject_cast<QListWidget*>(m_assistantToolBox->currentWidget());
    if (widget) {
        widget->setFocus();
        if (widget->selectedItems().count() == 0) {
            widget->setCurrentItem(widget->itemAt(0, 0));
        }
    }
}