本文整理汇总了C++中TreeModel::columnCount方法的典型用法代码示例。如果您正苦于以下问题:C++ TreeModel::columnCount方法的具体用法?C++ TreeModel::columnCount怎么用?C++ TreeModel::columnCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TreeModel
的用法示例。
在下文中一共展示了TreeModel::columnCount方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: file
MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
{
setupUi(this);
QStringList headers;
headers << tr("Title") << tr("Description");
QFile file(":/default.txt");
file.open(QIODevice::ReadOnly);
TreeModel *model = new TreeModel(headers, file.readAll());
file.close();
view->setModel(model);
for (int column = 0; column < model->columnCount(); ++column)
view->resizeColumnToContents(column);
connect(exitAction, SIGNAL(triggered()), qApp, SLOT(quit()));
connect(view->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection &,
const QItemSelection &)),
this, SLOT(updateActions()));
connect(actionsMenu, SIGNAL(aboutToShow()), this, SLOT(updateActions()));
connect(insertRowAction, SIGNAL(triggered()), this, SLOT(insertRow()));
connect(insertColumnAction, SIGNAL(triggered()), this, SLOT(insertColumn()));
connect(removeRowAction, SIGNAL(triggered()), this, SLOT(removeRow()));
connect(removeColumnAction, SIGNAL(triggered()), this, SLOT(removeColumn()));
connect(insertChildAction, SIGNAL(triggered()), this, SLOT(insertChild()));
updateActions();
}
示例2: QDialog
MetaEditor::MetaEditor(QWidget *parent)
: QDialog(parent),
m_mainWindow(qobject_cast<MainWindow *>(parent)),
m_Relator(MarcRelators::instance()),
m_RemoveRow(new QShortcut(QKeySequence(Qt::ControlModifier + Qt::Key_Delete),this, 0, 0, Qt::WidgetWithChildrenShortcut))
{
setupUi(this);
m_book = m_mainWindow->GetCurrentBook();
m_version = m_book->GetConstOPF()->GetEpubVersion();
m_opfdata = m_book->GetOPF()->GetText();
QStringList headers;
headers << tr("Name") << tr("Value");
QString data = GetOPFMetadata();
TreeModel *model = new TreeModel(headers, data);
view->setModel(model);
for (int column = 0; column < model->columnCount(); ++column)
view->resizeColumnToContents(column);
if (!isVisible()) {
ReadSettings();
}
if (m_version.startsWith('3')) {
loadMetadataElements();
loadMetadataProperties();
} else {
loadE2MetadataElements();
loadE2MetadataProperties();
}
connect(view->selectionModel(),
SIGNAL(selectionChanged(const QItemSelection &,
const QItemSelection &)),
this, SLOT(updateActions()));
connect(delButton, SIGNAL(clicked()), this, SLOT(removeRow()));
connect(tbMoveUp, SIGNAL(clicked()), this, SLOT(moveRowUp()));
connect(tbMoveDown, SIGNAL(clicked()), this, SLOT(moveRowDown()));
connect(m_RemoveRow, SIGNAL(activated()), this, SLOT(removeRow()));
if (m_version.startsWith('3')) {
connect(addMetaButton, SIGNAL(clicked()), this, SLOT(selectElement()));
connect(addPropButton, SIGNAL(clicked()), this, SLOT(selectProperty()));
} else {
connect(addMetaButton, SIGNAL(clicked()), this, SLOT(selectE2Element()));
connect(addPropButton, SIGNAL(clicked()), this, SLOT(selectE2Property()));
}
connect(buttonBox, SIGNAL(accepted()), this, SLOT(saveData()));
connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));
updateActions();
}