void WordsSortFilterProxyModel::setWordFilter( const QString& word )
{
    QRegExp regExp( "^" + word.trimmed() + "+", Qt::CaseInsensitive );

    setFilterRegExp( regExp );
    invalidateFilter();
}
Esempio n. 2
0
void OperatorProxyModel::setFilterPattern(const QString& pattern)
{
    if (filterRegExp().pattern() == pattern) {
        return;
    }
    setFilterRegExp(QRegExp(pattern, Qt::CaseInsensitive, QRegExp::RegExp));
}
int main(int argc, char *argv[])
{
    QApplication app(argc, argv);
    QObject *parent = &app;

    QStringList numbers;
    numbers << "One" << "Two" << "Three" << "Four" << "Five";

    QAbstractItemModel *stringListModel = new QStringListModel(numbers, parent);

//! [0]
    QSortFilterProxyModel *filterModel = new QSortFilterProxyModel(parent);
    filterModel->setSourceModel(stringListModel);
//! [0]

    QWidget *window = new QWidget;

//! [1]
    QListView *filteredView = new QListView;
    filteredView->setModel(filterModel);
//! [1]
    filteredView->setWindowTitle("Filtered view onto a string list model");

    QLineEdit *patternEditor = new QLineEdit;
    QObject::
    connect(patternEditor, SIGNAL(textChanged(QString)),
            filterModel, SLOT(setFilterRegExp(QString)));

    QVBoxLayout *layout = new QVBoxLayout(window);
    layout->addWidget(filteredView);
    layout->addWidget(patternEditor);

    window->show();
    return app.exec();
}
Esempio n. 4
0
UPnPRendererModel::UPnPRendererModel(QObject *parent)
   : QSortFilterProxyModel (parent)
{
    setSourceModel(UPnPDeviceModel::getDefault());
    setFilterRole(UPnPDeviceModel::DeviceRoleType);
    setFilterRegExp(QRegExp(RENDERER_PATTERN));
}
Esempio n. 5
0
void
AlbumProxyModel::setFilter( const QString& pattern )
{
    qDebug() << Q_FUNC_INFO;
    setFilterRegExp( pattern );

    emit filterChanged( pattern );
}
KNMusicCategoryDetailModel::KNMusicCategoryDetailModel(QObject *parent) :
    QSortFilterProxyModel(parent)
{
    m_nameFilter.setPattern("^$");
    m_nameFilter.setPatternSyntax(QRegExp::RegExp);
    setFilterRegExp(m_nameFilter);
    setFilterRole(Qt::DisplayRole);
}
Esempio n. 7
0
void
PlayableProxyModel::setFilter( const QString& pattern )
{
    if ( pattern != filterRegExp().pattern() )
    {
        setFilterRegExp( pattern );
        emit filterChanged( pattern );
    }
}
Esempio n. 8
0
void
TrackProxyModel::setFilter( const QString& pattern )
{
    PlaylistInterface::setFilter( pattern );
    setFilterRegExp( pattern );

    emit filterChanged( pattern );
    emit trackCountChanged( trackCount() );
}
int QSortFilterProxyModel::qt_metacall(QMetaObject::Call _c, int _id, void **_a)
{
    _id = QAbstractProxyModel::qt_metacall(_c, _id, _a);
    if (_id < 0)
        return _id;
    if (_c == QMetaObject::InvokeMetaMethod) {
        if (_id < 20)
            qt_static_metacall(this, _c, _id, _a);
        _id -= 20;
    }
#ifndef QT_NO_PROPERTIES
      else if (_c == QMetaObject::ReadProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: *reinterpret_cast< QRegExp*>(_v) = filterRegExp(); break;
        case 1: *reinterpret_cast< int*>(_v) = filterKeyColumn(); break;
        case 2: *reinterpret_cast< bool*>(_v) = dynamicSortFilter(); break;
        case 3: *reinterpret_cast< Qt::CaseSensitivity*>(_v) = filterCaseSensitivity(); break;
        case 4: *reinterpret_cast< Qt::CaseSensitivity*>(_v) = sortCaseSensitivity(); break;
        case 5: *reinterpret_cast< bool*>(_v) = isSortLocaleAware(); break;
        case 6: *reinterpret_cast< int*>(_v) = sortRole(); break;
        case 7: *reinterpret_cast< int*>(_v) = filterRole(); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::WriteProperty) {
        void *_v = _a[0];
        switch (_id) {
        case 0: setFilterRegExp(*reinterpret_cast< QRegExp*>(_v)); break;
        case 1: setFilterKeyColumn(*reinterpret_cast< int*>(_v)); break;
        case 2: setDynamicSortFilter(*reinterpret_cast< bool*>(_v)); break;
        case 3: setFilterCaseSensitivity(*reinterpret_cast< Qt::CaseSensitivity*>(_v)); break;
        case 4: setSortCaseSensitivity(*reinterpret_cast< Qt::CaseSensitivity*>(_v)); break;
        case 5: setSortLocaleAware(*reinterpret_cast< bool*>(_v)); break;
        case 6: setSortRole(*reinterpret_cast< int*>(_v)); break;
        case 7: setFilterRole(*reinterpret_cast< int*>(_v)); break;
        }
        _id -= 8;
    } else if (_c == QMetaObject::ResetProperty) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyDesignable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyScriptable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyStored) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyEditable) {
        _id -= 8;
    } else if (_c == QMetaObject::QueryPropertyUser) {
        _id -= 8;
    }
