本文整理汇总了C++中QSortFilterProxyModel::setDynamicSortFilter方法的典型用法代码示例。如果您正苦于以下问题:C++ QSortFilterProxyModel::setDynamicSortFilter方法的具体用法?C++ QSortFilterProxyModel::setDynamicSortFilter怎么用?C++ QSortFilterProxyModel::setDynamicSortFilter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSortFilterProxyModel
的用法示例。
在下文中一共展示了QSortFilterProxyModel::setDynamicSortFilter方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SearchLineController
ConnectionsTab::ConnectionsTab(PropertyWidget *parent)
: QWidget(parent)
, ui(new Ui::ConnectionsTab)
{
m_interface = ObjectBroker::object<ConnectionsExtensionInterface *>(
parent->objectBaseName() + ".connectionsExtension");
ui->setupUi(this);
ui->inboundView->header()->setObjectName("inboundViewHeader");
ui->outboundView->header()->setObjectName("outboundViewHeader");
QSortFilterProxyModel *proxy = new ConnectionsClientProxyModel(this);
proxy->setDynamicSortFilter(true);
proxy->setSourceModel(ObjectBroker::model(parent->objectBaseName() + ".inboundConnections"));
ui->inboundView->setModel(proxy);
ui->inboundView->sortByColumn(0, Qt::AscendingOrder);
new SearchLineController(ui->inboundSearchLine, proxy);
connect(ui->inboundView, SIGNAL(customContextMenuRequested(QPoint)),
SLOT(inboundContextMenu(QPoint)));
proxy = new ConnectionsClientProxyModel(this);
proxy->setDynamicSortFilter(true);
proxy->setSourceModel(ObjectBroker::model(parent->objectBaseName() + ".outboundConnections"));
ui->outboundView->setModel(proxy);
ui->outboundView->sortByColumn(0, Qt::AscendingOrder);
new SearchLineController(ui->outboundSearchLine, proxy);
connect(ui->outboundView, SIGNAL(customContextMenuRequested(QPoint)),
SLOT(outboundContextMenu(QPoint)));
}
示例2: setObjectBaseName
void MethodsTab::setObjectBaseName(const QString &baseName)
{
m_objectBaseName = baseName;
auto clientModel = new ClientMethodModel(this);
clientModel->setSourceModel(ObjectBroker::model(baseName + '.' + "methods"));
QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
proxy->setDynamicSortFilter(true);
proxy->setSourceModel(clientModel);
proxy->setSortCaseSensitivity(Qt::CaseInsensitive);
proxy->setSortRole(ObjectMethodModelRole::MethodSortRole);
m_ui->methodView->setModel(proxy);
m_ui->methodView->sortByColumn(0, Qt::AscendingOrder);
m_ui->methodView->setSelectionModel(ObjectBroker::selectionModel(proxy));
m_ui->methodView->header()->setResizeMode(QHeaderView::ResizeToContents);
new SearchLineController(m_ui->methodSearchLine, proxy);
connect(m_ui->methodView, SIGNAL(doubleClicked(QModelIndex)),
SLOT(methodActivated(QModelIndex)));
connect(m_ui->methodView, SIGNAL(customContextMenuRequested(QPoint)),
SLOT(methodContextMenu(QPoint)));
m_ui->methodLog->setModel(ObjectBroker::model(baseName + '.' + "methodLog"));
m_interface = ObjectBroker::object<MethodsExtensionInterface *>(baseName + ".methodsExtension");
new PropertyBinder(m_interface, "hasObject", m_ui->methodLog, "visible");
}
示例3: QuickItemTreeWatcher
QuickInspectorWidget::QuickInspectorWidget(QWidget* parent) :
QWidget(parent),
ui(new Ui::QuickInspectorWidget)
{
ObjectBroker::registerClientObjectFactoryCallback<QuickInspectorInterface*>(createQuickInspectorClient);
m_interface = ObjectBroker::object<QuickInspectorInterface*>();
connect(m_interface, SIGNAL(sceneRendered(QImage)), this, SLOT(sceneRendered(QImage)));
ui->setupUi(this);
ui->windowComboBox->setModel(ObjectBroker::model("com.kdab.GammaRay.QuickWindowModel"));
connect(ui->windowComboBox, SIGNAL(currentIndexChanged(int)), m_interface, SLOT(selectWindow(int)));
if (ui->windowComboBox->currentIndex() >= 0)
m_interface->selectWindow(ui->windowComboBox->currentIndex());
QSortFilterProxyModel *proxy = new QuickClientItemModel(this);
proxy->setSourceModel(ObjectBroker::model("com.kdab.GammaRay.QuickItemModel"));
proxy->setDynamicSortFilter(true);
ui->itemTreeView->setModel(proxy);
ui->itemTreeSearchLine->setProxy(proxy);
QItemSelectionModel* selectionModel = ObjectBroker::selectionModel(proxy);
ui->itemTreeView->setSelectionModel(selectionModel);
connect(selectionModel, SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
this, SLOT(itemSelectionChanged(QItemSelection)));
new QuickItemTreeWatcher(ui->itemTreeView);
new DeferredResizeModeSetter(ui->itemTreeView->header(), 0, QHeaderView::ResizeToContents);
ui->itemPropertyWidget->setObjectBaseName("com.kdab.GammaRay.QuickItem");
m_sceneImage = new QLabel;
ui->sceneView->setWidget(m_sceneImage);
ui->sceneView->setBackgroundRole(QPalette::Dark);
}
示例4: QWidget
GraphViewer::GraphViewer(ProbeInterface *probe, QWidget *parent)
: QWidget(parent),
mWidget(new GraphWidget(this)),
mProbeIface(probe)
{
QSortFilterProxyModel *objectFilter = new KRecursiveFilterProxyModel(this);
objectFilter->setSourceModel(probe->objectTreeModel());
objectFilter->setDynamicSortFilter(true);
QVBoxLayout *vbox = new QVBoxLayout;
KFilterProxySearchLine *objectSearchLine = new KFilterProxySearchLine(this);
objectSearchLine->setProxy(objectFilter);
vbox->addWidget(objectSearchLine);
QTreeView *objectTreeView = new QTreeView(this);
objectTreeView->setModel(objectFilter);
objectTreeView->setSortingEnabled(true);
vbox->addWidget(objectTreeView);
connect(objectTreeView->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)),
SLOT(handleRowChanged(QModelIndex)));
mObjectTreeView = objectTreeView;
QWidget *treeViewWidget = new QWidget(this);
treeViewWidget->setLayout(vbox);
QSplitter *splitter = new QSplitter(this);
splitter->addWidget(treeViewWidget);
splitter->addWidget(mWidget);
QHBoxLayout *hbox = new QHBoxLayout(this);
hbox->addWidget(splitter);
QMetaObject::invokeMethod(this, "delayedInit", Qt::QueuedConnection);
}
示例5: QWidget
NoteBrowser::NoteBrowser(QWidget* parent, Qt::WindowFlags f): QWidget(parent, f)
{
m_model = new NotesModel( this );
QSortFilterProxyModel * sortingModel = new QSortFilterProxyModel( this );
sortingModel->setSourceModel( m_model );
sortingModel->setSortRole( m_model->roleForProperty( NAO::created() ) );
sortingModel->setDynamicSortFilter( true );
sortingModel->sort( 0, Qt::DescendingOrder );
m_view = new NotesView( this );
m_view->setModel( sortingModel );
connect( m_view, SIGNAL(doubleClicked(QModelIndex)),
this, SLOT(slotNoteSelected(QModelIndex)) );
Nepomuk2::Query::ResourceTypeTerm typeTerm( Nepomuk2::Types::Class( PIMO::Note() ) );
Nepomuk2::Query::ComparisonTerm compTerm( NAO::created(), Nepomuk2::Query::Term() );
compTerm.setSortWeight( 1, Qt::DescendingOrder );
m_query = typeTerm && compTerm;
//FIXME: Figure out why this stupid layout is required!
QHBoxLayout* layout = new QHBoxLayout( this );
layout->setMargin( 0 );
layout->setSpacing( 0 );
layout->addWidget( m_view );
}
示例6: QTableView
FeatureTable::FeatureTable(FeatureClass* pFeatureClass, GraphicLayer* pFeatureLayer, QWidget* pParent) :
QTableView(pParent),
mpFeatureLayer(pFeatureLayer)
{
setContextMenuPolicy(Qt::CustomContextMenu);
// Allow multiple uncontiguous selections.
setSelectionBehavior(QAbstractItemView::SelectRows);
setSelectionMode(QAbstractItemView::ExtendedSelection);
// Alphanumerically sort string types.
setSortingEnabled(true);
QSortFilterProxyModel* pProxyModel = new AlphaNumericSortFilterProxyModel();
pProxyModel->setSourceModel(pFeatureClass);
pProxyModel->setDynamicSortFilter(true);
setModel(pProxyModel);
// Want to select rows in the table, when features are selected from the view's layer.
mpFeatureLayer.addSignal(SIGNAL_NAME(GraphicLayer, ObjectsSelected), Slot(this, &FeatureTable::selectRows));
// Want to select graphic objects in the view, when rows are selected in the table.
// However do not want the above connection to be utilized when the graphic objects are selected, so instead of
// overriding the selectionChanged method, a new slot is introduced which will prevent any duplicate graphic object
// selection/deselection.
if (selectionModel() != NULL)
{
VERIFYNR(connect(selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)), this,
SLOT(selectGraphicObjects(const QItemSelection&, const QItemSelection&))));
}
示例7: QWidget
ActionInspectorWidget::ActionInspectorWidget(QWidget *parent)
: QWidget(parent)
{
QAbstractItemModel *actionModel = ObjectBroker::model("com.kdab.GammaRay.ActionModel");
QSortFilterProxyModel *searchFilterProxy = new KRecursiveFilterProxyModel(this);
searchFilterProxy->setSourceModel(actionModel);
searchFilterProxy->setDynamicSortFilter(true);
m_proxy = searchFilterProxy;
QVBoxLayout *vbox = new QVBoxLayout(this);
KFilterProxySearchLine *objectSearchLine = new KFilterProxySearchLine(this);
objectSearchLine->setProxy(searchFilterProxy);
vbox->addWidget(objectSearchLine);
QTreeView *objectTreeView = new QTreeView(this);
objectTreeView->setModel(searchFilterProxy);
objectTreeView->setSortingEnabled(true);
objectTreeView->sortByColumn(ActionModel::ShortcutsPropColumn);
objectTreeView->setRootIsDecorated(false);
vbox->addWidget(objectTreeView);
connect(objectTreeView, SIGNAL(doubleClicked(QModelIndex)), SLOT(triggerAction(QModelIndex)));
mObjectTreeView = objectTreeView;
}
示例8: setModel
void ModelDescriptorListWidget::setModel(QAbstractItemModel *model)
{
QSortFilterProxyModel *proxyModel = qobject_cast<QSortFilterProxyModel *>(QTreeView::model());
proxyModel->setSourceModel(model);
proxyModel->setDynamicSortFilter(true);
expandAll();
}
示例9: run_ui
void run_ui()
{
qmlRegisterType<QMLManager>("org.subsurfacedivelog.mobile", 1, 0, "QMLManager");
qmlRegisterType<QMLProfile>("org.subsurfacedivelog.mobile", 1, 0, "QMLProfile");
QQmlApplicationEngine engine;
engine.addImportPath("qrc://imports");
DiveListModel diveListModel;
QSortFilterProxyModel *sortModel = new QSortFilterProxyModel(0);
sortModel->setSourceModel(&diveListModel);
sortModel->setDynamicSortFilter(true);
sortModel->setSortRole(DiveListModel::DiveDateRole);
sortModel->sort(0, Qt::DescendingOrder);
QQmlContext *ctxt = engine.rootContext();
ctxt->setContextProperty("diveModel", sortModel);
engine.load(QUrl(QStringLiteral("qrc:///qml/main.qml")));
qqWindowObject = engine.rootObjects().value(0);
if (!qqWindowObject) {
fprintf(stderr, "can't create window object\n");
exit(1);
}
QQuickWindow *qml_window = qobject_cast<QQuickWindow *>(qqWindowObject);
qml_window->setIcon(QIcon(":/subsurface-mobile-icon"));
qqWindowObject->setProperty("messageText", QVariant("Subsurface mobile startup"));
#if !defined(Q_OS_ANDROID)
qml_window->setHeight(1200);
qml_window->setWidth(800);
#endif
qml_window->show();
qApp->exec();
}
示例10: KDialog
CopyInputDialog::CopyInputDialog(QWidget* parent)
: KDialog(parent)
{
setCaption(i18n("Copy Input"));
setButtons(KDialog::Ok | KDialog::Cancel);
setWindowModality(Qt::WindowModal);
_ui = new Ui::CopyInputDialog();
_ui->setupUi(mainWidget());
connect(_ui->selectAllButton, SIGNAL(clicked()), this, SLOT(selectAll()));
connect(_ui->deselectAllButton, SIGNAL(clicked()), this, SLOT(deselectAll()));
_ui->filterEdit->setClearButtonShown(true);
_ui->filterEdit->setFocus();
_model = new CheckableSessionModel(parent);
_model->setCheckColumn(1);
_model->setSessions(SessionManager::instance()->sessions());
QSortFilterProxyModel* filterProxyModel = new QSortFilterProxyModel(this);
filterProxyModel->setDynamicSortFilter(true);
filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
filterProxyModel->setSourceModel(_model);
filterProxyModel->setFilterKeyColumn(-1);
connect(_ui->filterEdit, SIGNAL(textChanged(QString)),
filterProxyModel, SLOT(setFilterFixedString(QString)));
_ui->sessionList->setModel(filterProxyModel);
_ui->sessionList->setColumnHidden(0, true); // Hide number column
_ui->sessionList->header()->hide();
}
示例11: QSortFilterProxyModel
UProcessView::UProcessView(QWidget *parent /*= 0*/)
:QTableView(parent)
,killProcessAction_(0)
,selectColumnAction_(0)
{
//设置Model。
QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
UProcessModel *processModel = new UProcessModel(this);
connect(this,SIGNAL(processTerminated(unsigned int)),processModel,SLOT(refresh()));
proxyModel->setSourceModel(processModel);
proxyModel->setDynamicSortFilter(true);
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
setModel(proxyModel);
setSortingEnabled(true);
setSelectionBehavior(QAbstractItemView::SelectRows);
horizontalHeader()->setStretchLastSection(true);
verticalHeader()->hide();
setSelectionMode(QAbstractItemView::SingleSelection);
setContextMenuPolicy(Qt::ActionsContextMenu);
setupActions();
setupConnections();
}
示例12: QWidget
GraphViewerWidget::GraphViewerWidget(QWidget *parent)
: QWidget(parent),
mWidget(new GraphWidget(this))
{
mModel = ObjectBroker::model("com.kdab.GammaRay.ObjectVisualizerModel");
QSortFilterProxyModel *objectFilter = new KRecursiveFilterProxyModel(this);
objectFilter->setSourceModel(mModel);
objectFilter->setDynamicSortFilter(true);
QVBoxLayout *vbox = new QVBoxLayout;
KFilterProxySearchLine *objectSearchLine = new KFilterProxySearchLine(this);
objectSearchLine->setProxy(objectFilter);
vbox->addWidget(objectSearchLine);
QTreeView *objectTreeView = new QTreeView(this);
objectTreeView->setModel(objectFilter);
objectTreeView->setSortingEnabled(true);
vbox->addWidget(objectTreeView);
mObjectTreeView = objectTreeView;
QWidget *treeViewWidget = new QWidget(this);
treeViewWidget->setLayout(vbox);
QSplitter *splitter = new QSplitter(this);
splitter->addWidget(treeViewWidget);
splitter->addWidget(mWidget);
QHBoxLayout *hbox = new QHBoxLayout(this);
hbox->addWidget(splitter);
QMetaObject::invokeMethod(this, "delayedInit", Qt::QueuedConnection);
}
示例13: main
int main(int argc, char *argv[])
{
qmlRegisterType<Recorder>("harbour.recorder", 1, 0, "Recorder");
qmlRegisterType<DirectoryModel>("harbour.recorder", 1, 0, "DirectoryModel");
auto app = SailfishApp::application(argc, argv);
QCoreApplication::setOrganizationName("harbour-recorder");
QCoreApplication::setOrganizationDomain("www.corne.info");
QCoreApplication::setApplicationName("Recorder");
auto view = SailfishApp::createView();
auto context = view->rootContext();
Recorder recorder;
context->setContextProperty("recorder", &recorder);
RecordingsModel sourceModel;
sourceModel.setRecorder(&recorder);
QSortFilterProxyModel recordingsModel;
recordingsModel.setSourceModel(&sourceModel);
recordingsModel.setSortRole(RecordingsModel::Modified);
recordingsModel.setDynamicSortFilter(true);
recordingsModel.sort(0, Qt::DescendingOrder);
context->setContextProperty("recordingsModel", &recordingsModel);
view->setSource(SailfishApp::pathTo("qml/harbour-recorder.qml"));
view->show();
return app->exec();
}
示例14: model
EngineListView::EngineListView( GLWidget *glWidget, QWidget *parent ) : QListView(parent), d(new EngineListViewPrivate)
{
d->glWidget = glWidget;
EngineItemModel *m = new EngineItemModel(d->glWidget, this);
if(model())
{
delete model();
}
// This should sort the engine names for user views
// It should also update dynamically as people edit names
// Somehow it doesn't work right from the start!
QSortFilterProxyModel *sortModel = new QSortFilterProxyModel(this);
sortModel->setSourceModel(m);
setModel(sortModel);
sortModel->setSortCaseSensitivity(Qt::CaseInsensitive);
sortModel->setSortLocaleAware(true);
sortModel->setDynamicSortFilter(true);
sortModel->sort(0, Qt::AscendingOrder);
connect(this, SIGNAL(clicked(QModelIndex)),
this, SLOT(selectEngine(QModelIndex)));
// This might work for having the proxy model emit the signal, but let's keep it as-is
connect(m, SIGNAL(dataChanged(QModelIndex, QModelIndex)),
glWidget, SLOT(update()));
// improves display performance
setUniformItemSizes(true);
setAlternatingRowColors(true); // looks better
}
示例15: QComboBox
/** Constructor */
GxsIdChooser::GxsIdChooser(QWidget *parent)
: QComboBox(parent), mFlags(IDCHOOSER_ANON_DEFAULT)
{
mBase = new RsGxsUpdateBroadcastBase(rsIdentity, this);
connect(mBase, SIGNAL(fillDisplay(bool)), this, SLOT(fillDisplay(bool)));
/* Initialize ui */
setSizeAdjustPolicy(QComboBox::AdjustToContents);
mFirstLoad = true;
mAllowedCount = 0 ;
mDefaultId.clear() ;
/* Enable sort with own role */
QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
proxy->setSourceModel(model());
proxy->setDynamicSortFilter(false);
model()->setParent(proxy);
setModel(proxy);
proxy->setSortRole(ROLE_SORT);
/* Connect signals */
connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(myCurrentIndexChanged(int)));
connect(this, SIGNAL(activated(int)), this, SLOT(indexActivated(int)));
}