本文整理汇总了C++中Place::format方法的典型用法代码示例。如果您正苦于以下问题:C++ Place::format方法的具体用法?C++ Place::format怎么用?C++ Place::format使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Place
的用法示例。
在下文中一共展示了Place::format方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: p
PageEntryDialog::PageEntryDialog(int pageset,QWidget * parent) : QDialog(parent) {
QLOG_DEBUG() << Q_FUNC_INFO;
QSqlQuery p(QSqlDatabase::database("notesdb"));
if (! p.prepare(SQL_PAGESET_DETAIL)) {
QLOG_WARN() << QString(tr("Prepare failed for SQL_PAGESET_DETAIL query:%1")).arg(p.lastError().text());
}
/// we shouldn't have sql errors, but this should fail gracefully
p.bindValue(0,pageset);
p.exec();
int page = 0;
QVBoxLayout * layout = new QVBoxLayout;
QMap<int,QString> hm;
QStringList cols;
cols << tr("Select") << tr("Node") << tr("Root") << tr("Headword") << tr("Volume/Page") << tr("Id");
m_pages = new ColumnarTableWidget(cols);
m_pages->setKey(ColumnarTableWidget::STATE,SID_PAGESET_PAGEENTRY_STATE);
m_pages->setSelectionMode(QAbstractItemView::SingleSelection);
m_pages->verticalHeader()->setVisible(false);
QString html;
QLabel * label;
while(p.next()) {
Place n = Place::fromString(p.record().value("place").toString());
if (n.isValid()) {
page = m_pages->rowCount();
m_pages->insertRow(page);
m_pages->setItem(page,PAGE_NODE_COLUMN,new QTableWidgetItem(n.m_node));
m_pages->item(page,PAGE_NODE_COLUMN)->setTextAlignment(Qt::AlignCenter);
html = qobject_cast<Lexicon *>(qApp)->scanAndStyle(n.m_root,"pageset");
label = new QLabel(html);;
label->setAlignment(Qt::AlignCenter);
m_pages->setCellWidget(page,PAGE_ROOT_COLUMN,label);
html = qobject_cast<Lexicon *>(qApp)->scanAndStyle(n.m_word,"pageset");
label = new QLabel(html);;
label->setAlignment(Qt::AlignCenter);
m_pages->setCellWidget(page,PAGE_WORD_COLUMN,label);
m_pages->setCellWidget(page,PAGE_LOAD_COLUMN,new CenteredCheckBox);
m_pages->setItem(page,PAGE_VOLUME_COLUMN,new QTableWidgetItem(n.format("%V/%P")));
m_pages->item(page,PAGE_VOLUME_COLUMN)->setTextAlignment(Qt::AlignCenter);
m_pages->setItem(page,PAGE_ID_COLUMN,new QTableWidgetItem(p.record().value("id").toString()));
}
}
int rows = m_pages->rowCount();
if (m_pages->rowCount() == 0) {
m_pages->clear();
m_pages->insertRow(0);
m_pages->setColumnCount(1);
m_pages->setHorizontalHeaderLabels(QStringList() << "");
m_pages->horizontalHeader()->setStretchLastSection(true);
QLabel * m = new QLabel(tr("<em>No pages found</em>"));
m->setAlignment(Qt::AlignCenter);
m_pages->setCellWidget(0,0,m);
}
else {
QTableWidgetItem * item;
QList<int> cols;
cols << PAGE_NODE_COLUMN << PAGE_VOLUME_COLUMN << PAGE_ID_COLUMN;
for(int i=0;i < m_pages->rowCount();i++) {
for(int j=0;j < cols.size();j++) {
item = m_pages->item(i,cols[j]);
item->setFlags(item->flags() ^ Qt::ItemIsEditable);
}
}
}
m_pages->hideColumn(PAGE_ID_COLUMN);
m_pages->resizeColumnsToContents();
layout->addWidget(m_pages);
QDialogButtonBox * buttonBox;
if (rows > 0) {
buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
QPushButton * btn1 = new QPushButton(tr("Select all"));
buttonBox->addButton(btn1,QDialogButtonBox::ActionRole);
connect(btn1,SIGNAL(clicked()),this,SLOT(onSelectAll()));
QPushButton * btn2 = new QPushButton(tr("Clear Selections"));
buttonBox->addButton(btn2,QDialogButtonBox::ActionRole);
connect(btn2,SIGNAL(clicked()),this,SLOT(onClearSelections()));
}
else {
buttonBox = new QDialogButtonBox(QDialogButtonBox::Cancel);
}
connect(buttonBox, SIGNAL(accepted()), this, SLOT(accept()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
layout->addWidget(buttonBox);
setLayout(layout);
///
SETTINGS
settings.beginGroup("PageSets");
m_pages->readConfiguration(settings);
}