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


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

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


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

示例1: addProject

void ProjectChangesModel::addProject(IProject* p)
{
    QStandardItem* it = new QStandardItem(p->name());
    it->setData(p->name(), ProjectChangesModel::ProjectNameRole);
    IPlugin* plugin = p->versionControlPlugin();
    if(plugin) {
        IBasicVersionControl* vcs = plugin->extension<IBasicVersionControl>();

        auto info = ICore::self()->pluginController()->pluginInfo(plugin);

        it->setIcon(QIcon::fromTheme(info.iconName()));
        it->setToolTip(vcs->name());

        IBranchingVersionControl* branchingExtension = plugin->extension<KDevelop::IBranchingVersionControl>();
        if(branchingExtension) {
            const auto pathUrl = p->path().toUrl();
            branchingExtension->registerRepositoryForCurrentBranchChanges(pathUrl);
            // can't use new signal slot syntax here, IBranchingVersionControl is not a QObject
            connect(plugin, SIGNAL(repositoryBranchChanged(QUrl)), this, SLOT(repositoryBranchChanged(QUrl)));
            repositoryBranchChanged(pathUrl);
        } else
            reload(QList<IProject*>() << p);
    } else {
        it->setEnabled(false);
    }
    
    appendRow(it);
}
开发者ID:KDE,项目名称:kdevplatform,代码行数:28,代码来源:projectchangesmodel.cpp

示例2: appendInfo

void PluginsDialog::appendInfo(const LiteApi::PluginInfo *info)
{
    if (!info) {
        return;
    }
    QList<QStandardItem*> items;
    items.append(new QStandardItem(info->name()));
    QStandardItem *load = new QStandardItem();
    load->setCheckable(true);
    load->setData(info->id());
    if (info->isMustLoad()) {
        load->setEnabled(false);
    }
    bool b = m_liteApp->settings()->value(QString("liteapp/%1_load").arg(info->id()),true).toBool();
    if (b) {
        load->setCheckState(Qt::Checked);
    } else {
        load->setCheckState(Qt::Unchecked);
    }
    items.append(load);
    items.append(new QStandardItem(info->info()));
    items.append(new QStandardItem(info->author()));
    items.append(new QStandardItem(info->ver()));
    items.append(new QStandardItem(QFileInfo(info->filePath()).fileName()));
    items.at(5)->setToolTip(info->filePath());
    m_model->appendRow(items);
}
开发者ID:Gys,项目名称:liteide,代码行数:27,代码来源:pluginsdialog.cpp

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

示例4:

QStandardItem *ResultsTree::CreateCheckboxItem(bool checked)
{
    QStandardItem *item = new QStandardItem;
    item->setCheckable(true);
    item->setCheckState(checked ? Qt::Checked : Qt::Unchecked);
    item->setEnabled(false);
    return item;
}
开发者ID:lukecian,项目名称:cppcheck,代码行数:8,代码来源:resultstree.cpp

示例5: addSeparator

void DefaultFilterModel::addSeparator(const QString &caption)
{
    QList<QStandardItem *> newRow;
    QStandardItem *item = new QStandardItem(caption);
    item->setEnabled(false);
    item->setData(true, SeparatorRole);

    newRow << item;
    appendRow(newRow);
}
开发者ID:cmacq2,项目名称:plasma-workspace,代码行数:10,代码来源:kcategorizeditemsviewmodels.cpp

示例6: DirKnot

DirKnot * HPSKnotDirModel::creatNewDeactiveKnot(const QString &name, const bool isExpanded)
{
    DirKnot *newKnot = new DirKnot();
    newKnot->name = name;

    QStandardItem *newItem = new QStandardItem(name);
    newItem->setEnabled(false);
    newItem->setData(isExpanded,Qt::UserRole+1);
    newKnot->item = newItem;

    return newKnot;
}
开发者ID:abho,项目名称:HPicSync,代码行数:12,代码来源:hpsknotdirmodel.cpp

示例7: QWidget

