#include <qxtcheckcombobox_p.h>
Public Slots | |
void | updateCheckedItems () |
void | toggleCheckState (int index) |
Public Member Functions | |
QxtCheckComboBoxPrivate () | |
bool | eventFilter (QObject *receiver, QEvent *event) |
Public Attributes | |
QString | separator |
QString | defaultText |
bool | containerMousePress |
Friends | |
class | QxtCheckComboBox |
Definition at line 48 of file qxtcheckcombobox_p.h.
QxtCheckComboBoxPrivate::QxtCheckComboBoxPrivate | ( | ) |
Definition at line 30 of file qxtcheckcombobox.cpp.
References separator.
: containerMousePress(false) { separator = QLatin1String(","); }
bool QxtCheckComboBoxPrivate::eventFilter | ( | QObject * | receiver, |
QEvent * | event | ||
) |
Definition at line 35 of file qxtcheckcombobox.cpp.
References containerMousePress, mitk::Key_Down, mitk::Key_Enter, mitk::Key_Escape, mitk::Key_Return, mitk::Key_Up, and QxtPrivate< QxtCheckComboBox >::qxt_p().
{ switch (event->type()) { case QEvent::KeyPress: case QEvent::KeyRelease: { QKeyEvent* keyEvent = static_cast<QKeyEvent*>(event); if (receiver == &qxt_p() && (keyEvent->key() == Qt::Key_Up || keyEvent->key() == Qt::Key_Down)) { qxt_p().showPopup(); return true; } else if (keyEvent->key() == Qt::Key_Enter || keyEvent->key() == Qt::Key_Return || keyEvent->key() == Qt::Key_Escape) { // it is important to call QComboBox implementation qxt_p().QComboBox::hidePopup(); if (keyEvent->key() != Qt::Key_Escape) return true; } } case QEvent::MouseButtonPress: containerMousePress = (receiver == qxt_p().view()->window()); break; case QEvent::MouseButtonRelease: containerMousePress = false;; break; default: break; } return false; }
void QxtCheckComboBoxPrivate::toggleCheckState | ( | int | index ) | [slot] |
Definition at line 83 of file qxtcheckcombobox.cpp.
References QxtPrivate< QxtCheckComboBox >::qxt_p().
void QxtCheckComboBoxPrivate::updateCheckedItems | ( | ) | [slot] |
Definition at line 70 of file qxtcheckcombobox.cpp.
References QxtCheckComboBox::checkedItems, QxtCheckComboBox::checkedItemsChanged(), defaultText, QxtPrivate< QxtCheckComboBox >::qxt_p(), and separator.
{ QStringList items = qxt_p().checkedItems(); if (items.isEmpty()) qxt_p().setEditText(defaultText); else qxt_p().setEditText(items.join(separator)); // TODO: find a way to recalculate a meaningful size hint emit qxt_p().checkedItemsChanged(items); }
friend class QxtCheckComboBox [friend] |
Definition at line 53 of file qxtcheckcombobox_p.h.
Definition at line 58 of file qxtcheckcombobox_p.h.
Referenced by eventFilter().
Definition at line 57 of file qxtcheckcombobox_p.h.
Referenced by updateCheckedItems().
Definition at line 56 of file qxtcheckcombobox_p.h.
Referenced by QxtCheckComboBoxPrivate(), and updateCheckedItems().