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


C++ QStandardItem::setSelectable方法代码示例

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


在下文中一共展示了QStandardItem::setSelectable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: fillModel

void SoundThemeSelector::fillModel(const SoundTheme &theme)
{
	QStringList headers;
	headers.append(QT_TRANSLATE_NOOP("Notifications", "Type"));
	headers.append(QT_TRANSLATE_NOOP("SoundTheme", "Preview"));
	m_model->setHorizontalHeaderLabels(headers);

	for (int i = 0; i <= Notification::LastType; ++i) {
		Notification::Type type = static_cast<Notification::Type>(i);
		QList<QStandardItem *> items;

		QStandardItem *item = new QStandardItem(Notification::typeString(type));
		item->setToolTip(QT_TRANSLATE_NOOP("SoundTheme","Type"));
		item->setSelectable(false);
		items << item;

		item = new QStandardItem();
		item->setEditable(false);
		item->setIcon(Icon("media-playback-start"));
		item->setToolTip(QT_TRANSLATE_NOOP("SoundTheme","Play"));
		item->setEnabled(!theme.path(type).isNull());
		item->setSelectable(false);
		items << item;

		m_model->appendRow(items);
	}
	ui->treeView->header()->setSectionResizeMode(0, QHeaderView::Stretch);
}
开发者ID:Anderty,项目名称:qutim,代码行数:28,代码来源:soundthemeselector.cpp

示例2: valueWalker

    virtual QList<QStandardItem *> valueWalker(ExtcapValueList list, QStringList &defaults)
    {
        ExtcapValueList::iterator iter = list.begin();
        QList<QStandardItem *> items;

        while ( iter != list.end() )
        {
            QStandardItem * item = new QStandardItem((*iter).value());
            if ( (*iter).enabled() == false )
            {
                item->setSelectable(false);
            }
            else
                item->setSelectable(true);

            item->setData((*iter).call(), Qt::UserRole);
            if ((*iter).isDefault())
                defaults << (*iter).call();

            item->setEditable(false);
            QList<QStandardItem *> childs = valueWalker((*iter).children(), defaults);
            if ( childs.length() > 0 )
                item->appendRows(childs);

            items << item;
            ++iter;
        }

        return items;
    }
开发者ID:Nicholas1126,项目名称:wireshark-ex,代码行数:30,代码来源:extcap_argument.cpp

示例3: refresh

void NetworkUsageWindow::refresh()
{
    for (int i = 0; i < TOTAL_COUNTERS; i++)
    {
        DataCounters::CounterType counter = (DataCounters::CounterType) i;
        QString counterLabel;
        switch (counter)
        {
        case DataCounters::Messages:
            counterLabel = "Messages";
            break;
        case DataCounters::MessageBytes:
            counterLabel = "Messages bytes";
            break;
        case DataCounters::ImageBytes:
            counterLabel = "Images bytes";
            break;
        case DataCounters::VideoBytes:
            counterLabel = "Videos bytes";
            break;
        case DataCounters::AudioBytes:
            counterLabel = "Audio bytes";
            break;
        case DataCounters::ProfileBytes:
            counterLabel = "Profile pictures bytes";
            break;
        case DataCounters::SyncBytes:
            counterLabel = "Synchronization bytes";
            break;
        case DataCounters::ProtocolBytes:
            counterLabel = "Protocol bytes";
            break;
        case DataCounters::Total:
            counterLabel = "Total bytes";
            break;
        }

        int column = 0;
        QStandardItem *item = new QStandardItem(counterLabel);
        model->setItem(i, column++, item);
        item->setSelectable(false);
        qint64 bytes = Client::dataCounters.getReceivedBytes(i);
        QString str = (i > 0) ? Utilities::formatBytes(bytes)
                      : QString::number(bytes);
        item = new QStandardItem(str);
        item->setSelectable(false);
        item->setTextAlignment(Qt::AlignCenter);
        model->setItem(i, column++, item);
        bytes = Client::dataCounters.getSentBytes(i);
        str = (i > 0) ? Utilities::formatBytes(bytes)
              : QString::number(bytes);
        item = new QStandardItem(str);
        item->setSelectable(false);
        item->setTextAlignment(Qt::AlignCenter);
        model->setItem(i, column++, item);

    }
}
开发者ID:0xaaa,项目名称:yappari,代码行数:58,代码来源:networkusagewindow.cpp

示例4: QDialog