FlightVisualization::FlightVisualization(QWidget * parent) :
    QWidget(parent), ui(new Ui::Form)
{
    ui->setupUi(this);
    popupPlaneSelector = new QListWidget();
    popupPlaneSelector->setWindowTitle(POPUP_SELECTOR_TITLE);
    QListWidgetItem * item = new QListWidgetItem(ALL_PLANES_LABEL,
            popupPlaneSelector);

    item->setCheckState(Qt::Checked);
    popupPlaneSelector->addItem(item);

    connect(ui -> flightPathCheckBox, SIGNAL(stateChanged(int)), this, SLOT(toggleFlightPath(int)));
    connect(ui -> wayPointCheckBox, SIGNAL(stateChanged(int)), this, SLOT(toggleWayPoints(int)));
    connect(ui -> webView, SIGNAL(loadFinished(bool)), this, SLOT(loadFinished(bool)));
    connect(ui -> autoCenterCheckBox, SIGNAL(stateChanged(int)), this, SLOT(toggleAutoCenter(int)));
    connect(ui -> autoFitCheckBox, SIGNAL(stateChanged(int)), this, SLOT(toggleAutoFit(int)));
    connect(ui->resetFlightPathButton, SIGNAL(clicked()), this,
            SLOT(resetFlightPaths()));
    connect(ui -> planeSelectorComboBox, SIGNAL(currentIndexChanged(int)), this, SLOT(setCurrentPlane(int)));
    connect(ui->selectPlaneButton, SIGNAL(clicked()), this,
            SLOT(showPlaneSelector()));
    connect(popupPlaneSelector, SIGNAL(itemClicked(QListWidgetItem*)), SLOT(togglePlaneVisibility(QListWidgetItem*)));
    QWebSettings::globalSettings()->setAttribute(QWebSettings::PluginsEnabled,
            true);
    ui->webView->setUrl(VIZ_MAP_URL);

    // http://stackoverflow.com/questions/12523753/sleep-inside-a-loop-that-uses-paintevent-in-qt-c
    connect(&_timer, SIGNAL(timeout()), this, SLOT(adjustMapCenter()));

    _timer.start(AUTO_CENTER_DURATION);

    //initialize everything in the active planes to the defaults. There is probably a better/more efficienct way to initialize the struct, but I was short on time.
    for (int i = 0; i < TOTAL_NUM_OF_PLANES; i++) {
        activePlanes[i].planeActive = false;
        activePlanes[i].latitude = 0;
        activePlanes[i].longitude = 0;
    }

    firstMessage = true;
    autoFitMap = false;
    currentPlane = INVALID_PLANE_ID;

    // prevent "select a plane" from being selectable
    QStandardItemModel * model = qobject_cast<QStandardItemModel *>(
                                     ui->planeSelectorComboBox->model());
    QModelIndex firstIndex = model->index(0,
                                          ui->planeSelectorComboBox->modelColumn(),
                                          ui->planeSelectorComboBox->rootModelIndex());
    QStandardItem * firstItem = model->itemFromIndex(firstIndex);
    firstItem->setEnabled(false);
}
开发者ID:CptMacHammer,项目名称:au_uav_pkg,代码行数:52,代码来源:flightvisualization.cpp

示例8: addDefaultNodes

void PluginDialog::addDefaultNodes()
{
    QList<QStandardItem *> rowItems;
    QStandardItem* scItem = new QStandardItem(QIcon(":/uploaders/screencloud.png"), "ScreenCloud");
    scItem->setData("screencloud", Qt::UserRole);
    //scItem->setEnabled(false);
    rowItems << scItem;
    QStandardItem* enableItem = new QStandardItem("");
    enableItem->setCheckable(true);
    enableItem->setCheckState(Qt::Checked);
    enableItem->setEnabled(false);
    rowItems << enableItem;
    categoryOnline->appendRow(rowItems);
}
开发者ID:Nothing4You,项目名称:screencloud,代码行数:14,代码来源:plugindialog.cpp

示例9: QWidget

InterceptWidget::InterceptWidget(IntercepSource * source, QWidget *parent) :
    QWidget(parent),
    source(source)
{
    currentBlockSource = NULL;
    currentGui = NULL;
    ui = new(std::nothrow) Ui::InterceptWidget;
    if (ui == NULL) {
        qFatal("Cannot allocate memory for Ui::InterceptWidget X{");
    }
    ui->setupUi(this);

    packetsTable = new(std::nothrow) QTableView(this);
    if (packetsTable == NULL) {
        qFatal("Cannot allocate memory for QTableView X{");
    }
    QAbstractItemModel *old = packetsTable->model();
    model = source->getModel();
    packetsTable->setModel(model);
    delete old;

    packetsTable->setSelectionMode(QAbstractItemView::ContiguousSelection);
    packetsTable->setSelectionBehavior(QAbstractItemView::SelectRows);
    packetsTable->verticalHeader()->setFont(RegularFont);
    packetsTable->horizontalHeader()->setFont(RegularFont);
    packetsTable->setColumnWidth(PayloadModel::TIMESPTAMP_COLUMN,TIMESTAMP_COLUMN_WIDTH);
    packetsTable->setColumnWidth(PayloadModel::DIRECTION_COLUMN,25);
    packetsTable->verticalHeader()->setDefaultSectionSize(20);
#if QT_VERSION >= 0x050000
    packetsTable->horizontalHeader()->setSectionsMovable( false );
#else
    packetsTable->horizontalHeader()->setMovable(true);
#endif
    connect(packetsTable->selectionModel(), SIGNAL(currentRowChanged(QModelIndex,QModelIndex)), SLOT(onCurrentSelectedChanged(QModelIndex,QModelIndex)));
    ui->listLayout->addWidget(packetsTable);

    updateColumns();

    sourceChoices << CHOOSE_TEXT << UDP_EXTERNAL_SOURCE_TEXT << TCP_EXTERNAL_SOURCE_TEXT << RAW_TCP_SOURCE_TEXT;
    ui->blockSourceComboBox->addItems(sourceChoices);
    ui->blockSourceComboBox->setCurrentIndex(0);
    QStandardItem * item = qobject_cast<QStandardItemModel *>(ui->blockSourceComboBox->model())->item(0);
    item->setEnabled( false );
    item->setTextAlignment(Qt::AlignCenter);
    item->setBackground(Qt::darkGray);
    item->setForeground(Qt::white);

    connect(ui->blockSourceComboBox, SIGNAL(currentIndexChanged(QString)), SLOT(onSourceChanged(QString)));
}
开发者ID:nccgroup,项目名称:pip3line,代码行数:49,代码来源:interceptwidget.cpp

示例10: load

