| 174 | } |
| 175 | |
| 176 | QWidget *TabWidgetPrivate::createSpaceWidget() |
| 177 | { |
| 178 | QWidget *widget = new QWidget(q); |
| 179 | QVBoxLayout *vLayout = new QVBoxLayout(widget); |
| 180 | vLayout->setSpacing(5); |
| 181 | |
| 182 | QLabel *titleLabel = new QLabel(tr("File Operation"), q); |
| 183 | titleLabel->setAlignment(Qt::AlignCenter); |
| 184 | auto font = titleLabel->font(); |
| 185 | font.setPointSize(font.pointSize() * 1.5); |
| 186 | titleLabel->setFont(font); |
| 187 | |
| 188 | QGridLayout *gridLayout = new QGridLayout; |
| 189 | gridLayout->setSpacing(10); |
| 190 | auto addCommandLine = [this, gridLayout](const QString &id) { |
| 191 | auto cmd = ActionManager::instance()->command(id); |
| 192 | if (!cmd || !cmd->action()) |
| 193 | return; |
| 194 | |
| 195 | int row = gridLayout->rowCount(); |
| 196 | gridLayout->addWidget(new QLabel(cmd->action()->text(), q), row, 0, Qt::AlignRight); |
| 197 | const auto &keyList = cmd->keySequences(); |
| 198 | for (int i = 0; i < keyList.size(); ++i) { |
| 199 | auto key = keyList[i]; |
| 200 | gridLayout->addWidget(new KeyLabel(key.toString(), q), row, i + 1, Qt::AlignLeft); |
| 201 | } |
| 202 | }; |
| 203 | |
| 204 | addCommandLine(A_OPEN_FILE); |
| 205 | addCommandLine("Find.findInDocument"); |
| 206 | addCommandLine("Editor.close"); |
| 207 | addCommandLine("locator.EnterCommand"); |
| 208 | addCommandLine("Editor.addAndRemoveComment"); |
| 209 | |
| 210 | vLayout->addStretch(1); |
| 211 | vLayout->addWidget(titleLabel, 0, Qt::AlignHCenter); |
| 212 | vLayout->addLayout(gridLayout); |
| 213 | vLayout->addStretch(1); |
| 214 | |
| 215 | return widget; |
| 216 | } |
| 217 | |
| 218 | QWidget *TabWidgetPrivate::createFindPlaceHolder() |
| 219 | { |