本文整理汇总了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);
}
示例2: setSortingEnabled
void ConferenceRoomView::sectionHeaderClicked(int index)
{
if (index == ConferenceRoom::COL_ACTION_MUTE) {
setSortingEnabled(false);
} else {
setSortingEnabled(true);
}
}
示例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;
}
示例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 );
}
}
示例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()));
}
示例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();
}
示例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);
}
示例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();
}
示例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 ) ) );
}
示例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 &)));
}
示例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);
}
示例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();
}
示例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);
}
示例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()));
}
示例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)));
}