Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Desktop
Commits
6b7040f3
Commit
6b7040f3
authored
Dec 17, 2020
by
Xuetian Weng
Committed by
Xuetian Weng
Dec 19, 2020
Browse files
Hide accent option if it is not supported
CCBUG: 430062
parent
ae84eab7
Changes
2
Hide whitespace changes
Inline
Side-by-side
kcms/keyboard/kcmmisc.cpp
View file @
6b7040f3
...
...
@@ -42,6 +42,12 @@
#include
<X11/Xlib.h>
#include
<cmath>
namespace
{
bool
hasAccentSupport
()
{
static
bool
isPlasmaIM
=
(
qgetenv
(
"QT_IM_MODULE"
)
==
"plasmaim"
);
return
isPlasmaIM
;
}
}
KCMiscKeyboardWidget
::
KCMiscKeyboardWidget
(
QWidget
*
parent
)
:
QWidget
(
parent
),
...
...
@@ -78,7 +84,11 @@ KCMiscKeyboardWidget::KCMiscKeyboardWidget(QWidget *parent)
connect
(
_numlockButtonGroup
,
SIGNAL
(
buttonClicked
(
int
)),
this
,
SLOT
(
changed
()));
_keyboardRepeatButtonGroup
=
new
QButtonGroup
(
ui
.
repeatFormLayout
);
_keyboardRepeatButtonGroup
->
addButton
(
ui
.
accentMenuRadioButton
,
0
);
if
(
hasAccentSupport
())
{
_keyboardRepeatButtonGroup
->
addButton
(
ui
.
accentMenuRadioButton
,
0
);
}
else
{
ui
.
accentMenuRadioButton
->
setVisible
(
false
);
}
_keyboardRepeatButtonGroup
->
addButton
(
ui
.
repeatRadioButton
,
1
);
_keyboardRepeatButtonGroup
->
addButton
(
ui
.
nothingRadioButton
,
2
);
...
...
@@ -103,6 +113,9 @@ KCMiscKeyboardWidget::~KCMiscKeyboardWidget()
// set the slider and LCD values
void
KCMiscKeyboardWidget
::
setRepeat
(
KeyBehaviour
keyboardRepeat
,
int
delay_
,
double
rate_
)
{
if
(
keyboardRepeat
==
KeyBehaviour
::
AccentMenu
&&
!
hasAccentSupport
())
{
keyboardRepeat
=
KeyBehaviour
::
RepeatKey
;
}
_keyboardRepeatButtonGroup
->
button
(
keyboardRepeat
)
->
click
();
ui
.
delay
->
setValue
(
delay_
);
ui
.
rate
->
setValue
(
rate_
);
...
...
kcms/keyboard/kcmmiscwidget.ui
View file @
6b7040f3
...
...
@@ -32,13 +32,20 @@
</property>
</widget>
</item>
<item
row=
"
0
"
column=
"1"
>
<item
row=
"
2
"
column=
"1"
>
<widget
class=
"QRadioButton"
name=
"accentMenuRadioButton"
>
<property
name=
"text"
>
<string>
&
Show accented and similar characters
</string>
</property>
</widget>
</item>
<item
row=
"0"
column=
"1"
>
<widget
class=
"QRadioButton"
name=
"repeatRadioButton"
>
<property
name=
"text"
>
<string>
&
Repeat the key being held
</string>
</property>
</widget>
</item>
<item
row=
"1"
column=
"1"
>
<widget
class=
"QRadioButton"
name=
"nothingRadioButton"
>
<property
name=
"text"
>
...
...
@@ -46,10 +53,24 @@
</property>
</widget>
</item>
<item
row=
"2"
column=
"1"
>
<widget
class=
"QRadioButton"
name=
"repeatRadioButton"
>
</layout>
</item>
<item
row=
"8"
column=
"0"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"toolTip"
>
<string/>
</property>
<property
name=
"text"
>
<string>
&
Repeat the key being held
</string>
<string>
Test area:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit"
>
<property
name=
"toolTip"
>
<string>
Allows to test keyboard repeat and click volume (just don't forget to apply the changes).
</string>
</property>
</widget>
</item>
...
...
@@ -97,7 +118,7 @@
</layout>
</widget>
</item>
<item
row=
"
2
"
column=
"0"
>
<item
row=
"
3
"
column=
"0"
>
<widget
class=
"QGroupBox"
name=
"keyboardRepeatParamsGroupBox"
>
<property
name=
"sizePolicy"
>
<sizepolicy
hsizetype=
"Minimum"
vsizetype=
"Minimum"
>
...
...
@@ -232,26 +253,18 @@
</layout>
</widget>
</item>
<item
row=
"7"
column=
"0"
>
<layout
class=
"QHBoxLayout"
name=
"horizontalLayout_2"
>
<item>
<widget
class=
"QLabel"
name=
"label"
>
<property
name=
"toolTip"
>
<string/>
</property>
<property
name=
"text"
>
<string>
Test area:
</string>
</property>
</widget>
</item>
<item>
<widget
class=
"QLineEdit"
name=
"lineEdit"
>
<property
name=
"toolTip"
>
<string>
Allows to test keyboard repeat and click volume (just don't forget to apply the changes).
</string>
</property>
</widget>
</item>
</layout>
<item
row=
"2"
column=
"0"
>
<spacer
name=
"verticalSpacer"
>
<property
name=
"orientation"
>
<enum>
Qt::Vertical
</enum>
</property>
<property
name=
"sizeHint"
stdset=
"0"
>
<size>
<width>
20
</width>
<height>
40
</height>
</size>
</property>
</spacer>
</item>
</layout>
</widget>
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment