summaryrefslogtreecommitdiffstats
path: root/ui/qt/widgets
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 17:44:17 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-26 17:44:17 +0000
commit2d78050fd56b8188aa5a65ad2667e301b60eea45 (patch)
treeb54d4adac6de0a196b8bb8a67b34fe186c21378f /ui/qt/widgets
parentAdding upstream version 4.2.2. (diff)
downloadwireshark-2d78050fd56b8188aa5a65ad2667e301b60eea45.tar.xz
wireshark-2d78050fd56b8188aa5a65ad2667e301b60eea45.zip
Adding upstream version 4.2.4.upstream/4.2.4
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'ui/qt/widgets')
-rw-r--r--ui/qt/widgets/filter_expression_toolbar.cpp8
-rw-r--r--ui/qt/widgets/syntax_line_edit.cpp26
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 caf91cf..84dabc4 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 99ccf7b..f2c3214 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);