NewWidget::NewWidget(QWidget *parent) :
    QDialog(parent),
    ui(new Ui::NewWidget)
{
    ui->setupUi(this);


    this->setWindowFlags(Qt::SplashScreen);            //hide menu bar from dialog
    this->setAttribute(Qt::WA_TranslucentBackground);


    //Initialize ComboBox Status
    QStringList list=(QStringList()<<"--Select Type--"<<"String"<<"Char"<<"Bool"<<"Integer"<<"Double"<<"Float"<<"Long"<<"Short");
    ui->comboBox->addItems(list);
    ui->comboBox->setItemData(0,QColor(Qt::gray), Qt::BackgroundRole);

    QStandardItemModel* model =
            qobject_cast<QStandardItemModel*>(ui->comboBox->model());
    QModelIndex firstIndex = model->index(0, ui->comboBox->modelColumn(),
            ui->comboBox->rootModelIndex());
    QStandardItem* firstItem = model->itemFromIndex(firstIndex);
    firstItem->setSelectable(false);


}
开发者ID:reger-men,项目名称:annotator,代码行数:25,代码来源:newwidget.cpp

示例5: chaptersListUpdated

void MangaDownloadWidget::chaptersListUpdated(int status, QProcess::ExitStatus exitStatus) {
  switch (exitStatus) {
  case QProcess::CrashExit: {
    _messageModel->editMessageWarning("Warning: Chapters list update failed. Status code: "+QString::number(status));
    break;
  }
  case QProcess::NormalExit: {
    if (status == 1) {
      _messageModel->editMessageWarning("Warning: "+_getChaptersListProcess->readAllStandardError());
      _messageModel->editMessageError("Abort.");
    } else if (status == 0) {
      _messageModel->editMessageSuccess("Chapters list updated.");
    }
    break;
  }
  }

  if (_chaptersOnWebModel->rowCount() == 0) {
    QStandardItem* upToDateItem = new QStandardItem;
    upToDateItem->setData("Already up-to-date.", Qt::DisplayRole);
    upToDateItem->setEditable(false);
    upToDateItem->setSelectable(false);
    _chaptersOnWebModel->appendRow(upToDateItem);
  }

  _selectLineEdit->setEnabled(true);
  _updateButton->setEnabled(true);
  _downloadButton->setEnabled(true);
  _selectAllButton->setEnabled(true);
}
开发者ID:vmichele,项目名称:MangaReaderForLinux,代码行数:30,代码来源:MangaDownloadWidget.cpp

示例6: fillTitle

void fillTitle(QComboBox* combo, const QString& s) {
    combo->addItem(s);
    QStandardItem* item = lastItem(combo);
    QFont f;
    f.setBold(true);
    item->setFont(f);
    item->setSelectable(false);
}
开发者ID:mneumann,项目名称:tulip,代码行数:8,代码来源:AbstractFiltersManagerItem.cpp

示例7: d

LogViewFilterWidget::LogViewFilterWidget()
    : d(new LogViewFilterWidgetPrivate())
{
    QHBoxLayout *filterBarLayout = new QHBoxLayout();
    filterBarLayout->setMargin(0);
    setLayout(filterBarLayout);

    d->filterLine = new LogViewWidgetSearchLine();

    d->filterLine->setToolTip(i18n("Type your filter here"));
    d->filterLine->setWhatsThis(i18n("Allows you to only list items that match the content of this text."));
    d->filterLine->setPlaceholderText(i18n("Enter your search here..."));

    QLabel *filterIcon = new QLabel();
    filterIcon->setPixmap(SmallIcon(QStringLiteral("view-filter")));
    filterIcon->setBuddy(d->filterLine);
    filterBarLayout->addWidget(filterIcon);

    QLabel *filterLabel = new QLabel(i18n("Filter:"));
    filterLabel->setBuddy(d->filterLine);
    filterBarLayout->addWidget(filterLabel);

    filterBarLayout->addWidget(d->filterLine);

    initSearchListFilter();

    filterBarLayout->addWidget(d->filterList);

    d->prioritiesComboBox = new QComboBox(this);
    ComboBoxDelegate *delegate = new ComboBoxDelegate(d->prioritiesComboBox);
    d->prioritiesComboBox->setItemDelegate(delegate);
    filterBarLayout->addWidget(d->prioritiesComboBox);

    QMetaEnum &metaEnum = Globals::instance().logLevelsMetaEnum();

    d->prioritiesModel = new QStandardItemModel(d->prioritiesComboBox);
    d->prioritiesComboBox->setModel(d->prioritiesModel);

    QStandardItem *item = new QStandardItem(i18n("Select priorities"));
    item->setSelectable(false);
    d->prioritiesModel->appendRow(item);
    connect(d->prioritiesModel, &QStandardItemModel::itemChanged,
            this, &LogViewFilterWidget::prioritiesChanged);

    // Don't add last enum value into combobox.
    for (int i = 0; i < metaEnum.keyCount() - 1; i++) {
        int id = metaEnum.value(i);
        LogLevel *logLevel = Globals::instance().logLevelByPriority(id);

        QStandardItem *item = new QStandardItem(logLevel->name());
        item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
        item->setData(Qt::Checked, Qt::CheckStateRole);
        item->setData(metaEnum.value(i), Qt::UserRole);
        item->setData(QVariant(logLevel->color()), Qt::ForegroundRole);

        d->prioritiesModel->appendRow(item);
    }
}
开发者ID:KDE,项目名称:ksystemlog,代码行数:58,代码来源:logViewFilterWidget.cpp

