@@ -410,21 +410,21 @@ void Panel::updateWorkspaces() {
410410 visibleDesktop = KWindowSystem::currentDesktop ();
411411 if (mPanelLayout == Horizontal) {
412412 for (qint8 workspace = 1 ; workspace <= mCountWorkspaces ; ++workspace) {
413- QString buttonText ;
413+ QString buttonName ;
414414 if (!getConfigValue (" showDesktopNames" ).toBool ()) {
415- buttonText = QString (" workspace%1" ).arg (workspace);
415+ buttonName = QString (" workspace%1" ).arg (workspace);
416416 }
417417 else {
418- buttonText = KWindowSystem::desktopName (workspace);
418+ buttonName = KWindowSystem::desktopName (workspace);
419419 }
420420
421421 if ((workspace) == visibleDesktop) {
422422 QString buttonStyle = QString (" background-color: %1; color: #ffffff;" ).arg (mAccentColor );
423- mAppletWidgets [buttonText ]->setStyleSheet (buttonStyle);
423+ mAppletWidgets [buttonName ]->setStyleSheet (buttonStyle);
424424 qDebug () << visibleDesktop << " is visible." ;
425425 }
426426 else {
427- mAppletWidgets [buttonText ]->setStyleSheet (" background-color: #9a9996; color: #000000;" );
427+ mAppletWidgets [buttonName ]->setStyleSheet (" background-color: #9a9996; color: #000000;" );
428428 }
429429 }
430430 }
@@ -917,7 +917,7 @@ void Panel::addApplets() {
917917 for (qint8 workspace = 1 ; workspace <= countWorkspaces; ++workspace) {
918918 QString buttonText;
919919 if (!getConfigValue (" showDesktopNames" ).toBool ()) {
920- buttonText = QString ( " workspace%1 " ). arg (workspace);
920+ buttonText = QString::number (workspace);
921921 }
922922 else {
923923 buttonText = KWindowSystem::desktopName (workspace);
@@ -926,7 +926,7 @@ void Panel::addApplets() {
926926 QPushButton* currentWorkspace = new QPushButton (buttonText);
927927 currentWorkspace->setMaximumWidth (mFontMetrics ->horizontalAdvance (" 100" ));
928928 currentWorkspace->setStyleSheet (" background-color: #9a9996; color: #000000;" );
929- mAppletWidgets [buttonText ] = currentWorkspace;
929+ mAppletWidgets [QString ( " workspace%1 " ). arg (workspace) ] = currentWorkspace;
930930
931931 if (KWindowSystem::currentDesktop () == workspace) {
932932 QString buttonStyle = QString (" background-color: %1; color: #ffffff;" ).arg (mAccentColor );
@@ -1200,15 +1200,15 @@ void Panel::addApplets() {
12001200
12011201 else if (applet == " workspaces" ) {
12021202 for (qint8 workspace = 1 ; workspace <= mCountWorkspaces ; ++workspace) {
1203- QString buttonText ;
1203+ QString buttonName ;
12041204 if (!getConfigValue (" showDesktopNames" ).toBool ()) {
1205- buttonText = QString (" workspace%1" ).arg (workspace);
1205+ buttonName = QString (" workspace%1" ).arg (workspace);
12061206 }
12071207 else {
1208- buttonText = KWindowSystem::desktopName (workspace);
1208+ buttonName = KWindowSystem::desktopName (workspace);
12091209 }
12101210
1211- this ->connect (static_cast <QPushButton*>(mAppletWidgets [buttonText ]),
1211+ this ->connect (static_cast <QPushButton*>(mAppletWidgets [buttonName ]),
12121212 &QPushButton::clicked, this , [workspace]() {
12131213 KWindowSystem::setCurrentDesktop (workspace);
12141214 });
0 commit comments