当前位置: 首页>>代码示例>>C++>>正文


C++ setSortingEnabled函数代码示例

本文整理汇总了C++中setSortingEnabled函数的典型用法代码示例。如果您正苦于以下问题:C++ setSortingEnabled函数的具体用法?C++ setSortingEnabled怎么用?C++ setSortingEnabled使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了setSortingEnabled函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: QTreeWidget

FeedListWidget::FeedListWidget(QWidget *parent)
    : QTreeWidget(parent)
{
    setContextMenuPolicy(Qt::CustomContextMenu);
    setDragDropMode(QAbstractItemView::InternalMove);
    setSelectionMode(QAbstractItemView::ExtendedSelection);
    setColumnCount(1);
    headerItem()->setText(0, tr("RSS feeds"));

    connect(RSS::Session::instance(), &RSS::Session::itemAdded, this, &FeedListWidget::handleItemAdded);
    connect(RSS::Session::instance(), &RSS::Session::feedStateChanged, this, &FeedListWidget::handleFeedStateChanged);
    connect(RSS::Session::instance(), &RSS::Session::feedIconLoaded, this, &FeedListWidget::handleFeedIconLoaded);
    connect(RSS::Session::instance(), &RSS::Session::itemPathChanged, this, &FeedListWidget::handleItemPathChanged);
    connect(RSS::Session::instance(), &RSS::Session::itemAboutToBeRemoved, this, &FeedListWidget::handleItemAboutToBeRemoved);

    m_rssToTreeItemMapping[RSS::Session::instance()->rootFolder()] = invisibleRootItem();

    m_unreadStickyItem = new QTreeWidgetItem(this);
    m_unreadStickyItem->setData(0, Qt::UserRole, reinterpret_cast<quintptr>(RSS::Session::instance()->rootFolder()));
    m_unreadStickyItem->setText(0, tr("Unread  (%1)").arg(RSS::Session::instance()->rootFolder()->unreadCount()));
    m_unreadStickyItem->setData(0, Qt::DecorationRole, GuiIconProvider::instance()->getIcon("mail-folder-inbox"));

    connect(RSS::Session::instance()->rootFolder(), &RSS::Item::unreadCountChanged, this, &FeedListWidget::handleItemUnreadCountChanged);

    setSortingEnabled(false);
    fill(nullptr, RSS::Session::instance()->rootFolder());
    setSortingEnabled(true);

//    setCurrentItem(m_unreadStickyItem);
}
开发者ID:paolo-sz,项目名称:qBittorrent,代码行数:30,代码来源:feedlistwidget.cpp

示例2: setSortingEnabled

void ConferenceRoomView::sectionHeaderClicked(int index)
{
    if (index == ConferenceRoom::COL_ACTION_MUTE) {
        setSortingEnabled(false);
    } else {
        setSortingEnabled(true);
    }
}
开发者ID:namjae,项目名称:xivo-client-qt,代码行数:8,代码来源:conference_room_view.cpp

示例3: setSortingEnabled

 bool TableView::updateFileAlias(const QString& alias, const QString& filename)
 {
   setSortingEnabled(false);
   for (int i=0; i<rowCount();i++)
   {
     if (item(i,1)->text().toUpper() == filename.toUpper()) item(i,0)->setText(alias);
   }
   setSortingEnabled(true);
   return true;
 }
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:10,代码来源:TableView.cpp

示例4: currentRow

