本文整理汇总了C++中QLinkedList::constEnd方法的典型用法代码示例。如果您正苦于以下问题:C++ QLinkedList::constEnd方法的具体用法?C++ QLinkedList::constEnd怎么用?C++ QLinkedList::constEnd使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QLinkedList
的用法示例。
在下文中一共展示了QLinkedList::constEnd方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_actionShortcuts_triggered
void MainWindow::on_actionShortcuts_triggered() {
QTableWidget* scTable = new QTableWidget();
scTable->setRowCount(0);
scTable->setColumnCount(2);
scTable->setHorizontalHeaderItem(0, new QTableWidgetItem("Shortcut"));
scTable->setHorizontalHeaderItem(1, new QTableWidgetItem("Description"));
scTable->verticalHeader()->hide();
QLinkedList<QPair<QString, QString>> scList;
//read from file in resources and add to linked list
QFile shortcutFile(":Shortcuts/resources/shortcuts.txt");
if (!shortcutFile.open(QIODevice::ReadOnly | QIODevice::Text))
return;
QString line;
while (!shortcutFile.atEnd()) {
QTextStream stream(&shortcutFile);
while (!stream.atEnd()) {
line = stream.readLine();
QStringList shortCutAndDescription = line.split(':');
if (shortCutAndDescription.size() == 2) {
scList.append(QPair<QString, QString>(shortCutAndDescription[0], shortCutAndDescription[1]));
}
}
}
QLinkedList<QPair<QString, QString>>::const_iterator sc;
for (sc = scList.constBegin(); sc != scList.constEnd(); ++sc) {
scTable->insertRow(scTable->rowCount());
QTableWidgetItem* scKey = new QTableWidgetItem(sc->first);
QTableWidgetItem* scKeyInfo = new QTableWidgetItem(sc->second);
scKey->setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
scKeyInfo->setFlags(Qt::NoItemFlags | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
scTable->setItem(scTable->rowCount() - 1, 0, scKey);
scTable->setItem(scTable->rowCount() - 1, 1, scKeyInfo);
}
//scTable->horizontalHeader()->setStretchLastSection( true );
scTable->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
QWidget* outerWidget = new QWidget();
outerWidget->setWindowTitle("Shortcuts");
outerWidget->resize(scTable->size());
QVBoxLayout* vLayout = new QVBoxLayout();
vLayout->addWidget(scTable);
outerWidget->setLayout(vLayout);
outerWidget->show();
}