Example #1
0
CQDlgCollisions::CQDlgCollisions(QWidget *parent) :
	CDlgEx(parent),
    ui(new Ui::CQDlgCollisions)
{
    ui->setupUi(this);
	inSelectionRoutine=false;
	QShortcut* shortcut = new QShortcut(QKeySequence(Qt::Key_Delete), this);
	connect(shortcut,SIGNAL(activated()), this, SLOT(onDeletePressed()));
	QShortcut* shortcut2 = new QShortcut(QKeySequence(Qt::Key_Backspace), this);
	connect(shortcut2,SIGNAL(activated()), this, SLOT(onDeletePressed()));
	CEditBoxDelegate* delegate=new CEditBoxDelegate();
	ui->qqCollisionList->setItemDelegate(delegate);
}
CQDlgMotionPlanning::CQDlgMotionPlanning(QWidget *parent) :
	CDlgEx(parent),
	ui(new Ui::CQDlgMotionPlanning)
{
    ui->setupUi(this);
	inMainRefreshRoutine=false;
	inListSelectionRoutine=false;
	noListSelectionAllowed=false;
	delKeyShortcut = new QShortcut(QKeySequence(Qt::Key_Delete), this);
	connect(delKeyShortcut,SIGNAL(activated()), this, SLOT(onDeletePressed()));
	backspaceKeyShortcut = new QShortcut(QKeySequence(Qt::Key_Backspace), this);
	connect(backspaceKeyShortcut,SIGNAL(activated()), this, SLOT(onDeletePressed()));
	CEditBoxDelegate* delegate=new CEditBoxDelegate();
	ui->qqList->setItemDelegate(delegate);
}
void
ItemSelectorWidget::setType( Type type )
{
    if (type == User)
        layout()->addItem( new QWidgetItem( ui.searchBox = new UserSearch( this ) ) );
    else
        layout()->addItem( new QWidgetItem( ui.searchBox = new TagSearch( this ) ) );

    ui.searchBox->setFrame( false );
    ui.searchBox->setSizePolicy( QSizePolicy::Preferred, QSizePolicy::Preferred );

    setFocusPolicy( Qt::StrongFocus );
    setFocusProxy( ui.searchBox );

    connect( ui.searchBox, SIGNAL(editingFinished()), SLOT(onItemSelected()) );
    connect( ui.searchBox->completer()->popup(), SIGNAL(clicked(QModelIndex)), SLOT(onItemSelected()));
    connect( ui.searchBox, SIGNAL(textChanged(QString)), SLOT(onTextChanged(QString)));

    connect( ui.searchBox, SIGNAL(commaPressed()), SLOT(onItemSelected()) );
    connect( ui.searchBox, SIGNAL(deletePressed()), SLOT(onDeletePressed()) );
}