本文整理汇总了C++中QSortFilterProxyModel::setFilterCaseSensitivity方法的典型用法代码示例。如果您正苦于以下问题:C++ QSortFilterProxyModel::setFilterCaseSensitivity方法的具体用法?C++ QSortFilterProxyModel::setFilterCaseSensitivity怎么用?C++ QSortFilterProxyModel::setFilterCaseSensitivity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QSortFilterProxyModel
的用法示例。
在下文中一共展示了QSortFilterProxyModel::setFilterCaseSensitivity方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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();
}
示例2: 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();
}
示例3: 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();
}
示例4: 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();
}
示例5: wrapInProxyModel
static QSortFilterProxyModel* wrapInProxyModel(QAbstractItemModel* model)
{
QSortFilterProxyModel* proxyModel = new QSortFilterProxyModel(model);
proxyModel->setSourceModel(model);
proxyModel->setDynamicSortFilter(true);
proxyModel->setSortCaseSensitivity(Qt::CaseInsensitive);
proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
proxyModel->setFilterKeyColumn(-1);
return proxyModel;
}
示例6: AbstractPreferencesWidget
PreferencesLanguage::PreferencesLanguage() : AbstractPreferencesWidget(tr("Language"), QIcon(":/language"), 4)
{
ui = new Ui::PreferencesLanguage();
ui->setupUi(this);
QSortFilterProxyModel *filterModel = new QSortFilterProxyModel();
filterModel->setSourceModel(LanguageModel::instance());
filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
ui->languageDropdown->setModel(filterModel);
filterModel->sort(0);
connect(ui->languageFilter, &QLineEdit::textChanged,
filterModel, &QSortFilterProxyModel::setFilterFixedString);
}
示例7: main
int main(int argc, char** argv)
{
QApplication app(argc, argv);
QCommandLineParser parser;
parser.addPositionalArgument(QStringLiteral("filename"), QStringLiteral("file to visualize"));
parser.addHelpOption();
parser.process(app);
QStringList args = parser.positionalArguments();
if (args.size() != 1) {
parser.showHelp(1);
}
QWidget* mainWidget = new QWidget();
QVBoxLayout* layout = new QVBoxLayout(mainWidget);
mainWidget->setLayout(layout);
QLineEdit* edit = new QLineEdit();
layout->addWidget(edit);
QString fileName = args.first();
QTreeView* view = new QTreeView(0);
FunctionsModel* model = new FunctionsModel(view);
model->setFilePath(QFileInfo(fileName).absoluteFilePath());
QSortFilterProxyModel* sortModel = new QSortFilterProxyModel(view);
sortModel->setSourceModel(model);
sortModel->setFilterKeyColumn(2);
sortModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
view->setModel(sortModel);
view->setSortingEnabled(true);
layout->addWidget(view);
QObject::connect(edit, SIGNAL(textChanged(QString)),
sortModel, SLOT(setFilterFixedString(QString)));
mainWidget->show();
return app.exec();
}
示例8: ctkSearchBoxTest2
// ------------------------------------------------------------------------------
int ctkSearchBoxTest2(int argc, char* argv[])
{
QApplication app(argc, argv);
QStringList stringList;
stringList<<"totoa"<<"TOTOaa"<<"tic"<<"tac"<<"nice"<<"slicer"<<"monday"<<"july"<<"phone";
ctkSearchBox search3;
search3.show();
search3.setText("phone");
QRegExp regExp(search3.text(),Qt::CaseInsensitive, QRegExp::Wildcard);
//QStringList testFilter = stringList.filter(search3.text());
QStringList testFilter = stringList.filter(regExp);
qDebug() << "Result of Test Filter : " << testFilter;
if (testFilter.size() >= stringList.size())
{
qDebug() << "Line : " << __LINE__<< " error with the filter : " << search3.text();
}
QStringListModel listModel(stringList);
QSortFilterProxyModel filterModel;
filterModel.setSourceModel(&listModel);
filterModel.setFilterCaseSensitivity(Qt::CaseInsensitive);
filterModel.setFilterWildcard(search3.text());
QObject::connect(&search3, SIGNAL(textChanged(QString)),
&filterModel, SLOT(setFilterWildcard(QString)));
QListView listView;
listView.setModel(&filterModel);
listView.show();
if (argc < 2 || QString(argv[1]) != "-I" )
{
QTimer::singleShot(200, &app, SLOT(quit()));
}
return app.exec();
}
示例9: QDialog
CopyInputDialog::CopyInputDialog(QWidget* parent)
: QDialog(parent)
{
setWindowTitle(i18n("Copy Input"));
QDialogButtonBox *buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok|QDialogButtonBox::Cancel);
QWidget *mainWidget = new QWidget(this);
QVBoxLayout *mainLayout = new QVBoxLayout;
setLayout(mainLayout);
mainLayout->addWidget(mainWidget);
QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok);
okButton->setDefault(true);
okButton->setShortcut(Qt::CTRL | Qt::Key_Return);
connect(buttonBox, &QDialogButtonBox::accepted, this, &CopyInputDialog::accept);
connect(buttonBox, &QDialogButtonBox::rejected, this, &CopyInputDialog::reject);
mainLayout->addWidget(buttonBox);
setWindowModality(Qt::WindowModal);
_ui = new Ui::CopyInputDialog();
_ui->setupUi(mainWidget);
connect(_ui->selectAllButton, &QPushButton::clicked, this, &Konsole::CopyInputDialog::selectAll);
connect(_ui->deselectAllButton, &QPushButton::clicked, this, &Konsole::CopyInputDialog::deselectAll);
_ui->filterEdit->setClearButtonEnabled(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, &QLineEdit::textChanged, filterProxyModel, &QSortFilterProxyModel::setFilterFixedString);
_ui->sessionList->setModel(filterProxyModel);
_ui->sessionList->setColumnHidden(0, true); // Hide number column
_ui->sessionList->header()->hide();
}
示例10: main
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
BookModel bookModel;
QSortFilterProxyModel proxy;
proxy.setSourceModel(&bookModel);
proxy.setFilterRole(BookModel::NameRole);
proxy.setFilterCaseSensitivity(Qt::CaseInsensitive);
proxy.setSortRole(BookModel::NameRole);
proxy.setDynamicSortFilter(true);
proxy.sort(0);
QDeclarativeView view;
view.rootContext()->setContextProperty("bookModel", &proxy);
view.setSource(QUrl::fromLocalFile("main.qml"));
view.show();
return app.exec();
}
示例11: createDialogContent
// Initialize the dialog widgets and connect the signals/slots
void LocationDialog::createDialogContent()
{
// We try to directly connect to the observer slots as much as we can
ui->setupUi(dialog);
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
// Init the SpinBox entries
ui->longitudeSpinBox->setDisplayFormat(AngleSpinBox::DMSSymbols);
ui->longitudeSpinBox->setPrefixType(AngleSpinBox::Longitude);
ui->latitudeSpinBox->setDisplayFormat(AngleSpinBox::DMSSymbols);
ui->latitudeSpinBox->setPrefixType(AngleSpinBox::Latitude);
QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel((QAbstractItemModel*)StelApp::getInstance().getLocationMgr().getModelAll());
proxyModel->sort(0, Qt::AscendingOrder);
proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
ui->citiesListView->setModel(proxyModel);
populatePlanetList();
populateCountryList();
connect(ui->citySearchLineEdit, SIGNAL(textChanged(const QString&)), proxyModel, SLOT(setFilterWildcard(const QString&)));
connect(ui->citiesListView, SIGNAL(clicked(const QModelIndex&)), this, SLOT(listItemActivated(const QModelIndex&)));
// Connect all the QT signals
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
connect(ui->mapLabel, SIGNAL(positionChanged(double, double)), this, SLOT(setPositionFromMap(double, double)));
connect(ui->addLocationToListPushButton, SIGNAL(clicked()), this, SLOT(addCurrentLocationToList()));
connect(ui->deleteLocationFromListPushButton, SIGNAL(clicked()), this, SLOT(deleteCurrentLocationFromList()));
setFieldsFromLocation(StelApp::getInstance().getCore()->getCurrentLocation());
const bool b = StelApp::getInstance().getCore()->getCurrentLocation().getID()
==StelApp::getInstance().getCore()->getDefaultLocationID();
ui->useAsDefaultLocationCheckBox->setChecked(b);
ui->useAsDefaultLocationCheckBox->setEnabled(!b);
connect(ui->useAsDefaultLocationCheckBox, SIGNAL(clicked()), this, SLOT(useAsDefaultClicked()));
SensorMgr* sensorMgr = (SensorMgr*)StelApp::getInstance().getModuleMgr().getModule("SensorMgr");
if(sensorMgr->getGpsPermitted()) {
bool bg = StelApp::getInstance().getCore()->getUseGPS();
bg = !bg;
bg = !bg;
qDebug() << "getUseGPS(): " << bg;
ui->useGPScheckBox->setChecked(bg);
}
else {
qDebug() << "Disable GPS checkbox";
ui->useGPScheckBox->setChecked(false);
ui->useGPScheckBox->setEnabled(false);
}
connect(ui->useGPScheckBox, SIGNAL(clicked()), this, SLOT(useGPSClicked()));
connectEditSignals();
QTimer* refreshTimer = new QTimer(this);
connect(refreshTimer, SIGNAL(timeout()), this, SLOT(updateFromProgram()));
refreshTimer->start(200);
ui->citySearchLineEdit->setFocus();
}
示例12: createDialogContent
// Initialize the dialog widgets and connect the signals/slots
void LocationDialog::createDialogContent()
{
// We try to directly connect to the observer slots as much as we can
ui->setupUi(dialog);
connect(&StelApp::getInstance(), SIGNAL(languageChanged()), this, SLOT(retranslate()));
// Init the SpinBox entries
ui->longitudeSpinBox->setDisplayFormat(AngleSpinBox::DMSSymbols);
ui->longitudeSpinBox->setPrefixType(AngleSpinBox::Longitude);
ui->longitudeSpinBox->setMinimum(-180.0, true);
ui->longitudeSpinBox->setMaximum( 180.0, true);
ui->longitudeSpinBox->setWrapping(true);
ui->latitudeSpinBox->setDisplayFormat(AngleSpinBox::DMSSymbols);
ui->latitudeSpinBox->setPrefixType(AngleSpinBox::Latitude);
ui->latitudeSpinBox->setMinimum(-90.0, true);
ui->latitudeSpinBox->setMaximum( 90.0, true);
ui->latitudeSpinBox->setWrapping(false);
QSortFilterProxyModel *proxyModel = new QSortFilterProxyModel(this);
proxyModel->setSourceModel((QAbstractItemModel*)StelApp::getInstance().getLocationMgr().getModelAll());
proxyModel->sort(0, Qt::AscendingOrder);
proxyModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
ui->citiesListView->setModel(proxyModel);
#ifdef Q_OS_WIN
//Kinetic scrolling for tablet pc and pc
QList<QWidget *> addscroll;
addscroll << ui->citiesListView;
installKineticScrolling(addscroll);
#endif
populatePlanetList();
populateCountryList();
connect(ui->citySearchLineEdit, SIGNAL(textChanged(const QString&)), proxyModel, SLOT(setFilterWildcard(const QString&)));
connect(ui->citiesListView, SIGNAL(clicked(const QModelIndex&)),
this, SLOT(setPositionFromList(const QModelIndex&)));
// Connect all the QT signals
connect(ui->closeStelWindow, SIGNAL(clicked()), this, SLOT(close()));
connect(ui->TitleBar, SIGNAL(movedTo(QPoint)), this, SLOT(handleMovedTo(QPoint)));
connect(ui->mapLabel, SIGNAL(positionChanged(double, double)), this, SLOT(setPositionFromMap(double, double)));
connect(ui->addLocationToListPushButton, SIGNAL(clicked()), this, SLOT(addCurrentLocationToList()));
connect(ui->deleteLocationFromListPushButton, SIGNAL(clicked()), this, SLOT(deleteCurrentLocationFromList()));
connect(ui->resetListPushButton, SIGNAL(clicked()), this, SLOT(resetCompleteList()));
connect(ui->countryNameComboBox, SIGNAL(activated(const QString &)), this, SLOT(filterSitesByCountry()));
StelCore* core = StelApp::getInstance().getCore();
const StelLocation& currentLocation = core->getCurrentLocation();
bool b = (currentLocation.getID() == core->getDefaultLocationID());
QSettings* conf = StelApp::getInstance().getSettings();
if (conf->value("init_location/location", "auto").toString() == "auto")
{
ui->useIpQueryCheckBox->setChecked(true);
b = false;
}
setFieldsFromLocation(currentLocation);
updateDefaultLocationControls(b);
connect(ui->useIpQueryCheckBox, SIGNAL(clicked(bool)), this, SLOT(ipQueryLocation(bool)));
connect(ui->useAsDefaultLocationCheckBox, SIGNAL(clicked(bool)), this, SLOT(setDefaultLocation(bool)));
connect(ui->pushButtonReturnToDefault, SIGNAL(clicked()), core, SLOT(returnToDefaultLocation()));
connectEditSignals();
connect(core, SIGNAL(locationChanged(StelLocation)), this, SLOT(updateFromProgram(StelLocation)));
ui->citySearchLineEdit->setFocus();
}
示例13: setUiFromPrefs
void PreferencesDialog::setUiFromPrefs()
{
// graphs
ui.pheThreshold->setValue(prefs.pp_graphs.phe_threshold);
ui.po2Threshold->setValue(prefs.pp_graphs.po2_threshold);
ui.pn2Threshold->setValue(prefs.pp_graphs.pn2_threshold);
ui.maxppo2->setValue(prefs.mod_ppO2);
ui.red_ceiling->setChecked(prefs.profile_red_ceiling);
ui.units_group->setEnabled(ui.personalize->isChecked());
ui.gflow->setValue(prefs.gflow);
ui.gfhigh->setValue(prefs.gfhigh);
ui.gf_low_at_maxdepth->setChecked(prefs.gf_low_at_maxdepth);
// units
if (prefs.unit_system == METRIC)
ui.metric->setChecked(true);
else if (prefs.unit_system == IMPERIAL)
ui.imperial->setChecked(true);
else
ui.personalize->setChecked(true);
ui.celsius->setChecked(prefs.units.temperature == units::CELSIUS);
ui.fahrenheit->setChecked(prefs.units.temperature == units::FAHRENHEIT);
ui.meter->setChecked(prefs.units.length == units::METERS);
ui.feet->setChecked(prefs.units.length == units::FEET);
ui.bar->setChecked(prefs.units.pressure == units::BAR);
ui.psi->setChecked(prefs.units.pressure == units::PSI);
ui.liter->setChecked(prefs.units.volume == units::LITER);
ui.cuft->setChecked(prefs.units.volume == units::CUFT);
ui.kg->setChecked(prefs.units.weight == units::KG);
ui.lbs->setChecked(prefs.units.weight == units::LBS);
ui.font->setCurrentFont(QString(prefs.divelist_font));
ui.fontsize->setValue(prefs.font_size);
ui.defaultfilename->setText(prefs.default_filename);
ui.default_cylinder->clear();
for (int i = 0; tank_info[i].name != NULL; i++) {
ui.default_cylinder->addItem(tank_info[i].name);
if (prefs.default_cylinder && strcmp(tank_info[i].name, prefs.default_cylinder) == 0)
ui.default_cylinder->setCurrentIndex(i);
}
ui.displayinvalid->setChecked(prefs.display_invalid_dives);
ui.display_unused_tanks->setChecked(prefs.display_unused_tanks);
ui.vertical_speed_minutes->setChecked(prefs.units.vertical_speed_time == units::MINUTES);
ui.vertical_speed_seconds->setChecked(prefs.units.vertical_speed_time == units::SECONDS);
QSortFilterProxyModel *filterModel = new QSortFilterProxyModel();
filterModel->setSourceModel(LanguageModel::instance());
filterModel->setFilterCaseSensitivity(Qt::CaseInsensitive);
ui.languageView->setModel(filterModel);
filterModel->sort(0);
connect(ui.languageFilter, SIGNAL(textChanged(QString)), filterModel, SLOT(setFilterFixedString(QString)));
QSettings s;
s.beginGroup("Language");
ui.languageSystemDefault->setChecked(s.value("UseSystemLanguage", true).toBool());
QAbstractItemModel *m = ui.languageView->model();
QModelIndexList languages = m->match(m->index(0, 0), Qt::UserRole, s.value("UiLanguage").toString());
if (languages.count())
ui.languageView->setCurrentIndex(languages.first());
}
示例14: QWidget
SelectionGenesWidget::SelectionGenesWidget(const UserSelection::STDataFrame &data,
QWidget *parent, Qt::WindowFlags f)
: QWidget(parent, f)
, m_ui(new Ui::genesSelectionWidget())
{
m_ui->setupUi(this);
m_ui->searchField->setClearButtonEnabled(true);
m_ui->searchField->setFixedSize(CELL_PAGE_SUB_MENU_LINE_EDIT_SIZE);
m_ui->searchField->setStyleSheet(CELL_PAGE_SUB_MENU_LINE_EDIT_STYLE);
// data model
const int columns = 2;
const int rows = data.genes.size();
QStandardItemModel *model = new QStandardItemModel(rows,columns, this);
model->setHorizontalHeaderItem(0, new QStandardItem(QString("Gene")));
model->setHorizontalHeaderItem(1, new QStandardItem(QString("Count")));
// populate
for (uword i = 0; i < data.counts.n_cols; ++i) {
const QString gene = data.genes.at(i);
const float count = sum(data.counts.col(i));
const QString count_str = QString::number(count);
QStandardItem *gene_item = new QStandardItem(gene);
gene_item->setData(gene, Qt::UserRole);
gene_item->setData(gene, Qt::DisplayRole);
model->setItem(i, 0, gene_item);
QStandardItem *count_item = new QStandardItem(count_str);
count_item->setData(count, Qt::UserRole);
count_item->setData(count_str, Qt::DisplayRole);
model->setItem(i, 1, count_item);
}
// sorting model
QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
proxy->setSourceModel(model);
proxy->setSortCaseSensitivity(Qt::CaseInsensitive);
proxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
proxy->setSortRole(Qt::UserRole);
m_ui->tableview->setModel(proxy);
// settings for the table
m_ui->tableview->setSortingEnabled(true);
m_ui->tableview->setShowGrid(true);
m_ui->tableview->setWordWrap(true);
m_ui->tableview->setAlternatingRowColors(true);
m_ui->tableview->sortByColumn(0, Qt::AscendingOrder);
m_ui->tableview->setFrameShape(QFrame::StyledPanel);
m_ui->tableview->setFrameShadow(QFrame::Sunken);
m_ui->tableview->setGridStyle(Qt::SolidLine);
m_ui->tableview->setCornerButtonEnabled(false);
m_ui->tableview->setLineWidth(1);
m_ui->tableview->setSelectionBehavior(QAbstractItemView::SelectRows);
m_ui->tableview->setSelectionMode(QAbstractItemView::NoSelection);
m_ui->tableview->setEditTriggers(QAbstractItemView::NoEditTriggers);
m_ui->tableview->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch);
m_ui->tableview->horizontalHeader()->setSectionResizeMode(1, QHeaderView::Stretch);
m_ui->tableview->horizontalHeader()->setSortIndicatorShown(true);
m_ui->tableview->verticalHeader()->hide();
m_ui->tableview->model()->submit(); // support for caching (speed up)
// Connect the search field signal
connect(m_ui->searchField,
&QLineEdit::textChanged,
proxy,
&QSortFilterProxyModel::setFilterFixedString);
// allow to copy the content of the table
m_ui->tableview->setContextMenuPolicy(Qt::CustomContextMenu);
connect(m_ui->tableview, &QTableView::customContextMenuRequested,
this, &SelectionGenesWidget::customMenuRequested);
}
示例15: QFrame
CaptureDialog::CaptureDialog(ICaptureContext &ctx, OnCaptureMethod captureCallback,
OnInjectMethod injectCallback, MainWindow *main, QWidget *parent)
: QFrame(parent), ui(new Ui::CaptureDialog), m_Ctx(ctx), m_Main(main)
{
ui->setupUi(this);
ui->exePath->setFont(Formatter::PreferredFont());
ui->workDirPath->setFont(Formatter::PreferredFont());
ui->cmdline->setFont(Formatter::PreferredFont());
ui->processList->setFont(Formatter::PreferredFont());
// setup FlowLayout for options group
{
QLayout *oldLayout = ui->optionsGroup->layout();
QObjectList options = ui->optionsGroup->children();
options.removeOne((QObject *)oldLayout);
delete oldLayout;
FlowLayout *optionsFlow = new FlowLayout(ui->optionsGroup, -1, 3, 3);
optionsFlow->setFixedGrid(true);
for(QObject *o : options)
optionsFlow->addWidget(qobject_cast<QWidget *>(o));
ui->optionsGroup->setLayout(optionsFlow);
}
ui->envVar->setEnabled(false);
m_ProcessModel = new QStandardItemModel(0, 3, this);
m_ProcessModel->setHeaderData(0, Qt::Horizontal, tr("Name"));
m_ProcessModel->setHeaderData(1, Qt::Horizontal, tr("PID"));
m_ProcessModel->setHeaderData(2, Qt::Horizontal, tr("Window Title"));
QSortFilterProxyModel *proxy = new QSortFilterProxyModel(this);
proxy->setSourceModel(m_ProcessModel);
// filter on all columns
proxy->setFilterKeyColumn(-1);
// allow updating the underlying model
proxy->setDynamicSortFilter(true);
// use case-insensitive filtering
proxy->setFilterCaseSensitivity(Qt::CaseInsensitive);
ui->processList->setModel(proxy);
ui->processList->setAlternatingRowColors(true);
// sort by PID by default
ui->processList->sortByColumn(1, Qt::AscendingOrder);
// Set up warning for host layer config
initWarning(ui->vulkanLayerWarn);
ui->vulkanLayerWarn->setVisible(RENDERDOC_NeedVulkanLayerRegistration(NULL, NULL, NULL));
QObject::connect(ui->vulkanLayerWarn, &RDLabel::clicked, this,
&CaptureDialog::vulkanLayerWarn_mouseClick);
// Set up scanning for Android apps
initWarning(ui->androidScan);
// Set up warning for Android apps
initWarning(ui->androidWarn);
QObject::connect(ui->androidWarn, &RDLabel::clicked, this, &CaptureDialog::androidWarn_mouseClick);
m_AndroidFlags = AndroidFlags::NoFlags;
m_CaptureCallback = captureCallback;
m_InjectCallback = injectCallback;
SetSettings(CaptureSettings());
UpdateGlobalHook();
}