diff options
Diffstat (limited to '')
-rw-r--r-- | ui/qt/widgets/filter_expression_toolbar.cpp | 8 | ||||
-rw-r--r-- | ui/qt/widgets/syntax_line_edit.cpp | 26 |
2 files changed, 21 insertions, 13 deletions
diff --git a/ui/qt/widgets/filter_expression_toolbar.cpp b/ui/qt/widgets/filter_expression_toolbar.cpp index caf91cfa..84dabc47 100644 --- a/ui/qt/widgets/filter_expression_toolbar.cpp +++ b/ui/qt/widgets/filter_expression_toolbar.cpp @@ -305,8 +305,10 @@ bool FilterExpressionToolBar::eventFilter(QObject *obj, QEvent *event) QContextMenuEvent *ctx = static_cast<QContextMenuEvent *>(event); QAction * filterAction = qm->actionAt(ctx->pos()); - if (filterAction) - customMenu(this, filterAction, ctx->pos()); + if (filterAction) { + QPoint tb_pos = this->mapFromGlobal(ctx->globalPos()); + customMenu(this, filterAction, tb_pos); + } return true; } else if (event->type() == QEvent::ToolTip) @@ -324,7 +326,7 @@ bool FilterExpressionToolBar::eventFilter(QObject *obj, QEvent *event) } } - return QToolBar::eventFilter(obj, event); + return DragDropToolBar::eventFilter(obj, event); } void FilterExpressionToolBar::closeMenu(QAction * /*sender*/) diff --git a/ui/qt/widgets/syntax_line_edit.cpp b/ui/qt/widgets/syntax_line_edit.cpp index 99ccf7bc..f2c32142 100644 --- a/ui/qt/widgets/syntax_line_edit.cpp +++ b/ui/qt/widgets/syntax_line_edit.cpp @@ -425,17 +425,23 @@ void SyntaxLineEdit::paintEvent(QPaintEvent *event) QRect cr = style()->subElementRect(QStyle::SE_LineEditContents, &opt, this); QPainter painter(this); - // In my (gcc) testing here, if I add "background: yellow;" to the DisplayFilterCombo - // stylesheet, when building with Qt 5.15.2 the combobox background is yellow and the - // text entry area (between the bookmark and apply button) is drawn in the correct - // base color (white for light mode and black for dark mode), and the correct syntax - // color otherwise. When building with Qt 6.2.4 and 6.3.1, the combobox background is - // yellow and the text entry area is always yellow, i.e. QLineEdit isn't painting its - // background for some reason. + // In the attempt to fix https://bugreports.qt.io/browse/QTBUG-81533 + // the following commit was added to Qt 6.0.0 and later 5.15.3: + // https://code.qt.io/cgit/qt/qtbase.git/commit/src/widgets/widgets/qcombobox.cpp?h=5.15&id=6e470764a98434a120eba4fcc6035137cf9c92cf // - // It's not clear if this is a bug or just how things work under Qt6. Either way, it's - // easy to work around. -#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + // It causes a similar problem to the one it was trying to fix, viz. if I + // add "background: yellow;" to the DisplayFilterCombo stylesheet, when + // building with Qt 5.15.2 the combobox background is yellow and the text + // entry area (between the bookmark and apply button) is drawn in the correct + // base color (white for light mode and black for dark mode), and the correct + // syntax color otherwise. When building with Qt 5.15.3 and 6.2.4 and 6.3.1, + // the combobox background is yellow and the text entry area is always yellow, + // i.e. QLineEdit isn't painting its background because the palette from + // the combobox is used instead. + // + // It's not clear if this is a bug or just how things work under Qt6. + // Either way, it's easy to work around. +#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 3) // Must match CaptureFilterEdit and DisplayFilterEdit stylesheets. int pad = style()->pixelMetric(QStyle::PM_DefaultFrameWidth) + 1; QRect full_cr = cr.adjusted(-pad, 0, -1, 0); |