本文整理汇总了C++中resizeColumnToContents函数的典型用法代码示例。如果您正苦于以下问题:C++ resizeColumnToContents函数的具体用法?C++ resizeColumnToContents怎么用?C++ resizeColumnToContents使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了resizeColumnToContents函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: resizeColumnToContents
void StackTreeView::setModel(QAbstractItemModel *model)
{
BaseTreeView::setModel(model);
resizeColumnToContents(StackLevelColumn);
resizeColumnToContents(StackLineNumberColumn);
showAddressColumn(action(UseAddressInStackView)->isChecked());
}
示例2: resizeColumnToContents
void KFindTreeView::resizeToContents()
{
resizeColumnToContents( 0 );
resizeColumnToContents( 1 );
resizeColumnToContents( 2 );
resizeColumnToContents( 3 );
}
示例3: topLevelItem
void ArchiveList::updateArchives(QList<Archive *> archivesOrig)
{
QSet<QString> expandedLanguages;
QSet<QString> knownLanguages;
QSet<ArchiveID> expandedItems;
for (int i = 0; i < topLevelItemCount(); i ++) {
QTreeWidgetItem *langItem = topLevelItem(i);
const QString &lang = langItem->text(0);
if (langItem->isExpanded())
expandedLanguages += lang;
knownLanguages += lang;
for (int j = 0; j < langItem->childCount(); j ++) {
QTreeWidgetItem *dateItem = langItem->child(j);
if (dateItem->isExpanded())
expandedItems += ArchiveID(lang, dateItem->text(0));
}
}
clear();
QList<Archive *> archives(archivesOrig);
qSort(archives.begin(), archives.end(), Archive::comparePointers);
QTreeWidgetItem *topItem(0);
QString lastLanguage;
foreach (Archive *a, archives) {
if (lastLanguage != a->getLanguage() || a->getLanguage().isEmpty()) {
lastLanguage = a->getLanguage();
topItem = new QTreeWidgetItem(this, QStringList() << lastLanguage);
addTopLevelItem(topItem);
if (expandedLanguages.contains(lastLanguage))
topItem->setExpanded(true);
}
QTreeWidgetItem *item = new QTreeWidgetItem(topItem);
item->setText(0, a->getDate());
if (expandedItems.contains(a->getID()))
item->setExpanded(true);
if (qobject_cast<DownloadableArchive *>(a)) {
fillDownloadableArchiveItem(static_cast<DownloadableArchive *>(a), item);
} else if (qobject_cast<PartialArchive *>(a)) {
if (!knownLanguages.contains(a->getLanguage()))
topItem->setExpanded(true);
fillPartialArchiveItem(static_cast<PartialArchive *>(a), item);
} else if (qobject_cast<LocalArchive *>(a)) {
if (!knownLanguages.contains(a->getLanguage()))
topItem->setExpanded(true);
fillLocalArchiveItem(static_cast<LocalArchive *>(a), item);
}
}
resizeColumnToContents(0);
resizeColumnToContents(1);
resizeColumnToContents(2);
resizeColumnToContents(3);
}
示例4: resizeColumnToContents
void ThreadsWindow::setModel(QAbstractItemModel *model)
{
BaseWindow::setModel(model);
resizeColumnToContents(ThreadData::IdColumn);
resizeColumnToContents(ThreadData::LineColumn);
resizeColumnToContents(ThreadData::NameColumn);
resizeColumnToContents(ThreadData::StateColumn);
resizeColumnToContents(ThreadData::TargetIdColumn);
}
示例5: setItemExpanded
void ScTreeWidget::handleMousePress(QTreeWidgetItem *item)
{
if (item == 0)
return;
if (item->parent() == 0)
{
if (item->isDisabled())
{
setItemExpanded(item, false);
return;
}
int wide = 0;
int tops = topLevelItemCount();
if (m_toolbox_mode)
{
for (int t = 0; t < tops; t++)
{
setItemExpanded(topLevelItem(t), false);
}
setCurrentItem(item);
setItemExpanded(item, true);
if (item->childCount() != 0)
{
QTreeWidgetItem *child = item->child(0);
if (child != 0)
wide = itemWidget(child, 0)->minimumSizeHint().width()+5;
}
if (wide != 0)
setColumnWidth(0, wide);
else
resizeColumnToContents(0);
}
else
{
setItemExpanded(item, !isItemExpanded(item));
for (int t = 0; t < tops; t++)
{
QTreeWidgetItem *top = topLevelItem(t);
if (isItemExpanded(top))
{
if (top->childCount() != 0)
{
QTreeWidgetItem *child = top->child(0);
if (child != 0)
wide = qMax(wide, itemWidget(child, 0)->minimumSizeHint().width()+5);
}
}
}
}
if (wide != 0)
setColumnWidth(0, wide);
else
resizeColumnToContents(0);
emit currentChanged2(indexOfTopLevelItem(item));
}
}
示例6: resizeColumnToContents
void CommitTableWidget::refresh()
// ----------------------------------------------------------------------------
// Reload the commit history from the model
// ----------------------------------------------------------------------------
{
table->refresh();
resizeColumnToContents(0); // ID
resizeColumnToContents(1); // Date
resizeColumnToContents(2); // Author
}
示例7: selectionModel
void PipelineTreeWidget::update(const std::vector<DataContainer*>& dataContainers, const std::vector<AbstractPipeline*>& pipelines) {
// clear selection before setting the new data or we will encounter random crashes...
selectionModel()->clear();
_treeModel->setData(dataContainers, pipelines);
expandAll();
resizeColumnToContents(0);
resizeColumnToContents(1);
resizeColumnToContents(2);
// The widget's size hint might have changed, notify the layout
updateGeometry();
}
示例8: setModel
/* TODO This looses the current expanded tree's.
* Needs to update the model rahter than replace it.
*/
void XmlTree::update ( const KMimeType::Ptr mime, const QDomDocument& doc ) {
setModel ( 0 );
if ( m_treeModel )
delete m_treeModel;
if ( mime->is ( "application/xsd" ) )
m_treeModel = new XsdDocumentModel();
else
m_treeModel = new XmlDocumentModel();
m_treeModel->update ( doc );
setModel ( m_treeModel );
expandToDepth ( 0 );
resizeColumnToContents ( 0 );
resizeColumnToContents ( 1 );
}
示例9: qDebug
void TransferListWidget::hidePriorityColumn(bool hide)
{
qDebug("hidePriorityColumn(%d)", hide);
setColumnHidden(TorrentModel::TR_PRIORITY, hide);
if (!hide && !columnWidth(TorrentModel::TR_PRIORITY))
resizeColumnToContents(TorrentModel::TR_PRIORITY);
}
示例10: QTreeWidget
InterfaceTree::InterfaceTree(QWidget *parent) :
QTreeWidget(parent)
#ifdef HAVE_LIBPCAP
,stat_cache_(NULL)
,stat_timer_(NULL)
#endif // HAVE_LIBPCAP
{
QTreeWidgetItem *ti;
qRegisterMetaType< PointList >("PointList");
header()->setVisible(false);
setRootIsDecorated(false);
setUniformRowHeights(true);
/* Seems to have no effect, still the default value (2) is being used, as it
* was set in the .ui file. But better safe, then sorry. */
resetColumnCount();
setSelectionMode(QAbstractItemView::ExtendedSelection);
setAccessibleName(tr("Welcome screen list"));
setItemDelegateForColumn(IFTREE_COL_STATS, new SparkLineDelegate(this));
setDisabled(true);
ti = new QTreeWidgetItem();
ti->setText(IFTREE_COL_NAME, tr("Waiting for startup%1").arg(UTF8_HORIZONTAL_ELLIPSIS));
addTopLevelItem(ti);
resizeColumnToContents(IFTREE_COL_NAME);
connect(wsApp, SIGNAL(appInitialized()), this, SLOT(getInterfaceList()));
connect(wsApp, SIGNAL(localInterfaceListChanged()), this, SLOT(interfaceListChanged()));
connect(this, SIGNAL(itemSelectionChanged()), this, SLOT(updateSelectedInterfaces()));
}
示例11: qMax
void NavigableTableView::resizeTableRows() {
if (!model())
return;
int top = qMax(0, verticalHeader()->visualIndexAt(0));
int bottom = verticalHeader()->visualIndexAt(viewport()->height());
if (bottom == -1 || (bottom+10) >= model()->rowCount()) {
bottom = model()->rowCount() - 1;
}
else {
bottom += 10;
}
int left = qMax(0, horizontalHeader()->visualIndexAt(0));
int right = horizontalHeader()->visualIndexAt(viewport()->width());
if (right < 0) right = model()->columnCount();
for (int i = top ; i <= bottom ; ++i)
resizeRowToContents(i);
for (int i = left ; i <= right ; ++i)
resizeColumnToContents(i);
}
示例12: resizeColumnToContents
void UnspentTxOutView::update()
{
QTreeView::update();
for (int i = 0; i < model->columnCount(); i++) {
resizeColumnToContents(i);
}
}
示例13: resizeColumnToContents
void MovableTableWidget::resizeColumnsToContents()
{
for (int i = 0; i < columnCount(); ++i)
{
resizeColumnToContents(i);
}
}
示例14: QTreeWidget
QTreeWidget *ConnectionPropertiesPanel::makePortListWidget(QWidget *parent, const GraphConnectionEndpoint &ep, std::map<QTreeWidgetItem *, QString> &itemToKey)
{
//create list widget
auto listWidget = new QTreeWidget(parent);
listWidget->setColumnCount(1);
listWidget->setHeaderLabels(QStringList(QString("%1[%2]").arg(ep.getObj()->getId(), ep.getKey().id)));
//query the signal/slot ports
QStringList portKeys;
auto block = dynamic_cast<GraphBlock *>(ep.getObj().data());
if (block != nullptr) switch(ep.getConnectableAttrs().direction)
{
case GRAPH_CONN_SLOT: portKeys = block->getSlotPorts(); break;
case GRAPH_CONN_SIGNAL: portKeys = block->getSignalPorts(); break;
default: break;
}
//populate
if (portKeys.empty())
{
auto item = new QTreeWidgetItem(listWidget, QStringList(_conn->getKeyName(ep.getKey().id, ep)));
itemToKey[item] = ep.getKey().id;
listWidget->addTopLevelItem(item);
}
else for (const auto &portKey : portKeys)
{
auto item = new QTreeWidgetItem(listWidget, QStringList(_conn->getKeyName(portKey, ep)));
itemToKey[item] = portKey;
listWidget->addTopLevelItem(item);
}
listWidget->resizeColumnToContents(0);
//return new widget
return listWidget;
}
示例15: QTreeView
BtTreeView::BtTreeView(QWidget *parent, BtTreeModel::TypeMasks type) :
QTreeView(parent)
{
// Set some global properties that all the kids will use.
setAllColumnsShowFocus(true);
setContextMenuPolicy(Qt::CustomContextMenu);
setRootIsDecorated(false);
setDragEnabled(true);
setAcceptDrops(true);
setDropIndicatorShown(true);
setSelectionMode(QAbstractItemView::ExtendedSelection);
_type = type;
_model = new BtTreeModel(this, _type);
filter = new BtTreeFilterProxyModel(this, _type);
filter->setSourceModel(_model);
setModel(filter);
filter->setDynamicSortFilter(true);
setExpanded(findElement(0), true);
setSortingEnabled(true);
sortByColumn(0,Qt::AscendingOrder);
resizeColumnToContents(0);
// and one wee connection
connect( _model, SIGNAL(expandFolder(BtTreeModel::TypeMasks, QModelIndex)), this, SLOT(expandFolder(BtTreeModel::TypeMasks, QModelIndex)));
}