示例8: QDialog

projectWindow::projectWindow(QWidget *parent, student_obj *student, studentpre_obj *preference) :
    QDialog(parent),
    ui(new Ui::projectWindow)
{

    ui->setupUi(this);
    user = student;
    userpref = preference;

    string Result;//string which will contain the result

    stringstream convert; // stringstream used for the conversion

    convert << user->getStudent_number();//add the value of Number to the characters in the stream

    Result = convert.str();//set Result to the content of the stream


    project_control pc;
    pc.SearchAllProject(&data);
    pc.SearchProjectofstudent(Result,&registeredProj);

    QStandardItemModel *stdModel = new QStandardItemModel(this);
    QStandardItemModel *stdModel2 = new QStandardItemModel(this);
    ui->listView->setModel(stdModel);
    ui->registerproject->setModel(stdModel2);
    for(int i=0; i<data.size();i++){
        QStandardItem* Item = new QStandardItem(QString::fromStdString(data[i]->getTitle()));
        Item->setEditable(false);
        Item->setSelectable(true);
        stdModel->appendRow(Item);
    }

    for(int j=0; j<registeredProj.size();j++){
        QStandardItem* Item = new QStandardItem(QString::fromStdString(registeredProj[j]->getTitle()));
        Item->setEditable(false);
        Item->setSelectable(true);
        stdModel2->appendRow(Item);
    }


}
开发者ID:forshakuras,项目名称:3004,代码行数:42,代码来源:projectwindow.cpp

示例9: QStandardItem

QStandardItem * m_table::addStandardItem(int line, int coll,QString val){

    QStandardItem * tmpItem = new QStandardItem(QString(val));
    tmpItem->setSelectable(true);
    tmpItem->setEditable(true);

    model->setItem(line, coll, tmpItem);


    return tmpItem;
}
开发者ID:Kiwhacks,项目名称:AlgoTeX,代码行数:11,代码来源:m_table.cpp

示例10: QDialog

