if(fs.value("UseCustomTopicWidgetFont", false).toBool())
setCustomFont(fs.value("TopicWidget", QFont()));
+ _mouseEntered = false;
}
void TopicWidget::currentChanged(const QModelIndex ¤t, const QModelIndex &previous) {
void TopicWidget::switchEditable() {
ui.stackedWidget->setCurrentIndex(1);
ui.topicLineEdit->setFocus();
+ ui.topicLineEdit->moveCursor(QTextCursor::End,QTextCursor::MoveAnchor);
updateGeometry();
}
// filter for the input widget to switch back to normal mode
bool TopicWidget::eventFilter(QObject *obj, QEvent *event) {
- if(event->type() == QEvent::FocusOut) {
+
+ if(event->type() == QEvent::FocusOut && !_mouseEntered) {
switchPlain();
return true;
}
-
- if(event->type() != QEvent::KeyPress)
+
+ if(event->type() == QEvent::Enter) {
+ _mouseEntered = true;
+ }
+
+ if(event->type() == QEvent::Leave) {
+ _mouseEntered = false;
+ }
+
+ if(event->type() != QEvent::KeyRelease)
return QObject::eventFilter(obj, event);
QKeyEvent *keyEvent = static_cast<QKeyEvent *>(event);