Skip to content

Commit d661a37

Browse files
shun2wangboutinb
andauthored
bugfix: fix tooltip in the checkBox and RadioButton (#5623)
* fix tooltip in the checkBox and RadioButton * Repair tooltip in jaspControl --------- Co-authored-by: boutinb <[email protected]>
1 parent 41e2628 commit d661a37

File tree

4 files changed

+15
-14
lines changed

4 files changed

+15
-14
lines changed

QMLComponents/components/JASP/Controls/CheckBox.qml

+4-6
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,9 @@
1616
// <http://www.gnu.org/licenses/>.
1717
//
1818

19-
import QtQuick 2.11
20-
import QtQuick.Controls 2.4
21-
import QtQuick.Layouts 1.3 as L
22-
import JASP 1.0
19+
import QtQuick
20+
import QtQuick.Controls as QtC
21+
import JASP
2322

2423

2524
CheckBoxBase
@@ -53,8 +52,7 @@ CheckBoxBase
5352
function click() { control.toggle(); }
5453
function toggle() { control.toggle(); }
5554

56-
57-
CheckBox
55+
QtC.CheckBox
5856
{
5957
id: control
6058
padding: jaspTheme.jaspControlPadding

QMLComponents/components/JASP/Controls/RadioButton.qml

+4-5
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616
// <http://www.gnu.org/licenses/>.
1717
//
1818

19-
import QtQuick 2.11
20-
import QtQuick.Controls 2.4
21-
import JASP 1.0
19+
import QtQuick
20+
import QtQuick.Controls as QtC
21+
import JASP
2222

2323

2424
RadioButtonBase
@@ -51,8 +51,7 @@ RadioButtonBase
5151
function click() { clicked(); }
5252
onClicked: { radioButton.clickHandler(); }
5353

54-
55-
RadioButton
54+
QtC.RadioButton
5655
{
5756
id: control
5857
padding: jaspTheme.jaspControlPadding

QMLComponents/controls/jaspcontrol.cpp

+6-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,15 @@ const QStringList JASPControl::_optionReservedNames = {"data", "version"};
1313
QMap<QQmlEngine*, QQmlComponent*> JASPControl::_mouseAreaComponentMap;
1414
QByteArray JASPControl::_mouseAreaDef = "\
1515
import QtQuick\n\
16+
import QtQuick.Controls\n\
1617
MouseArea {\n\
1718
z: 5\n\
1819
anchors.fill: parent\n\
1920
acceptedButtons: Qt.NoButton\n\
21+
ToolTip.timeout: jaspTheme.toolTipTimeout\n\
22+
ToolTip.delay: jaspTheme.toolTipDelay\n\
23+
ToolTip.text: parent ? parent.toolTip : ''\n\
24+
ToolTip.visible: ToolTip.text && containsMouse\n\
2025
}";
2126

2227
QQmlComponent* JASPControl::getMouseAreaComponent(QQmlEngine* engine)
@@ -53,7 +58,6 @@ JASPControl::JASPControl(QQuickItem *parent) : QQuickItem(parent)
5358
connect(this, &JASPControl::indentChanged, [this] () { QQmlProperty(this, "Layout.leftMargin", qmlContext(this)).write( (indent() && JaspTheme::currentTheme()) ? JaspTheme::currentTheme()->indentationLength() : 0); });
5459
connect(this, &JASPControl::debugChanged, [this] () { _setBackgroundColor(); _setVisible(); } );
5560
connect(this, &JASPControl::parentDebugChanged, [this] () { _setBackgroundColor(); _setVisible(); } );
56-
connect(this, &JASPControl::toolTipChanged, [this] () { QQmlProperty(this, "ToolTip.text", qmlContext(this)).write(toolTip()); } );
5761
connect(this, &JASPControl::boundValueChanged, this, &JASPControl::_resetBindingValue);
5862
connect(this, &JASPControl::activeFocusChanged, this, &JASPControl::_setFocus);
5963
connect(this, &JASPControl::activeFocusChanged, this, &JASPControl::_notifyFormOfActiveFocus);
@@ -707,7 +711,7 @@ JASPControl *JASPControl::parentListViewEx() const
707711
bool JASPControl::hovered() const
708712
{
709713
if (_mouseAreaObj)
710-
return _mouseAreaObj->property("hovered").toBool();
714+
return _mouseAreaObj->property("containsMouse").toBool();
711715
else
712716
return false;
713717
}

QMLComponents/jasptheme.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -721,7 +721,7 @@ private slots:
721721
theme_timeType _hoverTime = 400,
722722
_fileMenuSlideDuration = 150,
723723
_toolTipDelay = 500,
724-
_toolTipTimeout =60000;
724+
_toolTipTimeout = 5000;
725725

726726
QFont _font,
727727
_fontLink,

0 commit comments

Comments
 (0)