void TableWidget::insertBlankRow(){

    int ind = currentRow()+1;
    if(ind==-1){
        return;
    }
    bool enabled = isSortingEnabled();
    setSortingEnabled(false);
    int n = rowCount();
    //QList<int> inds;inds<<0<<1<<2<<5;
    QAction *action = qobject_cast<QAction *>(sender());
    ColumnType t = static_cast<ColumnType>(action->data().toInt());
    QList<int> inds;
    if(t==ORIGIN){
        inds = originCols_;
        qDebug()<<"origin columns";
    }else if(t==RESULT){
        qDebug()<<"result columns";
        inds = resultCols_;
    }else{
        QMessageBox::critical(this,"","Bug, unknown columntype in TableWidget::insertBlankRow");
        return;
    }

    for(int i=0;i<inds.size();i++){
        int col = inds[i];
        QList<TableWidgetItem*> tmp;
        for(int row=ind;row<n;row++){
            tmp << (TableWidgetItem*)takeItem( row, col );
        }
        int row = ind+1;
        for(int j=0;j<tmp.size();j++){
            if(row>=rowCount()){
                setRowCount(row+1);
                setNonEditable( row+1, row+1 );
            }
            setItem( row, col, tmp.at(j) );
            //qDebug()<<i<<j;
            row++;
        }
        //blank item
        TableWidgetItem *newItem = new TableWidgetItem;
        newItem->setFlags( newItem->flags() &= ~Qt::ItemIsEditable );
        setItem( ind, col, newItem );
    }
    setSortingEnabled(enabled);
    //nFiles=nFiles+1;

    for(int i=0;i<rowCount();i++){
        item(i,CURRENT_TITLE)->setFlags( item(i,CURRENT_TITLE)->flags() &= ~Qt::ItemIsEditable );
        item(i,CURRENT_TITLE)->setFlags( item(i,CURRENT_TITLE)->flags() &= ~Qt::ItemIsEditable );
    }

}
开发者ID:ivareske,项目名称:TagEditor,代码行数:54,代码来源:TableWidget.cpp

示例5: setSortingEnabled

void FolderView::setModel(QAbstractItemModel *model)
{
  setSortingEnabled(false);

  QTableView::setModel(model);

  //model->setReadOnly(false);
  //model->setFilter(QDir::Drives | QDir::AllDirs | QDir::NoDotAndDotDot);

  setSortingEnabled(true);

  QTimer::singleShot(200, this, SLOT(resizeToContents()));
}
开发者ID:BackupTheBerlios,项目名称:open-egov-svn,代码行数:13,代码来源:FolderView.cpp

示例6: setUpdatesEnabled

void Playlist::appendTracks( const QList<Track*> tracks )
{
    // a week attempt to speed up the setItemWidget time issue
    setUpdatesEnabled(false);
    bool doSort = isSortingEnabled();
    setSortingEnabled(false);
    hide();

    appendTracks( tracks,(PlaylistItem*)lastChild());

    setSortingEnabled(doSort);
    setUpdatesEnabled(true);
    show();
}
开发者ID:sriram1103,项目名称:knowthelist,代码行数:14,代码来源:playlist.cpp

示例7: setSortingEnabled

void MethodViewer::setObject(QObject *object) {
	const QMetaObject *metaObject = object->metaObject();

	setSortingEnabled(false);
	clear();
	for (int i = 0; i < metaObject->methodCount(); i++) {
		QMetaMethod method = metaObject->method(i);
		addTopLevelItem(new Item(object, method));
	}

	setSortingEnabled(true);
	sortByColumn(1, Qt::AscendingOrder);
	sortByColumn(0, Qt::AscendingOrder);
}
开发者ID:reihu,项目名称:QtGuiInspector,代码行数:14,代码来源:MethodViewer.cpp

示例8: setModel

void QMailTreeView::init()
{

    QMailSortFilterProxyModel::instance()->setSourceModel(QMailTreeModel::instance());
    setModel(QMailSortFilterProxyModel::instance());
    setSortingEnabled(true);
    sortByColumn(MLMCE_Date, Qt::DescendingOrder);
    m_pMailTreeViewHeader = new QMailTreeViewHeader(this);
    setHeader(m_pMailTreeViewHeader);
    connect(m_pMailTreeViewHeader, SIGNAL(refreshAccountsMailList()), this, SLOT(onRefreshAccountMails()));
    
    setItemDelegate(new QMailItemDelegate(this));
    for (int column = 0; column < QMailTreeModel::instance()->columnCount(); ++column)
        resizeColumnToContents(column);
    setColumnHidden(MLMCE_Priority, true);

    //右键菜单设置
    setContextMenuPolicy(Qt::CustomContextMenu);
    connect(this, SIGNAL(customContextMenuRequested(const QPoint &)), this, SLOT(slotCustomContextMenu(const QPoint &)));
    //支持多选 支持shift, ctrl, 鼠标框框等方式
    setSelectionMode(ExtendedSelection);
    connect(this, SIGNAL(entered(const QModelIndex &)), this, SLOT(slotEntered(const QModelIndex &)));
    //用于显示ToolTip
    setMouseTracking(true);
    expandAll();
}
开发者ID:hechengjin,项目名称:cpp,代码行数:26,代码来源:mailtreeview.cpp

示例9: QTableView

QgsAttributeTableView::QgsAttributeTableView( QWidget *parent )
    : QTableView( parent )
    , mMasterModel( NULL )
    , mFilterModel( NULL )
    , mFeatureSelectionModel( NULL )
    , mFeatureSelectionManager( NULL )
    , mModel( NULL )
    , mActionPopup( NULL )
    , mLayerCache( NULL )
    , mRowSectionAnchor( 0 )
    , mCtrlDragSelectionFlag( QItemSelectionModel::Select )
{
  QSettings settings;
  restoreGeometry( settings.value( "/BetterAttributeTable/geometry" ).toByteArray() );

  //verticalHeader()->setDefaultSectionSize( 20 );
  horizontalHeader()->setHighlightSections( false );

  mTableDelegate = new QgsAttributeTableDelegate( this );
  setItemDelegate( mTableDelegate );

  setSelectionBehavior( QAbstractItemView::SelectRows );
  setSelectionMode( QAbstractItemView::ExtendedSelection );
  setSortingEnabled( true );

  verticalHeader()->viewport()->installEventFilter( this );

  connect( verticalHeader(), SIGNAL( sectionPressed( int ) ), this, SLOT( selectRow( int ) ) );
  connect( verticalHeader(), SIGNAL( sectionEntered( int ) ), this, SLOT( _q_selectRow( int ) ) );
}
开发者ID:dakcarto,项目名称:QGIS,代码行数:30,代码来源:qgsattributetableview.cpp

示例10: QTableView

FolderView::FolderView(QWidget *parent /*=0*/)
 : QTableView(parent)
{
  setObjectName("FolderView");

  //FileSystemModel *fsm = new FileSystemModel();
  //fsm->setRootPath(path);
  //fsm->setReadOnly(false);
  //fsm->setSorting( QDir::DirsFirst | QDir::IgnoreCase );
  //setModel(fsm);

  setSortingEnabled(false);
  setShowGrid(false);
  setWordWrap(false);
  setSelectionMode(QAbstractItemView::ExtendedSelection);
  setSelectionBehavior(QAbstractItemView::SelectRows);

  verticalHeader()->hide();
  horizontalHeader()->setSortIndicator(0, Qt::AscendingOrder);
  horizontalHeader()->setSortIndicatorShown(true);
  //horizontalHeader()->setClickable(true); // not qt 5.1

  connect(this, SIGNAL(doubleClicked(const QModelIndex &)),
          this, SLOT(doubleClicked(const QModelIndex &)));
  connect(this, SIGNAL(directoryLoaded(const QString &)),
          this, SLOT(directoryLoaded(const QString &)));
}
开发者ID:BackupTheBerlios,项目名称:open-egov-svn,代码行数:27,代码来源:FolderView.cpp

示例11: setSortingEnabled

void ConfRoomView::sectionHeaderClicked(int index)
{
    int nonSortable[] = { ACTION_MUTE,
                          ACTION_TALK_TO,
                          ACTION_RECORD,
                          ACTION_ALLOW_IN,
                          ACTION_KICK };

    for(int i = 0; i < nelem(nonSortable); i++) {
        if (nonSortable[i] == index) {
            setSortingEnabled(false);
            return ;
        }
    }
    setSortingEnabled(true);
}
开发者ID:pcadottemichaud,项目名称:xivo-client-qt,代码行数:16,代码来源:confroom.cpp

示例12: QTreeView

