mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
desktop: set composition flag in dive site list
This is crazy: when view() is called, the dive-site-suggestion popup (DiveLocationListView) clears its WA_InputMethodEnabled flag. This makes key composition not work as long as the popup is open. Thus, when showing the popup, explicitly set the flag. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
881a9cac4e
commit
9455ca7061
2 changed files with 15 additions and 11 deletions
|
@ -1,3 +1,4 @@
|
|||
desktop: fix key composition in tag widgets and dive site widget
|
||||
mobile: allow cloud account deletion (Apple app store requirement)
|
||||
|
||||
---
|
||||
|
|
|
@ -37,7 +37,7 @@ LocationInformationWidget::LocationInformationWidget(QWidget *parent) : QGroupBo
|
|||
ui.diveSiteMessage->setText(tr("Dive site management"));
|
||||
ui.diveSiteMessage->addAction(acceptAction);
|
||||
|
||||
connect(ui.geoCodeButton, SIGNAL(clicked()), this, SLOT(reverseGeocode()));
|
||||
connect(ui.geoCodeButton, &QPushButton::clicked, this, &LocationInformationWidget::reverseGeocode);
|
||||
ui.diveSiteCoordinates->installEventFilter(this);
|
||||
|
||||
connect(&diveListNotifier, &DiveListNotifier::diveSiteChanged, this, &LocationInformationWidget::diveSiteChanged);
|
||||
|
@ -57,9 +57,8 @@ void LocationInformationWidget::keyPressEvent(QKeyEvent *e)
|
|||
return QGroupBox::keyPressEvent(e);
|
||||
}
|
||||
|
||||
bool LocationInformationWidget::eventFilter(QObject *object, QEvent *ev)
|
||||
bool LocationInformationWidget::eventFilter(QObject *, QEvent *ev)
|
||||
{
|
||||
Q_UNUSED(object)
|
||||
if (ev->type() == QEvent::ContextMenu) {
|
||||
QContextMenuEvent *ctx = (QContextMenuEvent *)ev;
|
||||
QMenu contextMenu;
|
||||
|
@ -436,9 +435,9 @@ bool DiveLocationModel::setData(const QModelIndex &index, const QVariant &value,
|
|||
}
|
||||
|
||||
DiveLocationLineEdit::DiveLocationLineEdit(QWidget *parent) : QLineEdit(parent),
|
||||
proxy(new DiveLocationFilterProxyModel()),
|
||||
model(new DiveLocationModel()),
|
||||
view(new DiveLocationListView()),
|
||||
proxy(new DiveLocationFilterProxyModel),
|
||||
model(new DiveLocationModel),
|
||||
view(new DiveLocationListView),
|
||||
currDs(nullptr)
|
||||
{
|
||||
proxy->setSourceModel(model);
|
||||
|
@ -496,9 +495,8 @@ bool DiveLocationLineEdit::eventFilter(QObject *, QEvent *e)
|
|||
view->hide();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else if (e->type() == QEvent::InputMethod) {
|
||||
this->inputMethodEvent(static_cast<QInputMethodEvent *>(e));
|
||||
} else if (e->type() == QEvent::InputMethod) {
|
||||
inputMethodEvent(static_cast<QInputMethodEvent *>(e));
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -566,8 +564,13 @@ void DiveLocationLineEdit::setTemporaryDiveSiteName(const QString &name)
|
|||
model->setData(i1, i1_name);
|
||||
proxy->setFilter(name);
|
||||
fixPopupPosition();
|
||||
if (!view->isVisible())
|
||||
if (!view->isVisible()) {
|
||||
view->show();
|
||||
// TODO: For some reason the show() call clears this flag,
|
||||
// which breaks key composition. Find the real cause for
|
||||
// this strange behavior!
|
||||
view->setAttribute(Qt::WA_InputMethodEnabled);
|
||||
}
|
||||
}
|
||||
|
||||
void DiveLocationLineEdit::keyPressEvent(QKeyEvent *ev)
|
||||
|
@ -672,7 +675,7 @@ struct dive_site *DiveLocationLineEdit::currDiveSite() const
|
|||
return text().trimmed().isEmpty() ? nullptr : currDs;
|
||||
}
|
||||
|
||||
DiveLocationListView::DiveLocationListView(QWidget*)
|
||||
DiveLocationListView::DiveLocationListView(QWidget *parent) : QListView(parent)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue