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


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

本文整理汇总了C++中QSortFilterProxyModel::setSourceModel方法的典型用法代码示例。如果您正苦于以下问题:C++ QSortFilterProxyModel::setSourceModel方法的具体用法?C++ QSortFilterProxyModel::setSourceModel怎么用?C++ QSortFilterProxyModel::setSourceModel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在QSortFilterProxyModel的用法示例。


在下文中一共展示了QSortFilterProxyModel::setSourceModel方法的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: run

void djvIconLibraryTest::run(const QStringList & args)
{
    QWidget * window = new QWidget;

    IconLibraryModel * model = new IconLibraryModel(context(), window);

    QSortFilterProxyModel * proxyModel = new QSortFilterProxyModel(window);
    proxyModel->setSourceModel(model);
    proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    proxyModel->sort(0, Qt::AscendingOrder);

    QTreeView * view = new QTreeView;
    view->setRootIsDecorated(false);
    view->setIconSize(context()->iconLibrary()->defaultSize());
    view->setModel(proxyModel);
    view->setSortingEnabled(true);

    view->header()->resizeSections(QHeaderView::ResizeToContents);
    view->header()->setSortIndicator(0, Qt::AscendingOrder);

    djvSearchBox * searchBox = new djvSearchBox(context());

    QVBoxLayout * layout = new QVBoxLayout(window);
    layout->addWidget(searchBox);
    layout->addWidget(view);

    connect(
        searchBox,
        SIGNAL(textChanged(const QString &)),
        proxyModel,
        SLOT(setFilterFixedString(const QString &)));

    window->resize(400, 600);
    window->show();
}
开发者ID:mottosso,项目名称:djv,代码行数:35,代码来源:djvIconLibraryTest.cpp

示例3: initLangs

void MainWindow::initLangs() {
  // Clean combobox with languages
    int langsCount = ui->comboBoxLang->count();
  if (langsCount > 0)
    for (int i = langsCount; i >= 0; i--) {
      ui->comboBoxLang->removeItem(0);
    }

  QList<QString> languages;
  languages = getLangugagelist();

  QString lang;
  foreach(lang, languages)
  if (getLangName(lang) == "")
    ui->comboBoxLang->addItem(lang, lang);
  else
    ui->comboBoxLang->addItem(getLangName(lang), lang);

  // sort language list
  QSortFilterProxyModel* proxy = new QSortFilterProxyModel(ui->comboBoxLang);
  proxy->setSourceModel(ui->comboBoxLang->model());
  ui->comboBoxLang->model()->setParent(proxy);
  ui->comboBoxLang->setModel(proxy);
  ui->comboBoxLang->model()->sort(0);
}
开发者ID:jldm231,项目名称:tesseract-ocr-qt4gui,代码行数:25,代码来源:mainwindow.cpp

示例4: initLangs

void SettingsDialog::initLangs() {
    QSettings settings(QSettings::IniFormat, QSettings::UserScope,
                    SETTING_ORGANIZATION, SETTING_APPLICATION);
    QString datapath = settings.value("Tesseract/DataPath").toString();
    datapath += "tessdata";
    TessTools tt;
    QList<QString> languages = tt.getLanguages(datapath);

    // Clean combobox with languages
    int langsCount = cbLang->count();
    if (langsCount > 0)
      for (int i = langsCount; i >= 0; i--) {
        cbLang->removeItem(0);
      }

    QString lang;
    foreach(lang, languages)
    if (getLangName(lang) == "")
      cbLang->addItem(lang, lang);
    else
      cbLang->addItem(getLangName(lang), lang);

    // sort language list
    QSortFilterProxyModel* proxy = new QSortFilterProxyModel(cbLang);
    proxy->setSourceModel(cbLang->model());
    cbLang->model()->setParent(proxy);
    cbLang->setModel(proxy);
    cbLang->model()->sort(0);
}
开发者ID:zofer,项目名称:qt-box-editor,代码行数:29,代码来源:SettingsDialog.cpp

示例5: 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

示例6: 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

示例7: main

int main(int argc, char* argv[])
{
    QApplication app(argc, argv);

    QFrame frame;
    QVBoxLayout verticalLayout;
    QLineEdit filterText;

    ProblemsTableModel submissions;

    // add data here

    QSortFilterProxyModel proxy;
    proxy.setSortCaseSensitivity(Qt::CaseInsensitive);
    proxy.setFilterCaseSensitivity(Qt::CaseInsensitive);
    proxy.setSourceModel(&submissions);
    // sort and filter by "Full name" column
    proxy.setFilterKeyColumn(2);

    QTableView tableView;
    tableView.setModel(&proxy);
    tableView.setSortingEnabled(true);

    verticalLayout.addWidget(&filterText);
    verticalLayout.addWidget(&tableView);
    frame.setLayout(&verticalLayout);

    QObject::connect(&filterText, &QLineEdit::textChanged, &proxy, &QSortFilterProxyModel::setFilterFixedString);

    frame.show();

    return app.exec();
}
开发者ID:jgcoded,项目名称:UVA-Arena-Qt,代码行数:33,代码来源:modelstest.cpp

示例8: 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

示例9: testInsertThroughProxy

void tst_ModelTest::testInsertThroughProxy()
{
    DynamicTreeModel *model = new DynamicTreeModel(this);

    QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
    proxy->setSourceModel(model);

    new ModelTest(proxy, this);

    ModelInsertCommand *insertCommand = new ModelInsertCommand(model, this);
    insertCommand->setNumCols(4);
    insertCommand->setStartRow(0);
    insertCommand->setEndRow(9);
    // Parent is QModelIndex()
    insertCommand->doCommand();

    insertCommand = new ModelInsertCommand(model, this);
    insertCommand->setNumCols(4);
    insertCommand->setAncestorRowNumbers(QList<int>() << 5);
    insertCommand->setStartRow(0);
    insertCommand->setEndRow(9);
    insertCommand->doCommand();

    ModelMoveCommand *moveCommand = new ModelMoveCommand(model, this);
    moveCommand->setNumCols(4);
    moveCommand->setStartRow(0);
    moveCommand->setEndRow(0);
    moveCommand->setDestRow(9);
    moveCommand->setDestAncestors(QList<int>() << 5);
    moveCommand->doCommand();
}
开发者ID:SchleunigerAG,项目名称:WinEC7_Qt5.3.1_Fixes,代码行数:31,代码来源:tst_modeltest.cpp

示例10: initial

void Mailbox::initial(IMailProcessor& mailProcessor, MailboxModel* model, InboxType type, KeyhoteeMainWindow* parentKehoteeMainW)
  {
  _type = type;
  _sourceModel = model;
  _mailProcessor = &mailProcessor;

  //enable sorting the mailbox
  QSortFilterProxyModel* proxyModel = new MailSortFilterProxyModel();
  proxyModel->setSourceModel(model);
  ui->inbox_table->setModel(proxyModel);
  //ui->inbox_table->sortByColumn(0, Qt::AscendingOrder);
  //ui->inbox_table->setModel( model );

  ui->inbox_table->setShowGrid(false);

  ui->inbox_table->horizontalHeader()->resizeSection(MailboxModel::To, 120);
  ui->inbox_table->horizontalHeader()->resizeSection(MailboxModel::Subject, 300);
  ui->inbox_table->horizontalHeader()->resizeSection(MailboxModel::DateReceived, 140);
  ui->inbox_table->horizontalHeader()->resizeSection(MailboxModel::From, 120);
  ui->inbox_table->horizontalHeader()->resizeSection(MailboxModel::DateSent, 120);
  if (_type == Inbox)
    {
    ui->inbox_table->horizontalHeader()->hideSection(MailboxModel::Status);
    ui->inbox_table->horizontalHeader()->hideSection(MailboxModel::DateSent);
    }
  if (_type == Sent)
    {
    ui->inbox_table->horizontalHeader()->swapSections(MailboxModel::To, MailboxModel::From);
    ui->inbox_table->horizontalHeader()->swapSections(MailboxModel::DateReceived, MailboxModel::DateSent);
    ui->inbox_table->horizontalHeader()->hideSection(MailboxModel::DateReceived);
    }
  if (_type == Drafts)
    {
    ui->inbox_table->horizontalHeader()->swapSections(MailboxModel::To, MailboxModel::From);
    ui->inbox_table->horizontalHeader()->swapSections(MailboxModel::DateReceived, MailboxModel::DateSent);
    ui->inbox_table->horizontalHeader()->hideSection(MailboxModel::DateReceived);
    ui->inbox_table->horizontalHeader()->hideSection(MailboxModel::Status);
    }

  ui->inbox_table->horizontalHeader()->setSectionsMovable(true);
  ui->inbox_table->horizontalHeader()->setSortIndicatorShown(false);
  ui->inbox_table->horizontalHeader()->setSectionsClickable(true);
  ui->inbox_table->horizontalHeader()->setHighlightSections(true);

  //connect signals for the new selection model (created by setModel call)
  QItemSelectionModel* inbox_selection_model = ui->inbox_table->selectionModel();
  connect(inbox_selection_model, &QItemSelectionModel::selectionChanged, this, &Mailbox::onSelectionChanged);
  connect(inbox_selection_model, &QItemSelectionModel::currentChanged, this, &Mailbox::showCurrentMail);
  connect(ui->inbox_table, SIGNAL(doubleClicked(QModelIndex)), this, SLOT(onDoubleClickedItem(QModelIndex)));

  connect(reply_mail, &QAction::triggered, this, &Mailbox::onReplyMail);
  connect(reply_all_mail, &QAction::triggered, this, &Mailbox::onReplyAllMail);
  connect(forward_mail, &QAction::triggered, this, &Mailbox::onForwardMail);
  connect(delete_mail, &QAction::triggered, this, &Mailbox::onDeleteMail);

  // hidden Coin Attachment Column
  ui->inbox_table->hideColumn(MailboxModel::Money);
  // hidden Chat Column
  ui->inbox_table->hideColumn(MailboxModel::Chat);
  }
