Пример #1
0
bool WidgetBoxTreeWidget::loadContents(const QString &contents)
{
    QString errorMessage;
    CategoryList cat_list;
    if (!readCategories(m_file_name, contents, &cat_list, &errorMessage)) {
        qdesigner_internal::designerWarning(errorMessage);
        return false;
    }

    foreach(const Category &cat, cat_list)
        addCategory(cat);

    addCustomCategories(false);
    // Restore which items are expanded
    restoreExpandedState();
    return true;
}
Пример #2
0
void BookmarksTreeView::setViewType(BookmarksTreeView::ViewType type)
{
    m_type = type;

    switch (m_type) {
    case BookmarksManagerViewType:
        setColumnHidden(1, false);
        setHeaderHidden(false);
        setMouseTracking(false);
        setSelectionMode(QAbstractItemView::ExtendedSelection);
        break;
    case BookmarksSidebarViewType:
        setColumnHidden(1, true);
        setHeaderHidden(true);
        setMouseTracking(true);
        setSelectionMode(QAbstractItemView::SingleSelection);
        break;
    default:
        break;
    }

    restoreExpandedState(QModelIndex());
}