#endif // QT_NO_PROPERTIES
    return _id;
}
void KNMusicCategoryDetailModel::setCategoryIndex(const QModelIndex &index)
{
    if(index.row()==0)
    {
        m_nameFilter.setPattern("^$");
    }
    else
    {
        m_nameFilter.setPattern("^" + QRegExp::escape(getFilterText(index)) + "$");
    }
    setFilterRegExp(m_nameFilter);
    emit requireSongCountChange(rowCount());
}
Esempio n. 11
0
void
TreeProxyModel::filterFinished()
{
    if ( m_artistsFilterCmd )
    {
        disconnect( dynamic_cast< QObject* >( m_artistsFilterCmd ), SIGNAL( artists( QList<Tomahawk::artist_ptr> ) ),
                    this, SLOT( onFilterArtists( QList<Tomahawk::artist_ptr> ) ) );

        delete m_artistsFilterCmd;
        m_artistsFilterCmd = 0;
    }

    setFilterRegExp( m_filter );
    emit filterChanged( m_filter );
    emit filteringFinished();
}
Esempio n. 12
0
ProgrameList::ProgrameList(QWidget *parent) :
    AbstractList(parent)
{
    _tf=new TextFilter;
    _model=0;
    _zModel=new QSortFilterProxyModel(this);
    _zModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    connect(_tf,SIGNAL(filterExp(QString)),_zModel,SLOT(setFilterRegExp(QString)));
    QVBoxLayout *vbl=new QVBoxLayout;
    vbl->setMargin(0);vbl->setSpacing(0);

    vbl->addWidget(_tf);

    _ml=new MyListWidget;
    _zL=_ml;

    vbl->addWidget(_ml);

    setLayout(vbl);
}
Esempio n. 13
0
void RKObjectListViewSettings::resetFilters () {
	RK_TRACE (APP);

	in_reset_filters = true;
	if (filter_widget) {
		type_box->setCurrentIndex (0);
		filter_on_name_box->setChecked (true);
		filter_on_label_box->setChecked (true);
		filter_on_class_box->setChecked (true);
		depth_box->setCurrentIndex (1);
		sline->setText (QString ());
	} else {
		hide_functions = hide_non_functions = false;
		filter_on_class = filter_on_label = filter_on_name = true;
		depth_limit = 1;
		setFilterRegExp (QRegExp ());
	}
	in_reset_filters = false;
	updateSelf ();
}
Esempio n. 14
0
MaemoRemoteProcessesDialog::MaemoRemoteProcessesDialog(const LinuxDeviceConfiguration::ConstPtr &devConfig,
    QWidget *parent):
    QDialog(parent),
    m_ui(new Ui::MaemoRemoteProcessesDialog),
    m_processList(new MaemoRemoteProcessList(devConfig, this)),
    m_proxyModel(new QSortFilterProxyModel(this))
{
    m_ui->setupUi(this);
    m_ui->tableView->setSelectionBehavior(QAbstractItemView::SelectRows);
    m_proxyModel->setSourceModel(m_processList);
    m_proxyModel->setDynamicSortFilter(true);
    m_proxyModel->setFilterKeyColumn(1);
    m_ui->tableView->setModel(m_proxyModel);
    connect(m_ui->processFilterLineEdit, SIGNAL(textChanged(QString)),
        m_proxyModel, SLOT(setFilterRegExp(QString)));

    // Manually gathered process information is missing the command line for
    // some system processes. Dont's show these lines by default.
    if (devConfig->osType() == LinuxDeviceConfiguration::Maemo5OsType)
        m_ui->processFilterLineEdit->setText(QLatin1String("[^ ]+"));

    connect(m_ui->tableView->selectionModel(),
        SIGNAL(selectionChanged(QItemSelection,QItemSelection)),
        SLOT(handleSelectionChanged()));
    connect(m_ui->updateListButton, SIGNAL(clicked()),
        SLOT(updateProcessList()));
    connect(m_ui->killProcessButton, SIGNAL(clicked()), SLOT(killProcess()));
    connect(m_processList, SIGNAL(error(QString)),
        SLOT(handleRemoteError(QString)));
    connect(m_processList, SIGNAL(modelReset()),
        SLOT(handleProcessListUpdated()));
    connect(m_processList, SIGNAL(processKilled()),
        SLOT(handleProcessKilled()), Qt::QueuedConnection);
    connect(m_proxyModel, SIGNAL(layoutChanged()),
        SLOT(handleProcessListUpdated()));
    handleSelectionChanged();
    updateProcessList();
}
Esempio n. 15
0
void tpMainWindow::setupSignalsMain()
{
    QObject::connect(this->ui->lineEditFilter, SIGNAL(textChanged(QString)), this->stproxymodel, SLOT(setFilterRegExp(QString)));
    QObject::connect(this->ui->lineEditFilterBookmark, SIGNAL(textChanged(QString)), this->stproxymodelbookmarks, SLOT(setFilterRegExp(QString)));
    QObject::connect(this->ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(on_tabChanged(const int)));
    QObject::connect(this->ui->tabWidget, SIGNAL(currentChanged(int)), this, SLOT(statusBarUpdate()));
}
void QmlConsoleProxyModel::setShowErrors(bool show)
{
    m_filter = show ? m_filter | ConsoleItem::ErrorType : m_filter & ~ConsoleItem::ErrorType;
    setFilterRegExp(QString());
}
Esempio n. 17
0
MainWindow::MainWindow(QWidget *parent) :
    QMainWindow(parent),
    logfileIndicator (new QLabel ( this)),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);

    this->setWindowTitle( tr("QT Logger") );

    version = "1.1.2";


    this->setMouseTracking(true);
    this->setBackgroundRole(QPalette::Base);

    QCoreApplication::setOrganizationName("openhpsdr");
    QCoreApplication::setOrganizationDomain("openhpsdr.org");
    QCoreApplication::setApplicationName("QtLogger");

    //logfileIndicator->setStyleSheet (QString ("QLabel {color:red}"));
    logfileIndicator->setPixmap(QPixmap(":/icons/filefoldergrey16.svg"));
    logfileIndicator->setToolTip(QString("Logfile: No file")  );

    About *about = new About();
    about->setVersion( version );


    Help *help = new Help();

    data = new Data();
    data->setMinimumHeader();

    add = new addDialog( this );


    readDefinitions(":/xml/adif_codes_2.2.7.xml");


    add->loadmodeComboBox( modes );
    add->loadcountryComboBox( country );
    add->loadsubdivisionsComboBox( subdivisions );
    add->loadbandsData( bands );

    last = new lastContact( this );

    pref = new Preferences( this );
    pref->setPreferences( QString("radio"), settings.value("preference_radio").toString() );
    pref->setPreferences( QString("location"), settings.value("preference_location").toString() );
    pref->setPreferences( QString("event"), settings.value("preference_event").toString() );
    pref->setPreferences( QString("owner"), settings.value("preference_owner").toString() );
    pref->setPreferences( QString("qsl"), settings.value("preference_qsl").toString() );
    pref->setPreferences( QString("callfilter"), settings.value("callsign_filter").toString() );
    add->callsign_filter = pref->getPreferences("callfilter");


    udpSocket = new QUdpSocket(this);
    udpSocket->bind( 11500, QUdpSocket::ShareAddress );

    statusBar ()->addPermanentWidget (logfileIndicator);

    ui->tableView->verticalScrollBar()->setValue(ui->tableView->verticalScrollBar()->maximum());

    deleteFlag = false;

    connect(udpSocket, SIGNAL(readyRead()), this, SLOT(processPendingDatagrams()));
    connect(ui->actionQuit,SIGNAL(triggered()),this,SLOT(closeDown()));
    connect(ui->actionAbout,SIGNAL(triggered()),about,SLOT(aboutMessage()));
    connect(ui->actionHelp,SIGNAL(triggered()),help,SLOT(show()));
    connect(ui->actionPreferences,SIGNAL(triggered()),pref,SLOT(show()));
    connect(pref,SIGNAL(preferencesChanged()),this,SLOT(updateView()));
    connect(ui->actionOpen,SIGNAL(triggered()),data,SLOT(readData()));
    connect(ui->actionLast_Contact,SIGNAL(triggered()),last,SLOT(show()));
    connect(ui->actionOpen,SIGNAL(triggered()),this,SLOT(updateStatus()));
    connect(ui->actionSave,SIGNAL(triggered()),this,SLOT(writeData()));
    connect(ui->actionSupport_Directory,SIGNAL(triggered()),this,SLOT(setSupportDirectory()));
    connect(ui->actionLog_Directory,SIGNAL(triggered()),this,SLOT(setLogDirectory()));
    connect(ui->tableView,SIGNAL(clicked(QModelIndex)),this,SLOT(removeTableRow(QModelIndex)));
    connect(ui->tableView,SIGNAL(activated(QModelIndex)),ui->tableView,SLOT(resizeRowsToContents()));
    connect(ui->actionAdd,SIGNAL(triggered()),add,SLOT(show()));
    connect(add,SIGNAL(newdata()),this,SLOT(update()));
    connect(data,SIGNAL(refresh()),this,SLOT(update()));
    connect(ui->actionDelete,SIGNAL(toggled(bool)),this,SLOT(setDeleteFlag(bool)));
    connect(add,SIGNAL(ownerChanged()),this,SLOT(updateOwner()));
    connect(add,SIGNAL(prefixChanged(QString)),last->proxyModel,SLOT(setFilterRegExp(QString)));
    connect(add,SIGNAL(prefixChanged(QString)),last,SLOT(setCallLabel(QString)));
    connect(add,SIGNAL(prefixChanged(QString)),add->proxyModel,SLOT(setFilterRegExp(QString)));
}
Esempio n. 18
0
void Plotter::initPlugin(qt_gui_cpp::PluginContext& context)
{
	m_w = new QWidget;

	m_ui = new Ui::Plotter;
	m_ui->setupUi(m_w);

	context.addWidget(m_w);

	m_plotModel = new PlotModel(this);
	m_plotModel->rootPlot()->setUsedSettings(&m_settings);

	m_plotFilter = new PlotFilterModel(this);
	m_plotFilter->setSourceModel(m_plotModel);

	new JointStatePlot(getNodeHandle(), m_plotModel->rootPlot()); // The created JointStatePlot gets deleted when the root plot does, or all of its child plots

	m_ui->plotView->setModel(m_plotFilter);
	m_ui->plotView->setDragEnabled(true);

	m_ui->plotView->setItemDelegateForColumn(PlotModel::COL_ENABLED, new CheckBoxDelegate);
	m_ui->plotView->setItemDelegateForColumn(PlotModel::COL_COLOR, new ColorDelegate);

	m_ui->plot->addPlot(m_plotModel->rootPlot());

	connect(m_ui->pauseButton, SIGNAL(clicked(bool)), SLOT(handlePaused(bool)));
	connect(m_ui->playButton, SIGNAL(clicked(bool)), SLOT(handlePlay(bool)));
	connect(m_plotModel, SIGNAL(modelReset()), SLOT(updateTreeGeometry()));

	connect(m_ui->searchEdit, SIGNAL(textChanged(QString)), m_plotFilter, SLOT(setFilterRegExp(QString)));
	connect(m_ui->hideCheckBox, SIGNAL(clicked(bool)), m_plotFilter, SLOT(setHideDisabledPlots(bool)));

	m_sub_plot = getNodeHandle().subscribe("/plot", 100, &Plotter::plotDataReceived, this);
	qRegisterMetaType<plot_msgs::PlotConstPtr>("plot_msgs::PlotConstPtr");
	connect(this, SIGNAL(plotDataReceived(plot_msgs::PlotConstPtr)), SLOT(handlePlotData(plot_msgs::PlotConstPtr)), Qt::QueuedConnection);

	m_sub_timewarpStatus = getNodeHandle().subscribe("/tw/control_status", 1, &Plotter::timewarpStatusReceived, this);
	qRegisterMetaType<timewarp::TimeWarpControlConstPtr>("timewarp::TimeWarpControlConstPtr");
	connect(this, SIGNAL(timewarpStatusReceived(timewarp::TimeWarpControlConstPtr)), SLOT(handleTimewarpStatus(timewarp::TimeWarpControlConstPtr)), Qt::QueuedConnection);

	m_pub_timewarpControl = getNodeHandle().advertise<timewarp::TimeWarpControl>("/tw/control", 1);

	m_ui->plotView->installEventFilter(this);

	handleSelectionChanged(0.0, 0.0, false);
	connect(m_ui->plot, SIGNAL(timeChanged()), SLOT(updateTimeWarp()));
	connect(m_ui->plot, SIGNAL(stopPlaying()), SLOT(handleStopPlaying()));
	connect(m_ui->plot, SIGNAL(selectionChanged(double,double,bool)), SLOT(handleSelectionChanged(double,double,bool)));

	QMenu* menu = new QMenu(m_w); // Standard icon names: https://specifications.freedesktop.org/icon-naming-spec/icon-naming-spec-latest.html#names
	m_loadMenuAction = menu->addAction(QIcon::fromTheme("document-open"), "Load data", this, SLOT(load()));
	m_saveMenuAction = menu->addAction(QIcon::fromTheme("document-save"), "Save data", this, SLOT(save()));
	m_assignColoursAction = menu->addAction(QIcon::fromTheme("applications-graphics"), "Assign colours", this, SLOT(assignColours()));
	m_clearMenuAction = menu->addAction(QIcon::fromTheme("edit-delete"), "Clear data", this, SLOT(clear()));
	m_clearPlotMenuAction = menu->addAction(QIcon::fromTheme("edit-clear"), "Clear plot", this, SLOT(clearPlot()));
	m_refreshMenuAction = menu->addAction(QIcon::fromTheme("view-refresh"), "Refresh", this, SLOT(refresh()));
	m_ui->menuButton->setMenu(menu);

	connect(m_ui->pauseButton, SIGNAL(clicked(bool)), m_loadMenuAction, SLOT(setEnabled(bool)));
	connect(m_ui->pauseButton, SIGNAL(clicked(bool)), m_saveMenuAction, SLOT(setEnabled(bool)));
	m_loadMenuAction->setDisabled(true);
	m_saveMenuAction->setDisabled(true);

	m_io = new PlotIO(getNodeHandle(), m_plotModel->rootPlot(), this);
	connect(m_io, SIGNAL(progress(double)), SLOT(ioProgress(double)));

	m_progressDialog = new QProgressDialog(m_w);
	m_progressDialog->setLabelText(tr("I/O in progress"));
	m_progressDialog->setMinimum(0);
	m_progressDialog->setMaximum(100);
	m_progressDialog->setAutoClose(false);
	m_progressDialog->setAutoReset(false);
	m_progressDialog->setCancelButton(0);
}
void SortFilterProxyModel::setFilterSyntax(SortFilterProxyModel::FilterSyntax syntax)
{
    setFilterRegExp(QRegExp(filterString(), filterCaseSensitivity(), static_cast<QRegExp::PatternSyntax>(syntax)));
}
Esempio n. 20
0
    m_editWdg = new %EditWidgetClassName%();
    m_editDialog = new EditDialog(m_editWdg, this);
    m_proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
    m_proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
    m_proxyModel->setSourceModel(m_model);
    m_proxyModel->setFilterKeyColumn(%ModelClassName%::NameCol);


    ui->tableView->horizontalHeader()->setDefaultSectionSize(%ModelClassName%::IdCol, 50);
    ui->tableView->setModel(m_proxyModel, %ModelClassName%::IdCol, Qt::DisplayRole);

    connect(ui->btnAdd, SIGNAL(clicked()), SLOT(add()));
    connect(ui->btnEdit, SIGNAL(clicked()), SLOT(editCurrent()));
    connect(ui->btnDelete, SIGNAL(clicked()), SLOT(deleteSelected()));
    connect(ui->btnPrint, SIGNAL(print(Report&)), SLOT(slotPrint(Report&)));
    connect(ui->edFind, SIGNAL(textEdited(QString)), m_proxyModel, SLOT(setFilterRegExp(QString)));
    connect(ui->tableView, SIGNAL(doubleClicked(QModelIndex)), SLOT(viewDoubleClicked(QModelIndex)));

    restoreSettings();
}

