Exemplo n.º 1
0
void FancyLineEdit::iconClicked()
{
    IconButton *button = qobject_cast<IconButton *>(sender());
    int index = -1;
    for (int i = 0; i < 2; ++i)
        if (d->m_iconbutton[i] == button)
            index = i;
    if (index == -1)
        return;
    if (d->m_menu[index]) {
        execMenuAtWidget(d->m_menu[index], button);
    } else {
        emit buttonClicked((Side)index);
        if (index == Left)
            emit leftButtonClicked();
        else if (index == Right)
            emit rightButtonClicked();
    }
}
Exemplo n.º 2
0
// -----------------------------------------------------------------------------
//
// -----------------------------------------------------------------------------
void SearchLineEdit::iconClicked()
{
  IconButton* button = qobject_cast<IconButton*>(sender());
  int index = -1;
  for (int i = 0; i < 2; ++i)
    if (d->m_IconButtons[i] == button)
    { index = i; }
  if (index == -1)
  { return; }
  if (d->m_ButtonMenus[index])
  {
    execMenuAtWidget(d->m_ButtonMenus[index], button);
  }
  else
  {
    emit buttonClicked((Side)index);
    if (index == Left)
    { emit leftButtonClicked(); }
    else if (index == Right)
    { emit rightButtonClicked(); }
  }
}
Exemplo n.º 3
0
bool FancyLineEditPrivate::eventFilter(QObject *obj, QEvent *event) {
    int buttonIndex = -1;
    for (int i = 0; i < 2; ++i) {
        if (obj == m_iconbutton[i]) {
            buttonIndex = i;
            break;
        }
    }
    if (buttonIndex == -1)
        return QObject::eventFilter(obj, event);
    switch (event->type()) {
    case QEvent::FocusIn:
        if (m_menuTabFocusTrigger[buttonIndex] && m_menu[buttonIndex]) {
            m_lineEdit->setFocus();
            execMenuAtWidget(m_menu[buttonIndex], m_iconbutton[buttonIndex]);
            return true;
        }
    default:
        break;
    }
    return QObject::eventFilter(obj, event);
}