DiveListView::DiveListView(QWidget *parent) : QTreeView(parent), mouseClickSelection(false),
	currentHeaderClicked(-1), searchBox(new QLineEdit(this))
{
	setUniformRowHeights(true);
	setItemDelegateForColumn(TreeItemDT::RATING, new StarWidgetsDelegate());
	QSortFilterProxyModel *model = new QSortFilterProxyModel(this);
	model->setSortRole(TreeItemDT::SORT_ROLE);
	model->setFilterKeyColumn(-1); // filter all columns
	setModel(model);
	connect(model, SIGNAL(layoutChanged()), this, SLOT(fixMessyQtModelBehaviour()));

	setSortingEnabled(false);
	setContextMenuPolicy(Qt::DefaultContextMenu);
	header()->setContextMenuPolicy(Qt::ActionsContextMenu);
	QAction *showSearchBox = new QAction(tr("Show Search Box"), this);
	showSearchBox->setShortcut( Qt::CTRL + Qt::Key_F);
	showSearchBox->setShortcutContext(Qt::ApplicationShortcut);
	addAction(showSearchBox);

	searchBox->installEventFilter(this);
	searchBox->hide();
	connect(showSearchBox, SIGNAL(triggered(bool)), this, SLOT(showSearchEdit()));
	connect(searchBox, SIGNAL(textChanged(QString)), model, SLOT(setFilterFixedString(QString)));
	selectedTrips.clear();
}
开发者ID:dbinoj,项目名称:subsurface,代码行数:25,代码来源:divelistview.cpp

示例13: m_model

QmlProfilerStatisticsMainView::QmlProfilerStatisticsMainView(QmlProfilerStatisticsModel *model) :
    m_model(model)
{
    setViewDefaults(this);
    setObjectName(QLatin1String("QmlProfilerEventsTable"));

    auto sortModel = new QSortFilterProxyModel(this);
    sortModel->setSourceModel(model);
    sortModel->setSortRole(SortRole);
    sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    sortModel->setFilterRole(FilterRole);
    sortModel->setFilterKeyColumn(MainType);
    sortModel->setFilterFixedString("+");

    setModel(sortModel);

    connect(this, &QAbstractItemView::activated, this, [this](const QModelIndex &index) {
        jumpToItem(index.data(TypeIdRole).toInt());
    });

    setSortingEnabled(true);
    sortByColumn(DEFAULT_SORT_COLUMN, Qt::DescendingOrder);

    setShowExtendedStatistics(m_showExtendedStatistics);
    setRootIsDecorated(false);

    resizeColumnToContents(MainLocation);
    resizeColumnToContents(MainType);
}
开发者ID:kai66673,项目名称:qt-creator,代码行数:29,代码来源:qmlprofilerstatisticsview.cpp

示例14: QTreeView

EntryView::EntryView(QWidget* parent)
    : QTreeView(parent)
    , m_model(new EntryModel(this))
    , m_sortModel(new SortFilterHideProxyModel(this))
    , m_inEntryListMode(false)
{
    m_sortModel->setSourceModel(m_model);
    m_sortModel->setDynamicSortFilter(true);
    m_sortModel->setSortLocaleAware(true);
    m_sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    m_sortModel->setSupportedDragActions(m_model->supportedDragActions());
    QTreeView::setModel(m_sortModel);

    setUniformRowHeights(true);
    setRootIsDecorated(false);
    setAlternatingRowColors(true);
    setDragEnabled(true);
    setSortingEnabled(true);
    setSelectionMode(QAbstractItemView::ExtendedSelection);

    // QAbstractItemView::startDrag() uses this property as the default drag action
    setDefaultDropAction(Qt::MoveAction);

    connect(this, SIGNAL(doubleClicked(QModelIndex)), SLOT(emitEntryActivated(QModelIndex)));
    connect(selectionModel(), SIGNAL(selectionChanged(QItemSelection,QItemSelection)), SIGNAL(entrySelectionChanged()));
    connect(m_model, SIGNAL(switchedToEntryListMode()), SLOT(switchToEntryListMode()));
    connect(m_model, SIGNAL(switchedToGroupMode()), SLOT(switchToGroupMode()));
}
开发者ID:afontenot,项目名称:keepassx,代码行数:28,代码来源:EntryView.cpp

示例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)));
}
开发者ID:MaximilienMartin,项目名称:brewtarget,代码行数:28,代码来源:BtTreeView.cpp


注:本文中的setSortingEnabled函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。