ReloadPVDialog::ReloadPVDialog(QList<QString> reloadList, QWidget *parent) :
    QDialog(parent)
{
    QLabel *dialogMessage = new QLabel("Previous pvs detected--reload pvs?");

    QStandardItemModel *contentsModel  = new QStandardItemModel(this);
    connect( contentsModel , SIGNAL(itemChanged(QStandardItem*)), this, SLOT(onItemChanged(QStandardItem*)) );

    foreach (QString entry, reloadList)
    {
        QStandardItem *modelEntry = new QStandardItem(entry);
        modelEntry->setCheckable(true);
        modelEntry->setSelectable(false);
        contentsModel ->appendRow(modelEntry);
    }
开发者ID:anukat2015,项目名称:acquaman,代码行数:15,代码来源:ReloadPVDialog.cpp

示例11: showDataInTableView

void MainWindow::showDataInTableView(QStandardItemModel *tvModel,  QVector<QString> vGlobal){
    int j = 0;
    for(int i = 0; i < vGlobal.length()/2; i++)
    {
        for(int k = 0; k < 2; k++){
            QStandardItem *item = new QStandardItem(vGlobal.at(j));

            item->setEditable(false);
            item->setSelectable(false);
            tvModel->setItem(i, k, item);

            j++;
        }
    }
}
开发者ID:szledak,项目名称:EasyLearning,代码行数:15,代码来源:mainwindow.cpp

示例12: setupComboBox

void SkDebuggerGUI::setupComboBox() {
    fFilter.clear();
    fFilter.addItem("--Filter By Available Commands--");

    std::map<std::string, int> map;
    for (int i = 0; i < fDebugger.getSize(); i++) {
        map[fDebugger.getDrawCommandAt(i)->toString().c_str()]++;
    }

    for (std::map<std::string, int>::iterator it = map.begin(); it != map.end();
         ++it) {
        fFilter.addItem((it->first).c_str());
    }

    // NOTE(chudy): Makes first item unselectable.
    QStandardItemModel* model = qobject_cast<QStandardItemModel*>(
            fFilter.model());
    QModelIndex firstIndex = model->index(0, fFilter.modelColumn(),
            fFilter.rootModelIndex());
    QStandardItem* firstItem = model->itemFromIndex(firstIndex);
    firstItem->setSelectable(false);
}
开发者ID:afedorychak,项目名称:skia,代码行数:22,代码来源:SkDebuggerGUI.cpp

示例13: getSetFlags

void tst_QStandardItem::getSetFlags()
{
    QStandardItem item;
    item.setEnabled(true);
    QVERIFY(item.isEnabled());
    QVERIFY(item.flags() & Qt::ItemIsEnabled);
    item.setEditable(true);
    QVERIFY(item.isEditable());
    QVERIFY(item.flags() & Qt::ItemIsEditable);
    item.setSelectable(true);
    QVERIFY(item.isSelectable());
    QVERIFY(item.flags() & Qt::ItemIsSelectable);
    item.setCheckable(true);
    QVERIFY(item.isCheckable());
    QCOMPARE(item.checkState(), Qt::Unchecked);
    QVERIFY(item.flags() & Qt::ItemIsUserCheckable);
    item.setTristate(true);
    QVERIFY(item.isTristate());
    QVERIFY(item.flags() & Qt::ItemIsTristate);
#ifndef QT_NO_DRAGANDDROP
    item.setDragEnabled(true);
    QVERIFY(item.isDragEnabled());
    QVERIFY(item.flags() & Qt::ItemIsDragEnabled);
    item.setDropEnabled(true);
    QVERIFY(item.isDropEnabled());
    QVERIFY(item.flags() & Qt::ItemIsDropEnabled);
#endif
    
    QVERIFY(item.isEnabled());
    item.setEnabled(false);
    QVERIFY(!item.isEnabled());
    QVERIFY(!(item.flags() & Qt::ItemIsEnabled));
    QVERIFY(item.isEditable());
    item.setEditable(false);
    QVERIFY(!item.isEditable());
    QVERIFY(!(item.flags() & Qt::ItemIsEditable));
    QVERIFY(item.isSelectable());
    item.setSelectable(false);
    QVERIFY(!item.isSelectable());
    QVERIFY(!(item.flags() & Qt::ItemIsSelectable));
    QVERIFY(item.isCheckable());
    item.setCheckable(false);
    QVERIFY(!item.isCheckable());
    QVERIFY(!(item.flags() & Qt::ItemIsUserCheckable));
    QVERIFY(item.isTristate());
    item.setTristate(false);
    QVERIFY(!item.isTristate());
    QVERIFY(!(item.flags() & Qt::ItemIsTristate));
#ifndef QT_NO_DRAGANDDROP
    QVERIFY(item.isDragEnabled());
    item.setDragEnabled(false);
    QVERIFY(!item.isDragEnabled());
    QVERIFY(!(item.flags() & Qt::ItemIsDragEnabled));
    QVERIFY(item.isDropEnabled());
    item.setDropEnabled(false);
    QVERIFY(!item.isDropEnabled());
    QVERIFY(!(item.flags() & Qt::ItemIsDropEnabled));
#endif

    item.setCheckable(false);
    item.setCheckState(Qt::Checked);
    item.setCheckable(true);
    QCOMPARE(item.checkState(), Qt::Checked);
}    
开发者ID:maxxant,项目名称:qt,代码行数:64,代码来源:tst_qstandarditem.cpp

示例14: create_dir_item

/**
 * @brief Creates a new item with the specified directory name.
 * @param dir_name Name of a directory.
 * @return The created item.
 */
QStandardItem* ResourceModel::create_dir_item(const QString& dir_name) {

  QStandardItem* item = new QStandardItem(dir_name);
  item->setSelectable(false);
  return item;
}
开发者ID:MORTAL2000,项目名称:solarus-quest-editor,代码行数:11,代码来源:resource_model.cpp

示例15: InitWaveInfo

void PreferencesDialog::InitWaveInfo()
{
    QHash<MachineType, int> toprows;

    waveModel->clear();
    machlevel.clear();
    toprows.clear();
    QStringList headers;
    headers.append(tr("Name"));
    headers.append(tr("Color"));
    headers.append(tr("Overview"));
    headers.append(tr("Lower"));
    headers.append(tr("Upper"));
    headers.append(tr("Label"));
    headers.append(tr("Details"));
    waveModel->setHorizontalHeaderLabels(headers);
    ui->waveView->setColumnWidth(0, 200);
    ui->waveView->setColumnWidth(1, 40);
    ui->waveView->setColumnWidth(2, 60);
    ui->waveView->setColumnWidth(3, 50);
    ui->waveView->setColumnWidth(4, 50);
    ui->waveView->setColumnWidth(5, 100);
    ui->waveView->setSelectionMode(QAbstractItemView::SingleSelection);
    ui->waveView->setSelectionBehavior(QAbstractItemView::SelectItems);

    waveModel->setColumnCount(7);

    QStandardItem *hdr = nullptr;

    QMap<MachineType, QString> Section;

    Section[MT_CPAP] = tr("CPAP Waveforms");
    Section[MT_OXIMETER] = tr("Oximeter Waveforms");
    Section[MT_POSITION] = tr("Positional Waveforms");
    Section[MT_SLEEPSTAGE] = tr("Sleep Stage Waveforms");

    QMap<MachineType, QString>::iterator it;

    for (it = Section.begin(); it != Section.end(); ++it) {
        machlevel[it.key()] = hdr = new QStandardItem(it.value());
        hdr->setEditable(false);
        QList<QStandardItem *> list;
        list.append(hdr);
        for (int i=0; i<6; i++) {
            QStandardItem *it = new QStandardItem();
            it->setEnabled(false);
            list.append(it);
        }
        waveModel->appendRow(list);
    }

    ui->waveView->setAlternatingRowColors(true);

    // ui->graphView->setFirstColumnSpanned(0,daily->index(),true); // Crashes on windows.. Why do I need this again?

    QHash<QString, schema::Channel *>::iterator ci;

    SpinBoxDelegate * spinbox = new SpinBoxDelegate(ui->waveView);

    ui->waveView->setItemDelegateForColumn(3,spinbox);
    ui->waveView->setItemDelegateForColumn(4,spinbox);

    int row = 0;
    for (ci = schema::channel.names.begin(); ci != schema::channel.names.end(); ci++) {
        schema::Channel * chan = ci.value();
        if (chan->type() != schema::WAVEFORM) continue;

        QList<QStandardItem *> items;
        QStandardItem *it = new QStandardItem(chan->fullname());

        it->setCheckable(true);
        it->setCheckState(chan->enabled() ? Qt::Checked : Qt::Unchecked);
        it->setEditable(true);
        it->setData(chan->id(), Qt::UserRole);
        it->setToolTip(tr("Double click to change the descriptive name this channel."));
        items.push_back(it);

        it = new QStandardItem();
        it->setBackground(QBrush(chan->defaultColor()));
        it->setEditable(false);
        it->setData(chan->defaultColor().rgba(), Qt::UserRole);
        it->setToolTip(tr("Double click to change the default color for this channel plot/flag/data."));
        it->setSelectable(false);
        items.push_back(it);

        it = new QStandardItem();
        it->setCheckable(true);
        it->setCheckState(chan->showInOverview() ? Qt::Checked : Qt::Unchecked);
        it->setEditable(true);
        it->setData(chan->id(), Qt::UserRole);
        it->setToolTip(tr("Whether a breakdown of this waveform displays in overview."));
        items.push_back(it);


        it = new QStandardItem(QString::number(chan->lowerThreshold(),'f',1));
        it->setToolTip(tr("Here you can set the <b>lower</b> threshold used for certain calculations on the %1 waveform").arg(chan->fullname()));
        it->setEditable(true);
        items.push_back(it);

        it = new QStandardItem(QString::number(chan->upperThreshold(),'f',1));
//.........这里部分代码省略.........
开发者ID:frohoff,项目名称:sleepyhead,代码行数:101,代码来源:preferencesdialog.cpp


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