| | 135 | #ifdef USE_KDE |
| | 136 | void TabWidget::restoreShortcuts() |
| | 137 | { |
| | 138 | // KTabWidget destroys any shortcuts so we have the following options: |
| | 139 | // 1) Don't specify any shortcuts. This is bad since it means qt-gui won't |
| | 140 | // have any shortcuts. |
| | 141 | // 2) Remove shortcuts from strings when compiling for kde. This will result |
| | 142 | // in different shortcuts for qt-gui and kde-gui. |
| | 143 | // 3) Don't use KTabWidget. We want the rest of the function and look of kde |
| | 144 | // so using KTabWidget is preferred. |
| | 145 | // 4) Restore our shortcuts every time KTabWidget has messed with them. |
| | 146 | // This is an ugly workaround but it'll work as a compromise. |
| | 147 | |
| | 148 | for (int i = 0; i < count(); ++i) |
| | 149 | QTabWidget::setTabText(i, tabText(i).replace("&&", "&")); |
| | 150 | } |
| | 151 | |
| | 152 | void TabWidget::setTabText(int index, const QString& label) |
| | 153 | { |
| | 154 | TABWIDGET_BASE::setTabText(index, label); |
| | 155 | restoreShortcuts(); |
| | 156 | } |
| | 157 | |
| | 158 | void TabWidget::resizeEvent(QResizeEvent* event) |
| | 159 | { |
| | 160 | TABWIDGET_BASE::resizeEvent(event); |
| | 161 | restoreShortcuts(); |
| | 162 | } |
| | 163 | #endif |
| | 164 | |