开发者ID:vipjeffreylee,项目名称:keyhotee,代码行数:60,代码来源:Mailbox.cpp

示例11: 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

示例12: createDialogContent

void MpcImportWindow::createDialogContent()
{
	ui->setupUi(dialog);

	//Signals
	connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
	connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
	connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));

	connect(ui->pushButtonAcquire, SIGNAL(clicked()),
	        this, SLOT(acquireObjectData()));
	connect(ui->pushButtonAbortDownload, SIGNAL(clicked()),
	        this, SLOT(abortDownload()));
	connect(ui->pushButtonAdd, SIGNAL(clicked()), this, SLOT(addObjects()));
	connect(ui->pushButtonDiscard, SIGNAL(clicked()),
	        this, SLOT(discardObjects()));

	connect(ui->pushButtonBrowse, SIGNAL(clicked()), this, SLOT(selectFile()));
	connect(ui->comboBoxBookmarks, SIGNAL(currentIndexChanged(QString)),
	        this, SLOT(bookmarkSelected(QString)));

	connect(ui->radioButtonFile, SIGNAL(toggled(bool)),
	        ui->frameFile, SLOT(setVisible(bool)));
	connect(ui->radioButtonURL, SIGNAL(toggled(bool)),
	        ui->frameURL, SLOT(setVisible(bool)));

	connect(ui->radioButtonAsteroids, SIGNAL(toggled(bool)),
	        this, SLOT(switchImportType(bool)));
	connect(ui->radioButtonComets, SIGNAL(toggled(bool)),
	        this, SLOT(switchImportType(bool)));

	connect(ui->pushButtonMarkAll, SIGNAL(clicked()),
	        this, SLOT(markAll()));
	connect(ui->pushButtonMarkNone, SIGNAL(clicked()),
	        this, SLOT(unmarkAll()));

	connect(ui->pushButtonSendQuery, SIGNAL(clicked()),
	        this, SLOT(sendQuery()));
	connect(ui->lineEditQuery, SIGNAL(returnPressed()),
		this, SLOT(sendQuery()));
	connect(ui->pushButtonAbortQuery, SIGNAL(clicked()),
	        this, SLOT(abortQuery()));
	connect(ui->lineEditQuery, SIGNAL(textEdited(QString)),
	        this, SLOT(resetNotFound()));
	//connect(ui->lineEditQuery, SIGNAL(editingFinished()), this, SLOT(sendQuery()));
	connect(countdownTimer, SIGNAL(timeout()), this, SLOT(updateCountdown()));

	QSortFilterProxyModel * filterProxyModel = new QSortFilterProxyModel(this);
	filterProxyModel->setSourceModel(candidateObjectsModel);
	filterProxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
	ui->listViewObjects->setModel(filterProxyModel);
	connect(ui->lineEditSearch, SIGNAL(textChanged(const QString&)),
	        filterProxyModel, SLOT(setFilterFixedString(const QString&)));

	loadBookmarks();
	updateTexts();

	resetCountdown();
	resetDialog();
}
开发者ID:NGCyang,项目名称:stellarium,代码行数:60,代码来源:MpcImportWindow.cpp

示例13: 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

示例14: 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

示例15: 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


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