%TableClassName%::~%TableClassName%()
{
    saveSettings();
    delete ui;
}

AdvTableView *%TableClassName%::view() const
{
    return ui->tableView;
}
Esempio n. 21
0
void RepoFilterProxyModel::setFilterText(const QString& text)
{
    has_filter_ = !text.isEmpty();
    invalidate();
    setFilterRegExp(makeFilterRegExp(text));
}
Esempio n. 22
0
ContactMethodSelector::ContactMethodSelector(QWidget* parent) : QDialog(parent)
{
   setupUi(this);

   m_pSortedContacts = new QSortFilterProxyModel(this);
   m_pSortedContacts->setSourceModel          ( &PhoneDirectoryModel::instance() );
   m_pSortedContacts->setSortRole             ( Qt::DisplayRole                  );
   m_pSortedContacts->setFilterCaseSensitivity( Qt::CaseInsensitive              );
   m_pSortedContacts->setSortCaseSensitivity  ( Qt::CaseInsensitive              );


   connect(m_pFilterLE ,SIGNAL(filterStringChanged(QString)), m_pSortedContacts, SLOT(setFilterRegExp(QString))   );

   listView->setModel(m_pSortedContacts);
}
void QtMessageLogProxyModel::setShowErrors(bool show)
{
    m_filter = show ? m_filter | QtMessageLogHandler::ErrorType :
                        m_filter & ~QtMessageLogHandler::ErrorType;
    setFilterRegExp(QString());
}
void SortFilterProxyModel::setFilterString(const QString &filter)
{
    setFilterRegExp(QRegExp(filter, filterCaseSensitivity(), static_cast<QRegExp::PatternSyntax>(filterSyntax())));
}