示例#1
0
FunctionsTreeWidget::FunctionsTreeWidget(Doc *doc, QWidget *parent) :
    QTreeWidget(parent)
  , m_doc(doc)
{
    sortItems(COL_NAME, Qt::AscendingOrder);

    QTreeWidgetItem *root = invisibleRootItem();
    root->setFlags(root->flags() & ~Qt::ItemIsDropEnabled);

    connect(this, SIGNAL(itemChanged(QTreeWidgetItem*,int)),
                this, SLOT(slotItemChanged(QTreeWidgetItem*)));
}
示例#2
0
// private
QTreeWidgetItem* QgsAuthSslConfigWidget::addRootItem( const QString &label )
{
  QTreeWidgetItem *item = new QTreeWidgetItem(
    QStringList() << label,
    ( int )ConfigParent );
  setItemBold_( item );
  item->setTextAlignment( 0, Qt::AlignVCenter );
  item->setFlags( item->flags() & ~Qt::ItemIsSelectable );
  treeSslConfig->insertTopLevelItem( treeSslConfig->topLevelItemCount(), item );

  return item;
}
void TrackSelectionDialog::AddDivider(const QString& text,
                                      QTreeWidget* parent) const {
  QTreeWidgetItem* item = new QTreeWidgetItem(parent);
  item->setFirstColumnSpanned(true);
  item->setText(0, text);
  item->setFlags(Qt::NoItemFlags);
  item->setForeground(0, palette().color(QPalette::Disabled, QPalette::Text));

  QFont bold_font(font());
  bold_font.setBold(true);
  item->setFont(0, bold_font);
}
void VisualizadorPropriedades::inseriRedePetri(QTreeWidgetItem *raiz, DRedePetri *redePetri)
{
    QTreeWidgetItem *item = new QTreeWidgetItem;
        item->setText(0, QString("Numero Lugares"));
        item->setText(1, QString("%1").arg(redePetri->getNumeroLugar()));
        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable |Qt::ItemIsEnabled);
    raiz->addChild(item);

    item = new QTreeWidgetItem;
        item->setText(0, QString("Numero Transicoes"));
        item->setText(1, QString("%1").arg(redePetri->getNumeroTramsicao()));
        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable |Qt::ItemIsEnabled);
    raiz->addChild(item);

    item = new QTreeWidgetItem;
        item->setText(0, QString("Numero Arcos"));
        item->setText(1, QString("%1").arg(redePetri->getNumeroArco()));
        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable |Qt::ItemIsEnabled);
        raiz->addChild(item);

}
示例#5
0
ProfileDialog::ProfileDialog(QWidget *parent) :
    GeometryStateDialog(parent),
    pd_ui_(new Ui::ProfileDialog),
    ok_button_(NULL)
{
    GList *fl_entry;
    profile_def *profile;
    const gchar *profile_name = get_profile_name();

    pd_ui_->setupUi(this);
    loadGeometry();
    setWindowTitle(wsApp->windowTitleString(tr("Configuration Profiles")));
    ok_button_ = pd_ui_->buttonBox->button(QDialogButtonBox::Ok);

    // XXX - Use NSImageNameAddTemplate and NSImageNameRemoveTemplate to set stock
    // icons on macOS.
    // Are there equivalent stock icons on Windows?
#ifdef Q_OS_MAC
    pd_ui_->newToolButton->setAttribute(Qt::WA_MacSmallSize, true);
    pd_ui_->deleteToolButton->setAttribute(Qt::WA_MacSmallSize, true);
    pd_ui_->copyToolButton->setAttribute(Qt::WA_MacSmallSize, true);
    pd_ui_->infoLabel->setAttribute(Qt::WA_MacSmallSize, true);
#endif

    init_profile_list();
    fl_entry = edited_profile_list();
    pd_ui_->profileTreeWidget->blockSignals(true);
    while (fl_entry && fl_entry->data) {
        profile = (profile_def *) fl_entry->data;
        QTreeWidgetItem *item = new QTreeWidgetItem(pd_ui_->profileTreeWidget);
        item->setText(0, profile->name);
        item->setData(0, Qt::UserRole, VariantPointer<GList>::asQVariant(fl_entry));

        if (profile->is_global || profile->status == PROF_STAT_DEFAULT) {
            QFont ti_font = item->font(0);
            ti_font.setItalic(true);
            item->setFont(0, ti_font);
        } else {
            item->setFlags(item->flags() | Qt::ItemIsEditable);
        }

        if (!profile->is_global && strcmp(profile_name, profile->name) == 0) {
            pd_ui_->profileTreeWidget->setCurrentItem(item);
        }

        fl_entry = g_list_next(fl_entry);
    }
    pd_ui_->profileTreeWidget->blockSignals(false);

    connect(pd_ui_->profileTreeWidget->itemDelegate(), SIGNAL(closeEditor(QWidget*, QAbstractItemDelegate::EndEditHint)),
            this, SLOT(editingFinished()));
    updateWidgets();
}
示例#6
0
QTreeWidgetItem *SoundPage::addItem(QTreeWidgetItem *groupItem, const QString &name, const QString &event)
{
	QTreeWidgetItem *item = new QTreeWidgetItem(TYPE_ITEM);
	item->setData(COLUMN_DATA, ROLE_EVENT, event);
	item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
	item->setCheckState(COLUMN_NAME, soundManager->eventEnabled(event) ? Qt::Checked : Qt::Unchecked);
	item->setText(COLUMN_NAME, name);
	item->setText(COLUMN_FILENAME, soundManager->eventFilename(event));
	groupItem->addChild(item);

	return item;
}
示例#7
0
文件: toc.cpp 项目: BlueBrain/Poppler
void TocDock::fillInfo()
{
    const QDomDocument *toc = document()->toc();
    if (toc) {
        fillToc(*toc, m_tree, 0);
    } else {
        QTreeWidgetItem *item = new QTreeWidgetItem();
        item->setText(0, tr("No TOC"));
        item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
        m_tree->addTopLevelItem(item);
    }
}
示例#8
0
void MainWindow::addDEItem(QString name, QString version)
{
    QTreeWidgetItem* item = new QTreeWidgetItem(ui->DEList);
    item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
    QFont font = item->font(0);
    font.setBold(true);
    item->setFont(0, font);
    item->setText(0, name);
    item->setText(1, version);

    ui->DEList->addTopLevelItem(item);
}
示例#9
0
void CastTreeViewer::onCastFolderAdded(const TFilePath &path) {
  QTreeWidgetItem *root = topLevelItem(0)->child(0);
  assert(root->data(1, Qt::DisplayRole).toString() ==
         toQString(getLevelSet()->getDefaultFolder()));
  QString childName     = QString::fromStdWString(path.getWideName());
  QString childPathQstr = QString::fromStdWString(path.getWideString());
  QTreeWidgetItem *childItem =
      new QTreeWidgetItem(root, QStringList(childName) << childPathQstr);
  childItem->setFlags(childItem->flags() | Qt::ItemIsEditable);
  root->addChild(childItem);
  setCurrentItem(childItem);
}
示例#10
0
void XbelTree::parseFolderElement(const QDomElement &element,
                                  QTreeWidgetItem *parentItem)
{
    QTreeWidgetItem *item = createItem(element, parentItem);

    QString title = element.firstChildElement("title").text();
    if (title.isEmpty())
        title = QObject::tr("Folder");

    item->setFlags(item->flags() | Qt::ItemIsEditable);
    item->setIcon(0, folderIcon);
    item->setText(0, title);

    bool folded = (element.attribute("folded") != "no");
    setItemExpanded(item, !folded);

    QDomElement child = element.firstChildElement();
    while (!child.isNull()) {
        if (child.tagName() == "folder") {
            parseFolderElement(child, item);
        } else if (child.tagName() == "bookmark") {
            QTreeWidgetItem *childItem = createItem(child, item);

            QString title = child.firstChildElement("title").text();
            if (title.isEmpty())
                title = QObject::tr("Folder");

            childItem->setFlags(item->flags() | Qt::ItemIsEditable);
            childItem->setIcon(0, bookmarkIcon);
            childItem->setText(0, title);
            childItem->setText(1, child.attribute("href"));
        } else if (child.tagName() == "separator") {
            QTreeWidgetItem *childItem = createItem(child, item);
            childItem->setFlags(item->flags() & ~(Qt::ItemIsSelectable | Qt::ItemIsEditable));
            childItem->setText(0, QString(30, 0xB7));
        }
        child = child.nextSiblingElement();
    }
}
示例#11
0
PLSelItem * PLSelector::addItem (
    SelectorItemType type, const char* str, bool drop,
    QTreeWidgetItem* parentItem )
{
    QTreeWidgetItem *item = parentItem ?
                            new QTreeWidgetItem( parentItem ) : new QTreeWidgetItem( this );
    PLSelItem *selItem = new PLSelItem( item, qtr( str ) );
    setItemWidget( item, 0, selItem );
    item->setData( 0, TYPE_ROLE, (int)type );
    if( !drop ) item->setFlags( item->flags() & ~Qt::ItemIsDropEnabled );

    return selItem;
}
void ManageInterfacesDialog::showLocalInterfaces()
{
    guint i;
    interface_t device;
    gchar *pr_descr = g_strdup("");
    char *comment = NULL;

    ui->localList->clear();
    for (i = 0; i < global_capture_opts.all_ifaces->len; i++) {
        device = g_array_index(global_capture_opts.all_ifaces, interface_t, i);
        if (device.local && device.type != IF_PIPE && device.type != IF_STDIN) {
            QTreeWidgetItem *item = new QTreeWidgetItem(ui->localList);
            item->setFlags(item->flags() | Qt::ItemIsEditable);
            if (prefs.capture_device && strstr(prefs.capture_device, device.name)) {
                // Force the default device to be checked.
                item->setFlags(item->flags() ^ Qt::ItemIsUserCheckable);
                item->setCheckState(col_l_show_, Qt::Checked);
            } else {
                item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
                item->setCheckState(col_l_show_, device.hidden ? Qt::Unchecked : Qt::Checked);
            }
#ifdef _WIN32
            item->setText(col_l_friendly_name_, device.friendly_name);
#endif
            item->setText(col_l_local_name_, device.name);

            comment = capture_dev_user_descr_find(device.name);
            if (comment) {
                item->setText(col_l_comment_, comment);
                g_free(comment);
            } else if (device.if_info.vendor_description) {
                item->setText(col_l_comment_, device.if_info.vendor_description);
            }
        } else {
            continue;
        }
    }
    g_free(pr_descr);
}
示例#13
0
void SettingsJavaPluginForm::loadInstalled()
{
	for (QMap<QString,QString>::iterator it = m_installedPlugins.begin(); it != m_installedPlugins.end(); it++)
	{
		QString name = it.key();
		name.remove(".jar");

		QTreeWidgetItem* i = new QTreeWidgetItem(treeInstalled, QStringList() << name << it.value());
		i->setFlags(i->flags() | Qt::ItemIsUserCheckable);
		i->setCheckState(0, Qt::Unchecked);
		treeInstalled->addTopLevelItem(i);
	}
}
示例#14
0
void CDialogSkinAuto::LoadSkel()
{
	const string skel = QFileDialog::getOpenFileName(this, tr("Charger un squelette"),
		"Model/", tr("Fichier squelette (*.chr)"));

	if (!skel.isEmpty())
	{
		QFileInfo fileInfo(skel);
		ModelMng->SetModelPath(fileInfo.path() % '/');
		CSkeleton* skl = ModelMng->GetSkeleton(fileInfo.fileName());

		if (skl)
		{
			Delete(m_mesh->m_skeleton);
			m_mesh->m_skeleton = skl;
			DeleteArray(m_mesh->m_bones);
			ui.bonesList->clear();
			m_items.clear();

			ui.skelName->setText(fileInfo.fileName());

			m_mesh->m_bones = new D3DXMATRIX[skl->GetBoneCount() * 2];
			m_mesh->m_invBones = m_mesh->m_bones + skl->GetBoneCount();
			skl->ResetBones(m_mesh->m_bones, m_mesh->m_invBones);

			QList<QTreeWidgetItem*> items;

			QTreeWidgetItem* item;
			Bone* bone;
			for (int i = 0; i < skl->GetBoneCount(); i++)
			{
				bone = &skl->m_bones[i];
				item = new QTreeWidgetItem(QStringList(bone->name));
				item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
				item->setCheckState(0, Qt::Unchecked);
				item->setData(0, Qt::UserRole + 1, QVariant(i));
				m_items[i] = item;

				if (bone->parentID == -1)
					items.append(item);
				else
					m_items[bone->parentID]->addChild(item);
			}

			ui.bonesList->insertTopLevelItems(0, items);
			ui.bonesList->expandAll();

			ui.okSkel->setEnabled(true);
		}
	}
}
示例#15
0
QTreeWidgetItem* FunctionsTreeWidget::parentItem(const Function* function)
{
    Q_ASSERT(function != NULL);

    // Special case for Sequences. They belong to a Scene node
    if (function->type() == Function::Chaser && qobject_cast<const Chaser*>(function)->isSequence() == true)
    {
        quint32 sid = qobject_cast<const Chaser*>(function)->getBoundSceneID();
        Function *sceneFunc = m_doc->function(sid);
        if (sceneFunc != NULL)
        {
            QTreeWidgetItem *sceneTopItem = folderItem(sceneFunc->path());
            if (sceneTopItem != NULL)
            {
                for (int i = 0; i < sceneTopItem->childCount(); i++)
                {
                    QTreeWidgetItem *child = sceneTopItem->child(i);
                    Q_ASSERT(child != NULL);

                    if (sid == itemFunctionId(child))
                        return child;
                }
            }
        }
    }

    QString basePath = Function::typeToString(function->type());
    if (m_foldersMap.contains(QString(basePath + "/")) == false)
    {
        // Parent item for the given type doesn't exist yet so create one
        QTreeWidgetItem* item = new QTreeWidgetItem(this);
        item->setText(COL_NAME, basePath);
        item->setIcon(COL_NAME, functionIcon(function));
        item->setData(COL_NAME, Qt::UserRole, Function::invalidId());
        item->setData(COL_NAME, Qt::UserRole + 1, function->type());
        item->setText(COL_PATH, QString(basePath + "/"));
        item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable | Qt::ItemIsDropEnabled);
        m_foldersMap[QString(basePath + "/")] = item;
    }

    QTreeWidgetItem *pItem = folderItem(function->path());

    if (pItem != NULL)
    {
        //qDebug() << "Found item for function:" << function->name() << ", path: " << function->path();
        return pItem;
    }


    return NULL;
}
void ApplicationsWindow::rebuildApplicationsList()
{
    //create categories
    QVector<QTreeWidgetItem*> categories;
    categories.resize(m_DataManager->categoriesCount());
    ui->treeWidgetApplications->clear();
    for (int i = 0; i<m_DataManager->categoriesCount(); i++){
        const sCategory* category = m_DataManager->categories(i);
        categories[i] = createTreeItemCategory(i,category->color,category->name);
        categories[i]->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEditable | Qt::ItemIsDropEnabled | Qt::ItemIsEnabled);
        ui->treeWidgetApplications->addTopLevelItem(categories[i]);

    }
    QTreeWidgetItem* uncategorized = createTreeItemCategory(-1,QColor(Qt::gray),tr("Uncategorized"));
    uncategorized->setFlags(Qt::ItemIsDropEnabled | Qt::ItemIsEnabled);
    ui->treeWidgetApplications->addTopLevelItem(uncategorized);

    //place applications in category
    int currentProfile = m_DataManager->getCurrentProfileIndex();
    for (int i = 0; i<m_DataManager->applicationsCount(); i++){
        const sAppInfo* app = m_DataManager->applications(i);

        QTreeWidgetItem* item = new QTreeWidgetItem(cApplicationsTreeWidget::TREE_ITEM_TYPE_APPLICATION);
        item->setText(0,app->name);
        item->setToolTip(0,app->path+"/"+app->name);
        item->setData(0,Qt::UserRole,i);
        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsDragEnabled | Qt::ItemIsEnabled);
        if (app->categories[currentProfile]==-1)
            uncategorized->addChild(item);
        else
            categories[app->categories[currentProfile]]->addChild(item);
    }

    //expand all categories
    uncategorized->setExpanded(true);
    for (int i = 0; i<categories.size(); i++)
        categories[i]->setExpanded(true);
}
示例#17
0
void OptionsTabPlugins::listPlugins()
{
	if ( !w )
		return;

	OptPluginsUI *d = (OptPluginsUI *)w;

	d->tw_Plugins->clear();

	PluginManager *pm=PluginManager::instance();

	QStringList plugins = pm->availablePlugins();
	plugins.sort();
	const QSize buttonSize = QSize(21,21);
	foreach ( const QString& plugin, plugins ){
		QIcon icon = pm->icon(plugin);
		bool enabled = pm->isEnabled(plugin);
		const QString path = pm->pathToPlugin(plugin);
		QString toolTip = tr("Plugin Path:\n%1").arg(path);
		Qt::CheckState state = enabled ? Qt::Checked : Qt::Unchecked;
		QTreeWidgetItem *item = new QTreeWidgetItem(d->tw_Plugins, QTreeWidgetItem::Type);
		item->setFlags(item->flags() | Qt::ItemIsUserCheckable);
		item->setText(C_NAME, plugin);
		item->setText(C_VERSION, pm->version(plugin));
		item->setTextAlignment(C_VERSION, Qt::AlignHCenter);
		item->setToolTip(C_NAME, toolTip);
		item->setCheckState(C_NAME, state);
		if ( !enabled ) {
			icon = QIcon(icon.pixmap(icon.availableSizes().at(0), QIcon::Disabled));
		}
		item->setIcon(C_NAME,icon);
		QString shortName = PluginManager::instance()->shortName(plugin);

		QToolButton *aboutbutton = new QToolButton(d->tw_Plugins);
		aboutbutton->setIcon(QIcon(IconsetFactory::iconPixmap("psi/info")));
		aboutbutton->resize(buttonSize);
		aboutbutton->setObjectName("ab_" + shortName);
		aboutbutton->setToolTip(tr("Show information about plugin"));
		connect(aboutbutton, SIGNAL(clicked()), this, SLOT(showPluginInfo()));
		d->tw_Plugins->setItemWidget(item, C_ABOUT, aboutbutton);

		QToolButton *settsbutton = new QToolButton(d->tw_Plugins);
		settsbutton->setIcon(QIcon(IconsetFactory::iconPixmap("psi/options")));
		settsbutton->resize(buttonSize);
		settsbutton->setObjectName("sb_" + shortName);
		settsbutton->setToolTip(tr("Open plugin settings dialog"));
		connect(settsbutton, SIGNAL(clicked()), this, SLOT(settingsClicked()));
		settsbutton->setEnabled(enabled);
		d->tw_Plugins->setItemWidget(item, C_SETTS, settsbutton);
	}
示例#18
0
bool EdgeWin::process_project(edgeconfig &conf) {
  QTime time; time.start();
  
  vector<QThread *> threads;  ProcessThread process_thread(project);
  threads.push_back((QThread*)&process_thread);
  progressDialog("Processing image stacks. Please wait.", threads);

  if(project->num_stacks() == 0) {
    delete project;
    project = NULL;
    QMessageBox::critical(this, tr("Error"), tr("Unable to laod any stacks. Please check parameters, and the stack file.") );
    return false;
  }

  // NOTE: update_gl() populates vertex buffers and must run in a single (main) thread.
  if(conf.use_GL_buffers) project->update_gl(); 


  view->setProject(project);
  view->setVol(project->stacks[0]);
  view->clearSelected();

  // Set slider positions.
  scrollTime->setRange(0, project->stacks.size() - 1); scrollTime->setSliderPosition(0);

  int width0 = project->stacks[0]->width(), height0 = project->stacks[0]->height(), depth0 = project->stacks[0]->depth();
  scrollXplane->setRange(0, width0 - 1);  scrollXplane->setSliderPosition(width0 / 2);
  scrollYplane->setRange(0, height0 - 1); scrollYplane->setSliderPosition(height0 / 2);
  scrollZplane->setRange(0, depth0 - 1);  scrollZplane->setSliderPosition(depth0 / 2);

  updateInfo();
  // Done setting slider positions.

  mTree->clear(); 
  mTree2Idx.clear();
  // TODO: Organize into noise, background, etc. at time point 0 get models 
  for(int idx = 0; idx < project->num_cells(0); idx++) {
    QString defaultText = tr("Model ") + QString::number(idx + 1);
    QTreeWidgetItem *modelItem = new QTreeWidgetItem(mTree, QStringList() << defaultText);
    modelItem->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
    mTree2Idx[modelItem] = idx;
  }
  view->updateGL();

  // Display an information box with processing information.
  QString procTimeStr = "Run completed in " + QString::number(float(time.elapsed()) / 1e3) +  " seconds.";
  QMessageBox::information(this, tr("Processing time"), procTimeStr);

  return true;
}
示例#19
0
void AddCharacterDialog::addState(const QString& state, const QString& imagePath)
{
    QTreeWidgetItem *item = new QTreeWidgetItem(mUi.statusTreeWidget);
    item->setText(0, state);
    item->setIcon(0, QIcon(imagePath));
    item->setData(0, Qt::UserRole, imagePath);
    item->setFlags(item->flags() | Qt::ItemIsEditable);
    QPushButton *removeBtn = new QPushButton(QIcon(":/media/delete.png"), "", mUi.statusTreeWidget);
    removeBtn->setFlat(true);
    connect(removeBtn, SIGNAL(clicked()), this, SLOT(removeState()));
    mUi.statusTreeWidget->setItemWidget(item, 1, removeBtn);
    for(int i=0; i < mUi.statusTreeWidget->columnCount(); i++)
        mUi.statusTreeWidget->resizeColumnToContents(i);
}
示例#20
0
QTreeWidgetItem *Component::getTreeWidgetItem()
{
    QTreeWidgetItem* item = new QTreeWidgetItem();
    item->setText(0, getName());
    item->setText(1, QString::number(getCost(),'f', 2));
    item->setText(2, QString::number(getPrice(),'f', 2));
    item->setText(3, QString::number(getMargin(),'f', 2)+"%");

    // hook for template method
    setAdditionalColumns(item);

    item->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled | Qt::ItemIsSelectable);
    return item;
}
void ColoringRulesDialog::addColoringRule(bool disabled, QString name, QString filter, QColor foreground, QColor background, bool start_editing)
{
    QTreeWidgetItem *ti = new QTreeWidgetItem(ui->coloringRulesTreeWidget);

    ti->setFlags(ti->flags() | Qt::ItemIsUserCheckable | Qt::ItemIsEditable);
    ti->setFlags(ti->flags() & ~(Qt::ItemIsDropEnabled));
    ti->setCheckState(name_col_, disabled ? Qt::Unchecked : Qt::Checked);
    ti->setText(name_col_, name);
    ti->setText(filter_col_, filter);

    for (int i = 0; i < ui->coloringRulesTreeWidget->columnCount(); i++) {
        ti->setForeground(i, foreground);
        ti->setBackground(i, background);
    }

    ui->coloringRulesTreeWidget->addTopLevelItem(ti);

    if (start_editing) {
        ui->coloringRulesTreeWidget->setCurrentItem(ti);
        updateWidgets();
        ui->coloringRulesTreeWidget->editItem(ti, filter_col_);
    }
}
void CGameObjectEditor::OnUIAddService()
{
	QListWidgetItem* selectedItem = m_ServiceTypeList->selectedItems().first();
	if( selectedItem )
	{
		QTreeWidgetItem* item = new QTreeWidgetItem();
		item->setText( 0, selectedItem->text() );
		item->setFlags( Qt::ItemIsSelectable | Qt::ItemIsEnabled );
		m_ServiceNode->addChild( item );
		m_ObjectTree->setColumnWidth( 0, 150 );
		
		m_ObjectTree->resizeColumnToContents( 0 );
	}
}
示例#23
0
void SummaryTree::addTask()
{
    Task *newTask = new Task;
    newTask->setAnswerFileExtension(settings->getDefaultOutputFileExtension());
    curContest->addTask(newTask);
    newTask->refreshCompilerConfiguration(settings);
    connect(newTask, SIGNAL(problemTitleChanged(QString)),
            this, SLOT(titleChanged(QString)));
    QTreeWidgetItem *newItem = new QTreeWidgetItem(this);
    setCurrentItem(newItem);
    newItem->setFlags(Qt::ItemIsEditable | Qt::ItemIsSelectable | Qt::ItemIsEnabled);
    newItem->setText(0, tr("Problem %1").arg(++ addCount));
    editItem(newItem);
}
/** Populates the module list with installed modules and orphaned indices */
void BtIndexPage::populateModuleList() {
	m_moduleList->clear();
		
	// populate installed modules
	m_modsWithIndices = new QTreeWidgetItem(m_moduleList);
	m_modsWithIndices->setText(0, tr("Works with indexes"));
	m_modsWithIndices->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsTristate);
	m_modsWithIndices->setExpanded(true);

	m_modsWithoutIndices = new QTreeWidgetItem(m_moduleList);
	m_modsWithoutIndices->setText(0, tr("Works without indexes"));
	m_modsWithoutIndices->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsTristate);
	m_modsWithoutIndices->setExpanded(true);



	QList<CSwordModuleInfo*>& modules = CPointers::backend()->moduleList();
	QList<CSwordModuleInfo*>::iterator end_it = modules.end();
	for (QList<CSwordModuleInfo*>::iterator it = modules.begin(); it != end_it; ++it) {
		QTreeWidgetItem* item = 0;
		
		if ((*it)->hasIndex()) {
			item = new QTreeWidgetItem(m_modsWithIndices);
			item->setText(0, (*it)->name());
			item->setText(1, QString("%1 ").arg((*it)->indexSize() / 1024) + tr("KiB"));
			item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
			item->setCheckState(0, Qt::Unchecked);
		}
		else {
			item = new QTreeWidgetItem(m_modsWithoutIndices);
			item->setText(0, (*it)->name());
			item->setText(1, QString("0 ") + tr("KiB"));
			item->setFlags(Qt::ItemIsUserCheckable | Qt::ItemIsEnabled);
			item->setCheckState(0, Qt::Checked);
		}
	}
}
void
TodaysPlanWorkoutDownload::refreshClicked()
{
    // reset download information
    status->setText("");
    downloads = fails = 0;
    download->show();
    close->show();
    files->clear(); // delete existing entries
    QString error;

    // check period - download is only possible for future workouts !
    if (from->date() < QDate::currentDate()) {
        QMessageBox::warning(this, tr("Today's Plan Workout Download"), QString(tr("You can only download future workouts, 'From' will be adjusted to current date")));
        from->setDate(QDate::currentDate());
    }
    if (from->date() > to->date()) {
        QMessageBox::warning(this, tr("Today's Plan Workout Download"), QString(tr("Invalid date range, please check your input.")));
        return;
    }

    QList<TodaysPlanWorkoutListEntry*> workouts = getFileList(error, from->dateTime(), to->dateTime());
    if (error != "") {
        QMessageBox::warning(this, tr("Today's Plan Workout Download"), QString(tr("The following error occured: %1").arg(error)));
        return;
    }


    foreach(TodaysPlanWorkoutListEntry *item, workouts) {

       QTreeWidgetItem *add = new QTreeWidgetItem(files->invisibleRootItem());
       add->setFlags(add->flags() | Qt::ItemIsEditable);

       // selector
       QCheckBox *checkBox = new QCheckBox("", this);
       checkBox->setChecked(true);
       files->setItemWidget(add, 0, checkBox);

       add->setText(1, item->planDate.toString(tr("dd MMM yyyy")));
       add->setText(2, item->description);
       add->setText(3, QString::number(item->tScore));
       add->setText(4, time_to_string_minutes(item->duration));

       // interval action
       add->setText(5, tr("Download"));

       // hide away the id
       add->setText(6, QString("%1").arg(item->workoutId));
    }
示例#26
0
void NewFormWidget::loadFrom(const QString &path, bool resourceFile, const QString &uiExtension,
                       const QString &selectedItem, QTreeWidgetItem *&selectedItemFound)
{
    const QDir dir(path);

    if (!dir.exists())
        return;

    // Iterate through the directory and add the templates
    const QFileInfoList list = dir.entryInfoList(QStringList(QLatin1String("*.") + uiExtension),
                                                 QDir::Files);

    if (list.isEmpty())
        return;

    const QChar separator = resourceFile ? QChar(QLatin1Char('/'))
                                         : QDir::separator();
    QTreeWidgetItem *root = new QTreeWidgetItem(m_ui->treeWidget);
    root->setFlags(root->flags() & ~Qt::ItemIsSelectable);
    // Try to get something that is easy to read.
    QString visiblePath = path;
    int index = visiblePath.lastIndexOf(separator);
    if (index != -1) {
        // try to find a second slash, just to be a bit better.
        const int index2 = visiblePath.lastIndexOf(separator, index - 1);
        if (index2 != -1)
            index = index2;
        visiblePath = visiblePath.mid(index + 1);
        visiblePath = QDir::toNativeSeparators(visiblePath);
    }

    const QChar underscore = QLatin1Char('_');
    const QChar blank = QLatin1Char(' ');
    root->setText(0, visiblePath.replace(underscore, blank));
    root->setToolTip(0, path);

    const QFileInfoList::const_iterator lcend = list.constEnd();
    for (QFileInfoList::const_iterator it = list.constBegin(); it != lcend; ++it) {
        if (!it->isFile())
            continue;

        QTreeWidgetItem *item = new QTreeWidgetItem(root);
        const QString text = it->baseName().replace(underscore, blank);
        if (selectedItemFound == 0 && text == selectedItem)
            selectedItemFound = item;
        item->setText(0, text);
        item->setData(0, TemplateNameRole, it->absoluteFilePath());
    }
}
示例#27
0
void PDFOutlineDock::fillInfo()
{
	tree->clear();
	const QDomDocument *toc = document->popplerDoc()->toc();
	if (toc) {
		fillToc(*toc, tree, 0);
		connect(tree, SIGNAL(itemSelectionChanged()), this, SLOT(followTocSelection()));
		delete toc;
	} else {
		QTreeWidgetItem *item = new QTreeWidgetItem();
		item->setText(0, tr("No TOC"));
		item->setFlags(item->flags() & ~Qt::ItemIsEnabled);
		tree->addTopLevelItem(item);
	}
}
示例#28
0
void HelpManual::buildContentTree(QTreeWidgetItem *parent, XMLNode TreeNode)
{
	XMLNode TempNode;
	QTreeWidgetItem *item;
	for (int i = 0; i < TreeNode.nChildNode("item"); ++i)
	{
		TempNode = TreeNode.getChildNode("item", i);
		item = new QTreeWidgetItem();
		item->setText(0, TempNode.getAttribute("name"));
		item->setText(1, TempNode.getAttribute("file"));
		item->setFlags(Qt::ItemIsEnabled|Qt::ItemIsSelectable);
		parent->addChild(item);
		buildContentTree(item, TempNode);
	}
}
示例#29
0
void ProfileDialog::on_newToolButton_clicked()
{
    QTreeWidgetItem *item = new QTreeWidgetItem();
    profile_def *profile;
    const gchar *name = "New profile";
    GList *fl_entry = add_to_profile_list(name, "", PROF_STAT_NEW, FALSE, FALSE);

    profile = (profile_def *) fl_entry->data;
    item->setText(0, profile->name);
    item->setData(0, Qt::UserRole, qVariantFromValue(fl_entry));
    item->setFlags(item->flags() | Qt::ItemIsEditable);
    pd_ui_->profileTreeWidget->addTopLevelItem(item);
    pd_ui_->profileTreeWidget->setCurrentItem(item);
    pd_ui_->profileTreeWidget->editItem(item, 0);
}
示例#30
0
void VCSliderProperties::levelUpdateCapabilityNode(QTreeWidgetItem* parent,
						   QLCCapability* cap)
{
	QTreeWidgetItem* item;
	QString str;

	Q_ASSERT(parent != NULL);
	Q_ASSERT(cap != NULL);

	item = new QTreeWidgetItem(parent);
	item->setText(KColumnName, cap->name());
	item->setText(KColumnRange, str.sprintf("%.3d - %.3d",
						cap->min(), cap->max()));
	item->setFlags(item->flags() & (~Qt::ItemIsUserCheckable));
}