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


C++ QSortFilterProxyModel::setDynamicSortFilter方法代码示例

本文整理汇总了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)));
}
开发者ID:giucam,项目名称:GammaRay,代码行数:29,代码来源:connectionstab.cpp

示例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");
}
开发者ID:rafaelroquetto,项目名称:GammaRay,代码行数:26,代码来源:methodstab.cpp

示例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);
}
开发者ID:taehun32,项目名称:GammaRay,代码行数:34,代码来源:quickinspectorwidget.cpp

示例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);
}
开发者ID:frankosterfeld,项目名称:GammaRay,代码行数:32,代码来源:objectvisualizer.cpp

示例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 );
}
开发者ID:KDE,项目名称:notably,代码行数:29,代码来源:notebrowser.cpp

示例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&))));
   }
开发者ID:Tom-VdE,项目名称:opticks,代码行数:29,代码来源:FeatureTable.cpp

示例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;
}
开发者ID:pangpangpang3,项目名称:GammaRay,代码行数:25,代码来源:actioninspectorwidget.cpp

示例8: setModel

void ModelDescriptorListWidget::setModel(QAbstractItemModel *model)
{
    QSortFilterProxyModel *proxyModel = qobject_cast<QSortFilterProxyModel *>(QTreeView::model());
    proxyModel->setSourceModel(model);
    proxyModel->setDynamicSortFilter(true);
    expandAll();
}
开发者ID:OpenSpeedShop,项目名称:gui,代码行数:7,代码来源:ModelDescriptorListWidget.cpp

示例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();
}
开发者ID:getevlcted,项目名称:subsurface,代码行数:30,代码来源:subsurface-mobile-helper.cpp

示例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();
}
开发者ID:nborkowska,项目名称:konsole,代码行数:34,代码来源:CopyInputDialog.cpp

示例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();
}
开发者ID:gauldoth,项目名称:UniCore,代码行数:26,代码来源:UProcessView.cpp

示例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);
}
开发者ID:robertknight,项目名称:GammaRay,代码行数:32,代码来源:objectvisualizerwidget.cpp

示例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();
}
开发者ID:cornedor,项目名称:sailfish-recorder,代码行数:30,代码来源:harbour-recorder.cpp

示例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
  }
开发者ID:cniehaus,项目名称:avogadro,代码行数:32,代码来源:enginelistview.cpp

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


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