mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-05 08:57:35 +00:00
Fix InsertTableWidget interference with tooltip geometry on Qt6 (#12776)
The current method played badly with Qt6 on wayland
This commit is contained in:
parent
cdc96159f1
commit
f75f73a402
@ -37,6 +37,8 @@ InsertTableWidget::InsertTableWidget(QWidget * parent)
|
|||||||
{
|
{
|
||||||
init();
|
init();
|
||||||
setMouseTracking(true);
|
setMouseTracking(true);
|
||||||
|
// display tooltip without any delay
|
||||||
|
setStyle(new ProxyStyle(style()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -120,11 +122,7 @@ void InsertTableWidget::mouseMoveEvent(QMouseEvent * event)
|
|||||||
if (bottom_ != b0 || right_ != r0) {
|
if (bottom_ != b0 || right_ != r0) {
|
||||||
update();
|
update();
|
||||||
QString const status = QString("%1x%2").arg(bottom_).arg(right_);
|
QString const status = QString("%1x%2").arg(bottom_).arg(right_);
|
||||||
#if (QT_VERSION >= QT_VERSION_CHECK(6, 0, 0))
|
setToolTip(status);
|
||||||
QToolTip::showText(event->globalPosition().toPoint(), status , this);
|
|
||||||
#else
|
|
||||||
QToolTip::showText(event->globalPos(), status , this);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -14,12 +14,31 @@
|
|||||||
#define INSERTTABLEWIDGET_H
|
#define INSERTTABLEWIDGET_H
|
||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
#include <QProxyStyle>
|
||||||
|
|
||||||
namespace lyx {
|
namespace lyx {
|
||||||
namespace frontend {
|
namespace frontend {
|
||||||
|
|
||||||
class GuiView;
|
class GuiView;
|
||||||
|
|
||||||
|
// A proxy style to get rif of the style-specific tool tip delay
|
||||||
|
// (https://forum.qt.io/topic/90403/show-tooltip-immediatly/6)
|
||||||
|
class ProxyStyle : public QProxyStyle
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
using QProxyStyle::QProxyStyle;
|
||||||
|
int styleHint(StyleHint hint, const QStyleOption * option = nullptr,
|
||||||
|
const QWidget* widget = nullptr,
|
||||||
|
QStyleHintReturn* returnData = nullptr) const override
|
||||||
|
{
|
||||||
|
if (hint == QStyle::SH_ToolTip_WakeUpDelay)
|
||||||
|
return 0;
|
||||||
|
else if (hint == QStyle::SH_ToolTip_FallAsleepDelay)
|
||||||
|
return 0;
|
||||||
|
return QProxyStyle::styleHint(hint, option, widget, returnData);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
class InsertTableWidget : public QWidget {
|
class InsertTableWidget : public QWidget {
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
|
Loading…
Reference in New Issue
Block a user