void BarPackageModel::load(const QVariantList &datas)
{
clear();
setHorizontalHeaderLabels(QStringList()<<"application"<<"version");


foreach ( QVariant item, datas)
{


    QString rawName =item.toMap().value("name").toString();
    QString id =item.toMap().value("id").toString();
    QString version =item.toMap().value("version").toString();


    QStringList names = rawName.remove(id.replace("-",".")).split(".");




    QString name = names[names.length()-2];

    QStandardItem * nameItem = new QStandardItem(0);
    nameItem->setData(item);
    nameItem->setText(name);
    nameItem->setIcon(QIcon(":app.png"));
    if (rawName.contains("sys"))
    nameItem->setEnabled(false);

    QStandardItem * versionItem = new QStandardItem(1);
    versionItem->setText(version);

    QList<QStandardItem*> items;
    items.append(nameItem);
    items.append(versionItem);

    appendRow(items);




}
开发者ID:dridk,项目名称:QBarManager,代码行数:42,代码来源:barpackagemodel.cpp

示例11: QComboBox

OrchestratorChooser::OrchestratorChooser(GuiHelper *guiHelper, SourcesOrchestatorAbstract *orchestrator, QWidget *parent) :
    QComboBox(parent),
    orchestrator(orchestrator),
    guiHelper(guiHelper)
{

    addItem(tr("Select IO type"));
    QStandardItem * item = qobject_cast<QStandardItemModel *>(model())->item(0); // there is one and only one item right now
    item->setEnabled( false );
    addItems(SourcesOrchestatorAbstract::OrchestratorsList);

    setToolTip(tr("Select a configuration"));

    if (orchestrator != nullptr) {
        setCurrentIndex(orchestrator->getType());
    }

    //connect(this, qOverload<int>(&OrchestratorChooser::currentIndexChanged), this, &OrchestratorChooser::onSelection);
    connect(this, SIGNAL(currentIndexChanged(int)), this, SLOT(onSelection(int)));
}
开发者ID:metrodango,项目名称:pip3line,代码行数:20,代码来源:orchestratorchooser.cpp

示例12: QStandardItem

void repo::gui::RepoDialogUserManager::addUser(const core::RepoUser &user)
{
    QList<QStandardItem *> row;
    //--------------------------------------------------------------------------
    // User object itself
    QVariant var;
    var.setValue(user);

    QStandardItem *item = new QStandardItem();
    item->setData(var);
    item->setEnabled(true);
    item->setCheckable(true);
    item->setCheckState(Qt::Checked);
    item->setTristate(false);
    item->setEditable(false);
    row.append(item);

    // Username
    row.append(createItem(QString::fromStdString(user.getUsername())));

    // First Name
    row.append(createItem(QString::fromStdString(user.getFirstName())));

    // Last Name
    row.append(createItem(QString::fromStdString(user.getLastName())));

    // Email
    row.append(createItem(QString::fromStdString(user.getEmail())));

    // Projects count
    row.append(createItem((qulonglong)(user.getProjectsList().size())));

    // Groups count
    row.append(createItem((qulonglong)(user.getGroupsList().size())));

    // Roles count
    row.append(createItem((qulonglong)(user.getRolesList().size())));

    //--------------------------------------------------------------------------
    model->invisibleRootItem()->appendRow(row);
}
开发者ID:jmbertinat,项目名称:3drepogui,代码行数:41,代码来源:repodialogusermanager.cpp

示例13: QWidget

QgsMilXLibrary::QgsMilXLibrary( QgisInterface *iface, QWidget *parent )
    : QWidget( parent ), mIface( iface ), mLoader( 0 )
{
  setWindowFlags( Qt::Popup );
  setObjectName( "QgsMilXLibrary" );
  setStyleSheet( "QWidget#QgsMilXLibrary { background-color: white;}" );

  QVBoxLayout* layout = new QVBoxLayout( this );
  layout->setMargin( 2 );
  layout->setSpacing( 2 );
  setLayout( layout );

  mFilterLineEdit = new QgsFilterLineEdit( this );
  mFilterLineEdit->setPlaceholderText( tr( "Filter..." ) );
  layout->addWidget( mFilterLineEdit );
  connect( mFilterLineEdit, SIGNAL( textChanged( QString ) ), this, SLOT( filterChanged( QString ) ) );

  mTreeView = new QTreeView( this );
  mTreeView->setFrameShape( QTreeView::NoFrame );
  mTreeView->setEditTriggers( QTreeView::NoEditTriggers );
  mTreeView->setHeaderHidden( true );
  mTreeView->setIconSize( QSize( 32, 32 ) );
  layout->addWidget( mTreeView );
  connect( mTreeView, SIGNAL( clicked( QModelIndex ) ), this, SLOT( itemClicked( QModelIndex ) ) );

  mGalleryModel = new QStandardItemModel( this );
  mFilterProxyModel = new TreeFilterProxyModel( this );
  mFilterProxyModel->setSourceModel( mGalleryModel );

  mLoadingModel = new QStandardItemModel( this );
  QStandardItem* loadingItem = new QStandardItem( tr( "Loading..." ) );
  loadingItem->setEnabled( false );
  mLoadingModel->appendRow( loadingItem );

  setCursor( Qt::WaitCursor );
  mTreeView->setModel( mLoadingModel );
  mLoader = new QgsMilXLibraryLoader( this );
  connect( mLoader, SIGNAL( finished() ), this, SLOT( loaderFinished() ) );
  mLoader->start();
}
开发者ID:sourcepole,项目名称:kadas-albireo,代码行数:40,代码来源:qgsmilxlibrary.cpp

示例14: QStandardItem

QList<QStandardItem*> DkFileAssociationsPreference::getItems(const QString& filter, bool browse, bool reg) {

	QList<QStandardItem* > items;
	QStandardItem* item = new QStandardItem(filter);
	item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
	items.append(item);
	item = new QStandardItem("");
	//item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
	item->setCheckable(true);
	item->setCheckState(browse ? Qt::Checked : Qt::Unchecked);
	items.append(item);
	item = new QStandardItem("");
	//item->setFlags(Qt::Qt::ItemIsSelectable | Qt::ItemIsUserCheckable);
	item->setCheckable(true);
	item->setCheckState(reg ? Qt::Checked : Qt::Unchecked);
#ifndef Q_OS_WIN	// registering is windows only
	item->setEnabled(false);
#endif
	items.append(item);

	return items;

}
开发者ID:Messna,项目名称:nomacs,代码行数:23,代码来源:DkPreferenceWidgets.cpp

示例15: buildSavedCombo

void TransformsGui::buildSavedCombo()
{
    ui->savedComboBox->blockSignals(true);
    ui->savedComboBox->clear();
    int row = 0;
    // first inactive element
    ui->savedComboBox->addItem(QString("User's chains"));
    QStandardItem * item = qobject_cast<QStandardItemModel *>(ui->savedComboBox->model())->item( row );
    item->setEnabled( false );
    item->setTextAlignment(Qt::AlignCenter);
    item->setBackground(Qt::darkGray);
    item->setForeground(Qt::white);
    // then the rest
    QHash<QString, QString> hash = transformFactory->getSavedConfs();
    QStringList list = hash.keys();
    if (list.isEmpty()) {
        ui->savedComboBox->setEnabled(false);
    } else {
        ui->savedComboBox->addItems(list);
        ui->savedComboBox->setEnabled(true);
    }

    ui->savedComboBox->blockSignals(false);
}
开发者ID:yodamaster,项目名称:pip3line,代码行数:24,代码来源:transformsgui.cpp


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