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


C++ QTableWidgetItem::setFlags方法代码示例

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


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

示例1: QMainWindow

CameraSetup::CameraSetup(ros::NodeHandle& nh, ros::NodeHandle& nh_private, QWidget *parent, Qt::WFlags flags) :
    QMainWindow(parent, flags), nh_(nh), nh_private_(nh_private), quit_threads_(false), broadcaster_(0)
{
  ui.setupUi(this);

  nh_private_.param("camera_n", camera_n_, 2);
  ROS_DEBUG("Total camera: %d", camera_n_);

  broadcaster_.resize(camera_n_);
  camera_parameter_.resize(camera_n_);
  camera_tf_.resize(camera_n_);

  ui.tableWidget->setRowCount(camera_n_*2);
  ui.tableWidget->setColumnCount(10);
  ui.tableWidget->setHorizontalHeaderItem(0, new QTableWidgetItem(QString("Camera")));
  ui.tableWidget->setHorizontalHeaderItem(1, new QTableWidgetItem(QString("Tx")));
  ui.tableWidget->setHorizontalHeaderItem(2, new QTableWidgetItem(QString("Ty")));
  ui.tableWidget->setHorizontalHeaderItem(3, new QTableWidgetItem(QString("Tz")));
  ui.tableWidget->setHorizontalHeaderItem(4, new QTableWidgetItem(QString("Rx")));
  ui.tableWidget->setHorizontalHeaderItem(5, new QTableWidgetItem(QString("Ry")));
  ui.tableWidget->setHorizontalHeaderItem(6, new QTableWidgetItem(QString("Rz")));
  ui.tableWidget->setHorizontalHeaderItem(7, new QTableWidgetItem(QString("Rw")));
  ui.tableWidget->setHorizontalHeaderItem(8, new QTableWidgetItem(QString("Source")));
  ui.tableWidget->setHorizontalHeaderItem(9, new QTableWidgetItem(QString("Target")));

  for (int i = 0; i < camera_n_; i++)
  {
    string camera_parameter_text;
    nh_private_.param((QString("camera_%1").arg(i)).toStdString(), camera_parameter_text, string(""));
    ROS_DEBUG("Camera %d parameter: %s", i, camera_parameter_text.c_str());
    QStringList tokens = QString(camera_parameter_text.c_str()).split(' ');
    ROS_DEBUG("Camera %d parameter count: %d", i, tokens.size());
    if(tokens.size() != 10)
    {
      ROS_ERROR("camera %d paparmeter count is not correct", i);
      continue;
    }

    int j = 0;
    foreach(QString text, tokens)
    {
      QTableWidgetItem* item = new QTableWidgetItem(text);
      Qt::ItemFlags f = item->flags() & ~Qt::ItemIsEditable;
      item->setFlags(f);
      ui.tableWidget->setItem(i*2, j, item);
      j++;
    }

    CameraParameter parameter;
    parameter.name = tokens[0].toStdString();
    parameter.tf.setOrigin(tf::Vector3(tokens[1].toDouble(), tokens[2].toDouble(), tokens[3].toDouble()));
    parameter.tf.setRotation(tf::Quaternion(tokens[4].toDouble(), tokens[5].toDouble(), tokens[6].toDouble(), tokens[7].toDouble()));
    parameter.source = tokens[8].toStdString();
    parameter.target = tokens[9].toStdString();
    camera_tf_[i] = parameter.tf;
    camera_parameter_[i] = parameter;

    ui.tableWidget->setItem(i*2 + 1, 1, new QTableWidgetItem("0"));
    ui.tableWidget->setItem(i*2 + 1, 2, new QTableWidgetItem("0"));
    ui.tableWidget->setItem(i*2 + 1, 3, new QTableWidgetItem("0"));
    ui.tableWidget->setItem(i*2 + 1, 4, new QTableWidgetItem("0"));
    ui.tableWidget->setItem(i*2 + 1, 5, new QTableWidgetItem("0"));
    ui.tableWidget->setItem(i*2 + 1, 6, new QTableWidgetItem("0"));
    ui.tableWidget->setItem(i*2 + 1, 7, new QTableWidgetItem());
    ui.tableWidget->setItem(i*2 + 1, 8, new QTableWidgetItem());
    ui.tableWidget->setItem(i*2 + 1, 9, new QTableWidgetItem());
    Qt::ItemFlags f = ui.tableWidget->item(i*2 + 1, 7)->flags() & ~Qt::ItemIsEditable;
    ui.tableWidget->item(i*2 + 1, 7)->setFlags(f);
    ui.tableWidget->item(i*2 + 1, 8)->setFlags(f);
    ui.tableWidget->item(i*2 + 1, 9)->setFlags(f);

    ui.tableWidget->setItemDelegateForRow(i*2+1, new DoubleSpinBoxDelegate());
  }
开发者ID:cuixiongyi,项目名称:hiveground-ros-pkg,代码行数:73,代码来源:camera_setup.cpp

示例2: QDialog

FQTermShortcutDialog::FQTermShortcutDialog(FQTermShortcutHelper* helper, QWidget *parent_, Qt::WindowFlags fl)
  : QDialog(parent_, fl),
    helper_(helper),
    table_(NULL) {
  setWindowTitle(tr("Shortcut Setting"));
  //grabKeyboard();
  if (helper_)
  {
    QSignalMapper* signalMapper = new QSignalMapper(this);
    int row = FQTermShortcutHelper::FQTERM_APPLICATION_SHORTCUT_END - FQTermShortcutHelper::FQTERM_APPLICATION_SHORTCUT_START - 1;
    int column = 3;
    table_ = new QTableWidget(row, column, this);
    table_->clear();
    QStringList header;
    header << tr("Description") << tr("Shortcut") << "";
    table_->setHorizontalHeaderLabels(header);
    for (int i = 0; i < row; ++i) {
      for (int j = 0; j < column; ++j) {
        if (j == 0) {
          QTableWidgetItem* item = new QTableWidgetItem;
          table_->setItem(i, j, item);
          item->setFlags(item->flags() & ~Qt::ItemIsEditable);
          item->setText(helper_->getShortcutDescription(i + 1));
        } else if (j == 1) {
          FQTermShortcutTableWidget* stw = new FQTermShortcutTableWidget(table_);
          stw->setReadOnly(true);
          stw->setText(helper_->getShortcutText(i + 1));
          table_->setCellWidget(i, j, stw);
        }else {
          QPushButton* btn = new QPushButton(tr("default"), table_);
          table_->setCellWidget(i, j, btn);
          FQ_VERIFY(connect(btn, SIGNAL(clicked()), signalMapper, SLOT(map())));
         signalMapper->setMapping(btn, i);
        }
      }
    }
    table_->resizeColumnsToContents();
    int tableWidth = table_->horizontalHeader()->length();
    if (table_->horizontalScrollBar() && table_->horizontalScrollBar()->isVisible()) {
      tableWidth += table_->horizontalScrollBar()->width();
    }
    QPushButton* okBtn = new QPushButton(tr("OK"), this);
    FQ_VERIFY(connect(okBtn, SIGNAL(clicked()), this, SLOT(okBtnClicked())));
    QPushButton* applyBtn = new QPushButton(tr("Apply"), this);
    FQ_VERIFY(connect(applyBtn, SIGNAL(clicked()), this, SLOT(applyBtnClicked())));
    QPushButton* cancelBtn = new QPushButton(tr("Cancel"), this);
    FQ_VERIFY(connect(cancelBtn, SIGNAL(clicked()), this, SLOT(cancelBtnClicked())));
    QPushButton* resetBtn = new QPushButton(tr("Reset All"), this);
    FQ_VERIFY(connect(resetBtn, SIGNAL(clicked()), this, SLOT(resetBtnClicked())));
    setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
    QGridLayout* layout = new QGridLayout(this);
    QLabel* label = new QLabel(tr("Press key/combines on Shortcut column.\nNote Del is reserved for clear shortcut setting."));
    layout->addWidget(label, 0, 0, 1, -1);
    layout->addWidget(table_, 1, 0, 1, -1);
    layout->addWidget(okBtn, 2, 0);
    layout->addWidget(applyBtn, 2, 1);
    layout->addWidget(cancelBtn, 2, 2);
    layout->addWidget(resetBtn, 2, 3);
    setLayout(layout);
    int left = 0;
    int right = 0;
    layout->getContentsMargins(&left, NULL, &right, NULL);
    table_->horizontalHeader()->setStretchLastSection(true);
    tableWidth *= 1.1;
    resize(tableWidth + left + right, height());
    FQ_VERIFY(connect(signalMapper, SIGNAL(mapped(int)),this, SLOT(defaultClicked(int))));
  }
}
开发者ID:ashang,项目名称:fqterm,代码行数:68,代码来源:shortcutdialog.cpp

示例3: loadBackTraceAndVariableData

void AppDockWidget::loadBackTraceAndVariableData()
{
    reactvariable = 0;

    QString registerFilePath = mainwindow->GetCurrentWorkDir();
    QString registerFile = registerFilePath + "/test/info_backtrace.txt";

    QFile inputFile(registerFile);
    inputFile.open(QIODevice::ReadOnly);
    if (inputFile.size() != 0)
    {
        QTextStream in(&inputFile);
        int i = 0;
        int j = 0;
        QTableWidgetItem *item;
        ui.backTraceTableWidget->clearContents();
        ui.variableTableWidget->clearContents();
        while (!in.atEnd())
        {

            QString lineFunction = in.readLine();

            QString lineVariable = in.readLine();
            if(lineFunction.isEmpty() || lineVariable.isEmpty())
            {
                QMessageBox::about(this, tr("notice"), tr("the file is null"));
                return;
            }

            if (i == 0)
            {
                QStringList lineIncludePC = lineFunction.split("at:");
                lineFunction = lineIncludePC[0];
            }
            QStringList lineFunctionList = lineFunction.split(':');

            item = new QTableWidgetItem(lineFunctionList[0]);
            item->setTextAlignment(Qt::AlignHCenter);
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);

            ui.backTraceTableWidget->setItem(i, 0, item);

            item = new QTableWidgetItem(lineFunctionList[1]);
            item->setTextAlignment(Qt::AlignHCenter);
            item->setFlags(item->flags() & ~Qt::ItemIsEditable);

            ui.backTraceTableWidget->setItem(i, 1, item);
            i++;

            QStringList lineVariableList = lineVariable.split(',');

            int k = 0;
            while (k < lineVariableList.count())
            {
                QStringList lineVariableList1 = lineVariableList[k].split('=');

                item = new QTableWidgetItem(lineVariableList1[0]);
                item->setTextAlignment(Qt::AlignHCenter);
                item->setFlags(item->flags() & ~Qt::ItemIsEditable);

                ui.variableTableWidget->setItem(j, 0, item);
                item = new QTableWidgetItem(lineVariableList1[1]);
                item->setTextAlignment(Qt::AlignHCenter);

                item->setFlags(Qt::ItemIsEditable | Qt::ItemIsEnabled);//使变量值这一列可编辑
                ui.variableTableWidget->setItem(j, 1, item);
                k++;
                j++;

            }

        }
    }
    inputFile.close();
    reactvariable = 1;
}
开发者ID:DefineSun,项目名称:Hust_Debug_v3.0,代码行数:76,代码来源:appdockwidget.cpp

示例4: fillAllAutoProfilesTable

void MainSettingsDialog::fillAllAutoProfilesTable()
{
    for (int i = ui->autoProfileTableWidget->rowCount()-1; i >= 0; i--)
    {
        ui->autoProfileTableWidget->removeRow(i);
    }

    //QStringList tableHeader;
    //tableHeader << tr("Active") << tr("GUID") << tr("Profile") << tr("Application") << tr("Default?")
    //            << tr("Instance");
    //ui->autoProfileTableWidget->setHorizontalHeaderLabels(tableHeader);

    ui->autoProfileTableWidget->horizontalHeader()->setVisible(true);

#if (QT_VERSION >= QT_VERSION_CHECK(5, 0, 0))
    ui->autoProfileTableWidget->horizontalHeader()->setSectionResizeMode(QHeaderView::Stretch);
#else
    ui->autoProfileTableWidget->horizontalHeader()->setResizeMode(QHeaderView::Stretch);
#endif

    ui->autoProfileTableWidget->hideColumn(5);

    int i = 0;

    AutoProfileInfo *info = allDefaultProfile;

    ui->autoProfileTableWidget->insertRow(i);
    QTableWidgetItem *item = new QTableWidgetItem();
    item->setCheckState(info->isActive() ? Qt::Checked : Qt::Unchecked);
    ui->autoProfileTableWidget->setItem(i, 0, item);

    QString deviceName = info->getDeviceName();
    QString guidDisplay = info->getGUID();
    if (!deviceName.isEmpty())
    {
        guidDisplay = QString("%1 ").arg(info->getDeviceName());
        guidDisplay.append(QString("(%1)").arg(info->getGUID()));
    }
    item = new QTableWidgetItem(guidDisplay);
    item->setFlags(item->flags() & ~Qt::ItemIsEditable);
    item->setData(Qt::UserRole, info->getGUID());
    item->setToolTip(info->getGUID());
    ui->autoProfileTableWidget->setItem(i, 1, item);

    QFileInfo profilePath(info->getProfileLocation());
    item = new QTableWidgetItem(profilePath.fileName());
    item->setFlags(item->flags() & ~Qt::ItemIsEditable);
    item->setData(Qt::UserRole, info->getProfileLocation());
    item->setToolTip(info->getProfileLocation());
    ui->autoProfileTableWidget->setItem(i, 2, item);

    QFileInfo exeInfo(info->getExe());
    item = new QTableWidgetItem(exeInfo.fileName());
    item->setFlags(item->flags() & ~Qt::ItemIsEditable);
    item->setData(Qt::UserRole, info->getExe());
    item->setToolTip(info->getExe());
    ui->autoProfileTableWidget->setItem(i, 3, item);

    item = new QTableWidgetItem("Default");
    item->setData(Qt::UserRole, "default");
    ui->autoProfileTableWidget->setItem(i, 4, item);

    item = new QTableWidgetItem("Instance");
    item->setData(Qt::UserRole, QVariant::fromValue<AutoProfileInfo*>(info));
    ui->autoProfileTableWidget->setItem(i, 5, item);

    i++;

    QListIterator<AutoProfileInfo*> iterDefaults(defaultList);
    while (iterDefaults.hasNext())
    {
        AutoProfileInfo *info = iterDefaults.next();
        ui->autoProfileTableWidget->insertRow(i);

        QTableWidgetItem *item = new QTableWidgetItem();
        item->setCheckState(info->isActive() ? Qt::Checked : Qt::Unchecked);
        ui->autoProfileTableWidget->setItem(i, 0, item);

        QString deviceName = info->getDeviceName();
        QString guidDisplay = info->getGUID();
        if (!deviceName.isEmpty())
        {
            guidDisplay = QString("%1 ").arg(info->getDeviceName());
            guidDisplay.append(QString("(%1)").arg(info->getGUID()));
        }

        item = new QTableWidgetItem(guidDisplay);
        item->setFlags(item->flags() & ~Qt::ItemIsEditable);
        item->setData(Qt::UserRole, info->getGUID());
        item->setToolTip(info->getGUID());
        ui->autoProfileTableWidget->setItem(i, 1, item);

        QFileInfo profilePath(info->getProfileLocation());
        item = new QTableWidgetItem(profilePath.fileName());
        item->setFlags(item->flags() & ~Qt::ItemIsEditable);
        item->setData(Qt::UserRole, info->getProfileLocation());
        item->setToolTip(info->getProfileLocation());
        ui->autoProfileTableWidget->setItem(i, 2, item);

        QFileInfo exeInfo(info->getExe());
//.........这里部分代码省略.........
开发者ID:Xatory,项目名称:antimicro,代码行数:101,代码来源:mainsettingsdialog.cpp

示例5: search

void ClassSpaceChecker::search(const QString & searchName, const QString & searchText, 
							bool useUncryptName, 
							bool ignoreInnerClass, 
							bool onlyAnonymousClass, 
							bool useAsPackageName) 
{
	if(classList_.size() <= 0)
		return;

	ui.tableWidgetResult->clearContents();
	ui.tableWidgetResult->setRowCount(0);
	ui.tableWidgetResult->horizontalHeader()->setSortIndicator(-1, Qt::AscendingOrder);

	long totalSize = 0;
	int rowCount = 0;
	int methodCount = 0;
	QList<ClassFileContext*>::iterator it = classList_.begin();
	for(; it != classList_.end(); it++)
	{
		int col = 0;
		const ClassFileContext* ctx = *it;

		int markPos = ctx->originalName.indexOf("$");
		if(ignoreInnerClass && markPos > 0)
			continue;

		if(onlyAnonymousClass) 
		{
			QString right = ctx->originalName.mid(markPos + 1);
			int anonymousId = right.toUInt();
			if(anonymousId <= 0) 
				continue;
		}

		if(useAsPackageName)
		{
			int posTemp = ctx->originalName.indexOf(searchName);
			if(posTemp < 0)
				continue;
			posTemp = ctx->originalName.indexOf(".", posTemp + searchName.length() + 1);
			if(posTemp > 0)
				continue;
		}
		else 
		{
			if(searchName.isEmpty() == false)
			{
				if(useUncryptName)
				{
					if(ctx->originalName.contains(QRegExp(searchName, Qt::CaseInsensitive)) == false)
						continue;
				}
				else
				{
					if(ctx->className.contains(QRegExp(searchName, Qt::CaseInsensitive)) == false)
						continue;
				}
			}
		}

		if(searchText.isEmpty() == false)
		{
			if(ctx->javaFileFlag) 
			{
				QString decompiledBufferStr = ctx->decompiledBuffer;
				if(decompiledBufferStr.contains(QRegExp(searchText, Qt::CaseSensitive)) == false)
					continue;
			}
			else
			{
				if(ctx->decompiledBuffer.contains(searchText.toStdString().c_str()) == false)
					continue;
			}
		}

		QString space = QString::number(ctx->fileSize);

		ui.tableWidgetResult->insertRow(rowCount);

		QTableWidgetItem *itemOriginal = new QTableWidgetItem(ctx->className);
		itemOriginal->setFlags(itemOriginal->flags() & ~Qt::ItemIsEditable);
		itemOriginal->setData(Qt::UserRole, qVariantFromValue((void *)ctx));
		ui.tableWidgetResult->setItem(rowCount, col++, itemOriginal);

		QTableWidgetItem *itemSize = new QTableWidgetItem();
		itemSize->setData(Qt::DisplayRole, ctx->fileSize);
		itemSize->setFlags(itemSize->flags() & ~Qt::ItemIsEditable);
		ui.tableWidgetResult->setItem(rowCount, col++, itemSize);

		QString uncryptName = ctx->originalName;
		if(currentMapPath_.isEmpty())
			uncryptName = "-";
		QTableWidgetItem *itemUncrypt = new QTableWidgetItem(uncryptName);
		itemUncrypt->setFlags(itemUncrypt->flags() & ~Qt::ItemIsEditable);
		ui.tableWidgetResult->setItem(rowCount, col++, itemUncrypt);
		
		QTableWidgetItem *itemMethodCount = new QTableWidgetItem();
		itemMethodCount->setData(Qt::DisplayRole, ctx->methodCount);
		itemMethodCount->setFlags(itemMethodCount->flags() & ~Qt::ItemIsEditable);
		ui.tableWidgetResult->setItem(rowCount, col++, itemMethodCount);
//.........这里部分代码省略.........
开发者ID:gunoodaddy,项目名称:ClassSpaceChecker,代码行数:101,代码来源:classspacechecker.cpp

示例6: PopulateGameGrid

void game_list_frame::PopulateGameGrid(uint maxCols, const QSize& image_size)
{
	uint r = 0;
	uint c = 0;

	std::string selected_item = CurrentSelectionIconPath();

	delete m_xgrid;

	bool showText = m_Icon_Size_Str != GUI::gl_icon_key_small && m_Icon_Size_Str != GUI::gl_icon_key_tiny;

	if (m_Icon_Size_Str == GUI::gl_icon_key_medium)
	{
		m_xgrid = new game_list_grid(image_size, m_Margin_Factor, m_Text_Factor * 2, showText);
	}
	else
	{
		m_xgrid = new game_list_grid(image_size, m_Margin_Factor, m_Text_Factor, showText);
	}

	// Get number of things that'll be in grid and precompute grid size.
	int entries = 0;
	for (GUI_GameInfo game : m_game_data)
	{
		if (qstr(game.info.category) == category::disc_Game || qstr(game.info.category) == category::hdd_Game)
		{
			if (SearchMatchesApp(game.info.name, game.info.serial) == false)
			{
				continue;
			}
			++entries;
		}
	}

	// Edge cases!
	if (entries == 0)
	{ // For whatever reason, 0%x is division by zero.  Absolute nonsense by definition of modulus.  But, I'll acquiesce.
		return;
	}
	if (maxCols == 0)
	{
		maxCols = 1;
	}
	if (maxCols > entries)
	{
		maxCols = entries;
	}

	int needsExtraRow = (entries % maxCols) != 0;
	int maxRows = needsExtraRow + entries / maxCols;
	m_xgrid->setRowCount(maxRows);
	m_xgrid->setColumnCount(maxCols);

	for (uint i = 0; i < m_game_data.size(); i++)
	{
		if (SearchMatchesApp(m_game_data[i].info.name, m_game_data[i].info.serial) == false)
		{
			continue;
		}

		QString category = qstr(m_game_data[i].info.category);

		if (category == category::hdd_Game || category == category::disc_Game)
		{
			m_xgrid->addItem(m_game_data[i].pxmap, qstr(m_game_data[i].info.name), i, r, c);

			if (selected_item == m_game_data[i].info.icon_path) m_xgrid->setCurrentItem(m_xgrid->item(r, c));;

			if (++c >= maxCols)
			{
				c = 0;
				r++;
			}
		}
	}

	if (c != 0)
	{ // if left over games exist -- if empty entries exist
		for (int col = c; col < maxCols; ++col)
		{
			QTableWidgetItem* emptyItem = new QTableWidgetItem();
			emptyItem->setFlags(Qt::NoItemFlags);
			emptyItem->setData(Qt::UserRole, -1);
			m_xgrid->setItem(r, col, emptyItem);
		}
	}

	m_xgrid->resizeColumnsToContents();
	m_xgrid->resizeRowsToContents();
}
开发者ID:cornytrace,项目名称:rpcs3,代码行数:90,代码来源:game_list_frame.cpp

示例7: pixm


//.........这里部分代码省略.........
			{
				QCheckBox *cp = new QCheckBox((*it2).layerName, this);
				cp->setPalette(palette);
				QPixmap pm;
				pm=QPixmap::fromImage((*it2).thumb);
				col1Width = qMax(col1Width, pm.width());
				cp->setIcon(pm);
				FlagsSicht.append(cp);
				connect(cp, SIGNAL(clicked()), this, SLOT(changedLayer()));
				layerTable->setCellWidget(info->layerInfo.count()-counter-1, 0, cp);
				if ((info->isRequest) && (info->RequestProps.contains(counter)))
					cp->setChecked(info->RequestProps[counter].visible);
				else
					cp->setChecked(!((*it2).flags & 2));
				if (!(*it2).thumb_mask.isNull())
				{
					QCheckBox *cp2 = new QCheckBox((*it2).layerName, this);
					cp2->setPalette(palette);
					QPixmap pm2;
					pm2=QPixmap::fromImage((*it2).thumb_mask);
					col2Width = qMax(col2Width, pm2.width());
					cp2->setIcon(pm2);
					connect(cp2, SIGNAL(clicked()), this, SLOT(changedLayer()));
					layerTable->setCellWidget(info->layerInfo.count()-counter-1, 1, cp2);
					if ((info->isRequest) && (info->RequestProps.contains(counter)))
						cp2->setChecked(info->RequestProps[counter].useMask);
					else
						cp2->setChecked(true);
					FlagsMask.append(cp2);
				}
				else
					FlagsMask.append(0);
				QTableWidgetItem *tW = new QTableWidgetItem((*it2).layerName);
				tW->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
				layerTable->setItem(info->layerInfo.count()-counter-1, 2, tW);
				layerTable->setRowHeight(info->layerInfo.count()-counter-1, 40);
				counter++;
			}
		}
		tabLayout->addWidget( layerTable );
		layerTable->setColumnWidth(1, 24 + col2Width);
		layerTable->setColumnWidth(0, 24 + col1Width);
		blendMode->setCurrentIndex(0);
// 		headerH->setResizeMode(QHeaderView::Fixed);
		propsTab->addTab( tab,  tr( "Layers" ) );
	}
	tab_2 = new QWidget( propsTab );
	tabLayout_2 = new QVBoxLayout( tab_2 );
	tabLayout_2->setMargin(6);
	tabLayout_2->setSpacing(6);
	pathList = new QListWidget( tab_2 );
	pathList->clear();
	pathList->setIconSize(QSize(40, 40));
	QMap<QString, FPointArray>::Iterator it;
	if (info->PDSpathData.count() != 0)
	{
		for (it = info->PDSpathData.begin(); it != info->PDSpathData.end(); ++it)
		{
			QImage pixm(40, 40, QImage::Format_ARGB32);
			ScPainter *p = new ScPainter(&pixm, 40, 40);
			p->clear();
			p->translate(3.0, 3.0);
			if (it.key() == info->clipPath)
			{
				pixm.fill(Qt::green);
				p->clear(Qt::green);
开发者ID:AlterScribus,项目名称:ece15,代码行数:67,代码来源:extimageprops.cpp

示例8: addMesh

void PMeshViewer::addMesh(const QStringList &fileNames)
{
    int startIndex = meshList.size();
    
    for (int i = 0; i < fileNames.size(); ++i)
    {
        QString suffix = QFileInfo(fileNames[i]).suffix();

        vtkPolyDataAlgorithm *reader = NULL;

        if (suffix == "obj")
        {
            vtkOBJReader *rd = vtkOBJReader::New();
            rd->SetFileName(fileNames[i].toAscii().data());
            reader = rd;
        }
        else if (suffix == "ply")
        {
            vtkPLYReader *rd = vtkPLYReader::New();
            rd->SetFileName(fileNames[i].toAscii().data());
            reader = rd;
        }
        else if (suffix == "stl")
        {
            vtkSTLReader *rd = vtkSTLReader::New();
            rd->SetFileName(fileNames[i].toAscii().data());
            reader = rd;
        }
        else // This should not happen, but just in case.
        {
            uninstallPipeline();
            cout << "Error in loadMesh: file type " <<
                    suffix.toAscii().data() << " is unsupported.\n" << flush;
            return;
        }

        // Append to mesh list
        PMeshPart part;
        part.name = QFileInfo(fileNames[i]).baseName();
        part.source = fileNames[i];
        part.data = reader->GetOutput();
        reader->Update();
        
        part.normals = vtkPolyDataNormals::New();
        part.normals->SetInput(part.data);
        part.mapper = vtkPolyDataMapper::New();
        part.mapper->SetInput(part.normals->GetOutput());
        part.mapper->Update();
        part.actor = vtkActor::New();
        part.actor->SetMapper(part.mapper);
        meshList.append(part);
        reader->Delete();

        // Append to mesh table
        int j = meshTable->rowCount();
        meshTable->insertRow(j);
        meshTable->setRowHeight(j, RowHeight);

        QTableWidgetItem *item = new QTableWidgetItem;
        item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsUserCheckable);
        item->setCheckState(Qt::Checked);
        meshTable->setItem(j, 0, item);

        item = new QTableWidgetItem;
        item->setFlags(Qt::ItemIsEnabled);
        item->setBackground(QBrush(QColor(255, 255, 255)));
        meshTable->setItem(j, 1, item);

        item = new QTableWidgetItem(part.name);
        item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable |
                       Qt::ItemIsEditable);
        item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
        meshTable->setItem(j, 2, item);
        
        item = new QTableWidgetItem(part.source);
        item->setFlags(Qt::ItemIsEnabled);
        item->setTextAlignment(Qt::AlignLeft | Qt::AlignVCenter);
        meshTable->setItem(j, 4, item);
    }

    int width = meshTable->width();
    int height = meshTable->height();
    int bestHeight = qMin(MaxHeight,
                          (meshTable->rowCount() + 2) * RowHeight);
    if (height < bestHeight)
        meshTable->resize(width, bestHeight);

    installPipeline(startIndex);

    setWindowTitle(QString("%1 - %2").arg(appName).arg(projectName));
}
开发者ID:pLiuYang,项目名称:Anatomy-Annotator,代码行数:91,代码来源:PMeshViewer.cpp

示例9: tr

void
BestIntervalDialog::findClicked()
{
    const RideFile *ride = context->ride ? context->ride->ride() : NULL;
    if (!ride) {
        QMessageBox::critical(this, tr("Select Activity"), tr("No activity selected!"));
        return;
    }

    int maxIntervals = (int) countSpinBox->value();
    double windowSizeSecs = (hrsSpinBox->value() * 3600.0
                             + minsSpinBox->value() * 60.0
                             + secsSpinBox->value());

    if (windowSizeSecs == 0.0) {
        QMessageBox::critical(this, tr("Bad Interval Length"),
                              tr("Interval length must be greater than zero!"));
        return;
    }

    QList<BestInterval> results;
    findBests(ride, Specification(), windowSizeSecs, maxIntervals, results);

    // clear the table
    clearResultsTable(resultsTable);

    // populate the table
    resultsTable->setRowCount(results.size());
    int row = 0;
    foreach (const BestInterval &interval, results) {

        double secs = interval.start;
        double mins = floor(secs / 60);
        secs = secs - mins * 60.0;
        double hrs = floor(mins / 60);
        mins = mins - hrs * 60.0;

        // check box
        QCheckBox *c = new QCheckBox;
        c->setCheckState(Qt::Checked);
        resultsTable->setCellWidget(row, 0, c);

        // start time
        QString start = "%1:%2:%3";
        start = start.arg(hrs, 0, 'f', 0);
        start = start.arg(mins, 2, 'f', 0, QLatin1Char('0'));
        start = start.arg(round(secs), 2, 'f', 0, QLatin1Char('0'));

        QTableWidgetItem *t = new QTableWidgetItem;
        t->setText(start);
        t->setFlags(t->flags() & (~Qt::ItemIsEditable));
        resultsTable->setItem(row, 1, t);

        // name
        int x = windowSizeSecs; // int is more help here
        QString name = "Best %2%3 #%1 (%4w)";
        name = name.arg(row + 1);
        // best n mins
        if (x < 60) {
            // whole seconds
            name = name.arg(x);
            name = name.arg("sec");
        } else if (x >= 60 && !(x%60)) {
            // whole minutes
            name = name.arg(x/60);
            name = name.arg("min");
        } else {
            double secs = x;
            double mins = ((int) secs) / 60;
            secs = secs - mins * 60.0;
            double hrs = ((int) mins) / 60;
            mins = mins - hrs * 60.0;
            QString tm = "%1:%2:%3";
            tm = tm.arg(hrs, 0, 'f', 0);
            tm = tm.arg(mins, 2, 'f', 0, QLatin1Char('0'));
            tm = tm.arg(secs, 2, 'f', 0, QLatin1Char('0'));

            // mins and secs
            name = name.arg(tm);
            name = name.arg("");
        }
        name = name.arg(round(interval.avg));

        QTableWidgetItem *n = new QTableWidgetItem;
        n->setText(name);
        n->setFlags(n->flags() | (Qt::ItemIsEditable));
        resultsTable->setItem(row, 2, n);

        // hidden columns - start, stop
        QString strt = QString("%1").arg(interval.start); // can't use secs as it gets modified
        QTableWidgetItem *st = new QTableWidgetItem;
        st->setText(strt);
        resultsTable->setItem(row, 3, st);

        QString stp = QString("%1").arg(interval.start + x);
        QTableWidgetItem *sp = new QTableWidgetItem;
        sp->setText(stp);
        resultsTable->setItem(row, 4, sp);

        row++;
//.........这里部分代码省略.........
开发者ID:27sparks,项目名称:GoldenCheetah,代码行数:101,代码来源:BestIntervalDialog.cpp

示例10: QString

RegDisplayPanel::RegDisplayPanel(QWidget *parent, IoBackend *io_backend, const SocRegRef& reg_ref)
    :QGroupBox(parent), m_io_backend(io_backend), m_reg(reg_ref), m_reg_font(font())
{
    bool read_only = m_io_backend->IsReadOnly();

    QVBoxLayout *right_layout = new QVBoxLayout;

    const soc_dev_addr_t& dev_addr = m_reg.GetDevAddr();
    const soc_reg_t& reg = m_reg.GetReg();
    const soc_reg_addr_t& reg_addr = m_reg.GetRegAddr();

    m_reg_font.setWeight(100);
    m_reg_font.setKerning(false);

    QString reg_name;
    reg_name.sprintf("HW_%s_%s", dev_addr.name.c_str(), reg_addr.name.c_str());
    QStringList names;
    QVector< soc_addr_t > addresses;
    names.append(reg_name);
    addresses.append(reg_addr.addr);
    if(reg.flags & REG_HAS_SCT)
    {
        names.append(reg_name + "_SET");
        names.append(reg_name + "_CLR");
        names.append(reg_name + "_TOG");
        addresses.append(reg_addr.addr + 4);
        addresses.append(reg_addr.addr + 8);
        addresses.append(reg_addr.addr + 12);
    }

    QString str;
    str += "<table align=left>";
    for(int i = 0; i < names.size(); i++)
        str += "<tr><td><b>" + names[i] + "</b></td></tr>";
    str += "</table>";
    QLabel *label_names = new QLabel;
    label_names->setTextFormat(Qt::RichText);
    label_names->setText(str);

    QString str_addr;
    str_addr += "<table align=left>";
    for(int i = 0; i < names.size(); i++)
        str_addr += "<tr><td><b>" + QString().sprintf("0x%03x", addresses[i]) + "</b></td></tr>";
    str_addr += "</table>";
    QLabel *label_addr = new QLabel;
    label_addr->setTextFormat(Qt::RichText);
    label_addr->setText(str_addr);

    QHBoxLayout *top_layout = new QHBoxLayout;
    top_layout->addStretch();
    top_layout->addWidget(label_names);
    top_layout->addWidget(label_addr);
    top_layout->addStretch();

    m_raw_val_name = new QLabel;
    m_raw_val_name->setText("Raw value:");
    m_raw_val_edit = new RegLineEdit;
    m_raw_val_edit->SetReadOnly(read_only);
    m_raw_val_edit->GetLineEdit()->setAlignment(Qt::AlignHCenter | Qt::AlignVCenter);
    m_raw_val_edit->GetLineEdit()->setValidator(new SocFieldValidator(m_raw_val_edit));
    m_raw_val_edit->EnableSCT(!!(reg.flags & REG_HAS_SCT));
    m_raw_val_edit->GetLineEdit()->setFont(m_reg_font);
    QHBoxLayout *raw_val_layout = new QHBoxLayout;
    raw_val_layout->addStretch();
    raw_val_layout->addWidget(m_raw_val_name);
    raw_val_layout->addWidget(m_raw_val_edit);
    raw_val_layout->addStretch();

    m_value_table = new GrowingTableWidget;
    m_value_table->setRowCount(reg.field.size());
    m_value_table->setColumnCount(5);
    for(size_t row = 0; row < reg.field.size(); row++)
    {
        const soc_reg_field_t& field = reg.field[row];
        QString bits_str;
        if(field.first_bit == field.last_bit)
            bits_str.sprintf("%d", field.first_bit);
        else
            bits_str.sprintf("%d:%d", field.last_bit, field.first_bit);
        QTableWidgetItem *item = new QTableWidgetItem(bits_str);
        item->setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        m_value_table->setItem(row, FieldBitsColumn, item);
        item = new QTableWidgetItem(QString(field.name.c_str()));
        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        m_value_table->setItem(row, FieldNameColumn, item);
        item = new QTableWidgetItem();
        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        item->setData(Qt::DisplayRole, QVariant::fromValue(SocFieldCachedValue()));
        item->setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
        m_value_table->setItem(row, FieldValueColumn, item);
        item = new QTableWidgetItem("");
        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        item->setTextAlignment(Qt::AlignVCenter | Qt::AlignHCenter);
        m_value_table->setItem(row, FieldMeaningColumn, item);
        item = new QTableWidgetItem(QString(field.desc.c_str()));
        item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
        m_value_table->setItem(row, FieldDescColumn, item);
    }
    m_value_table->setHorizontalHeaderItem(FieldBitsColumn, new QTableWidgetItem("Bits"));
//.........这里部分代码省略.........
开发者ID:Ficer,项目名称:rockbox,代码行数:101,代码来源:regdisplaypanel.cpp

示例11: Fill


//.........这里部分代码省略.........
        size_t ToDelete=List[1][0].rfind(PathSeparator);
        if (ToDelete!=string::npos)
        {
            FileName_Before=List[1][0].substr(0, ToDelete+1);
            List[1][0].erase(0, ToDelete+1);
        }
    }
    else if (List.size()>1 && !List[1].empty())
    {
        size_t ToDelete;
        size_t File_Pos;
        for (ToDelete=0; ToDelete<List[1][0].size(); ToDelete++)
        {
            char Char_File1=List[1][0][ToDelete];
            for (File_Pos=2; File_Pos<List.size(); File_Pos++)
                if (ToDelete>=List[File_Pos][0].size() || List[File_Pos][0][ToDelete]!=Char_File1)
                    break;
            if (File_Pos!=List.size())
                break;
        }

        ToDelete=List[1][0].rfind(PathSeparator, ToDelete);
        if (ToDelete!=string::npos)
        {
            FileName_Before=List[1][0].substr(0, ToDelete+1);
            for (File_Pos=1; File_Pos<List.size(); File_Pos++)
                List[File_Pos][0].erase(0, ToDelete+1);
        }
    }

    if (List.empty() || List[0].empty())
    {
        setRowCount(0);
        setColumnCount(0);

        //Preparing
        Updating=false;

        return;
    }

    //Forcing reset, else this seems to be some Qt bug in the table display
    setRowCount(0);
    setColumnCount(0);

    //Filling - HorizontalHeader
    setRowCount((int)List.size()-1);
    size_t ColumnMissing_Count=0;
    for (size_t Option=0; Option<Main->Preferences->Group_Options_Count_Get(Fill_Group()); Option++)
        if (!Main->Menu_Fields_CheckBoxes[Fill_Group()*options::MaxCount+Option]->isChecked())
            ColumnMissing_Count++;
    setColumnCount((int)(List[0].size()-ColumnMissing_Count));
    ColumnMissing_Count=0;
    for (size_t Data_Pos=0; Data_Pos<List[0].size(); Data_Pos++)
        if (Data_Pos==0 || Main->Menu_Fields_CheckBoxes[Fill_Group()*options::MaxCount+Data_Pos-1]->isChecked())
        {
            QTableWidgetItem* Item=new QTableWidgetItem(QString().fromUtf8(List[0][Data_Pos].To_Local().c_str()));
            Item->setToolTip(Columns_ToolTip(List[0][Data_Pos]));
            setHorizontalHeaderItem((int)(Data_Pos-ColumnMissing_Count), Item);
        }
        else
            ColumnMissing_Count++;

    //Filling - VerticalHeader and content 
    for (size_t File_Pos=1; File_Pos<List.size(); File_Pos++)
    {
        if (List[File_Pos].empty())
            List[File_Pos].resize(1); //Empty filename, we need to manualy add it.
        ColumnMissing_Count=0;
        for (size_t Data_Pos=0; Data_Pos<List[0].size(); Data_Pos++)
            if (Data_Pos==0 || Main->Menu_Fields_CheckBoxes[Fill_Group()*options::MaxCount+Data_Pos-1]->isChecked())
            {
                QTableWidgetItem* Item;
                if (Data_Pos<List[File_Pos].size())
                {
                    ZenLib::Ztring Value=List[File_Pos][Data_Pos];
                    Value.FindAndReplace(EOL, "\n", 0, Ztring_Recursive);
                    Item=new QTableWidgetItem(QString().fromUtf8(Value.To_Local().c_str()));
                    Item->setToolTip(Columns_ToolTip(List[0][Data_Pos]));
                }
                else
                    Item=new QTableWidgetItem(QString());

                if (!C->IsValid_Get(FileName_Before+List[File_Pos][0])
                 || (Data_Pos<List[File_Pos].size() && !Fill_Enabled(FileName_Before+List[File_Pos][0], List[0][Data_Pos], List[File_Pos][Data_Pos])))
                    Item->setFlags(Item->flags()&((Qt::ItemFlags)-1-Qt::ItemIsEnabled));
                setItem((int)File_Pos-1, (int)(Data_Pos-ColumnMissing_Count), Item);
            }
            else
                ColumnMissing_Count++;
    }

    //Configuring
    Colors_Update();
    resizeColumnsToContents();
    setSortingEnabled(true);

    //Preparing
    Updating=false;
}
开发者ID:courtneyegan,项目名称:AVI-MetaEdit,代码行数:101,代码来源:GUI_Main_xxxx__Common.cpp

示例12: readTest

void rulesDialog::readTest( int index, QgsMapLayerRegistry* layerRegistry )
{
  QString testName;
  QString layer1Id;
  QString layer2Id;
  QString tolerance;
  QgsProject* project = QgsProject::instance();
  QString postfix = QString( "%1" ).arg( index );

  testName = project->readEntry( "Topol", "/testname_" + postfix, "" );
  tolerance = project->readEntry( "Topol", "/tolerance_" + postfix, "" );
  layer1Id = project->readEntry( "Topol", "/layer1_" + postfix, "" );
  layer2Id = project->readEntry( "Topol", "/layer2_" + postfix, "" );

  QgsVectorLayer* l1;
  if ( !( QgsVectorLayer* )layerRegistry->mapLayers().contains( layer1Id ) )
    return;

  l1 = ( QgsVectorLayer* )layerRegistry->mapLayers()[layer1Id];
  if ( !l1 )
    return;

  QString layer1Name = l1->name();
  QString layer2Name;
  QgsVectorLayer* l2;

  if ( mTestConfMap[testName].useSecondLayer )
  {
    if ( !( QgsVectorLayer* )layerRegistry->mapLayers().contains( layer2Id ) )
      return;
    else
    {
      l2 = ( QgsVectorLayer* )layerRegistry->mapLayers()[layer2Id];
      layer2Name = l2->name();
    }
  }
  else
    layer2Name = "No layer";

  int row = index;
  mRulesTable->insertRow( row );

  QTableWidgetItem* newItem;
  newItem = new QTableWidgetItem( testName );
  newItem->setFlags( newItem->flags() & ~Qt::ItemIsEditable );
  mRulesTable->setItem( row, 0, newItem );

  newItem = new QTableWidgetItem( layer1Name );
  newItem->setFlags( newItem->flags() & ~Qt::ItemIsEditable );
  mRulesTable->setItem( row, 1, newItem );

  newItem = new QTableWidgetItem( layer2Name );
  newItem->setFlags( newItem->flags() & ~Qt::ItemIsEditable );
  mRulesTable->setItem( row, 2, newItem );

  if ( mTestConfMap[testName].useTolerance )
    newItem = new QTableWidgetItem( tolerance );
  else
    newItem = new QTableWidgetItem( tr( "No tolerance" ) );

  newItem->setFlags( newItem->flags() & ~Qt::ItemIsEditable );
  mRulesTable->setItem( row, 3, newItem );

  // add layer ids to hidden columns
  newItem = new QTableWidgetItem( layer1Id );
  mRulesTable->setItem( row, 4, newItem );
  newItem = new QTableWidgetItem( layer2Id );
  mRulesTable->setItem( row, 5, newItem );
}
开发者ID:Antoviscomi,项目名称:QGIS,代码行数:69,代码来源:rulesDialog.cpp

示例13: updateTable


//.........这里部分代码省略.........
        }

      // add first column
      QTableWidgetItem * pItem = new ColorTableItem(color, qUsage);

      if (usage == CFunctionParameter::SUBSTRATE) pItem->setIcon(CQIconResource::icon(CQIconResource::reactionSubstrate));

      if (usage == CFunctionParameter::PRODUCT) pItem->setIcon(CQIconResource::icon(CQIconResource::reactionProduct));

      if (usage == CFunctionParameter::MODIFIER) pItem->setIcon(CQIconResource::icon(CQIconResource::reactionModifier));

      setItem((int) rowCounter, 0, pItem);

      // add second column
      pItem = new ColorTableItem(color, FROM_UTF8(ri.getParameterName(i)));

      if ((usage != CFunctionParameter::PARAMETER)
          && (usage != CFunctionParameter::VOLUME)
          && (usage != CFunctionParameter::TIME))
        {
          if (ri.isLocked(i))
            pItem->setIcon(CQIconResource::icon(CQIconResource::locked));
          else
            pItem->setIcon(CQIconResource::icon(CQIconResource::unlocked));
        }

      setItem((int) rowCounter, 1, pItem);

      // add third column
      pItem = new ColorTableItem(color, "");

      if (usage == CFunctionParameter::PARAMETER)
        {
          pItem->setFlags(pItem->flags() | Qt::ItemIsUserCheckable);
          pItem->setCheckState(ri.isLocalValue(i) ? Qt::Unchecked : Qt::Checked);
        }

      setItem((int) rowCounter, 2, pItem);

      // add units column
      assert(CCopasiRootContainer::getDatamodelList()->size() > 0);
      CCopasiDataModel* pDataModel = (*CCopasiRootContainer::getDatamodelList())[0];
      assert(pDataModel != NULL);
      pItem = new ColorTableItem(color, FROM_UTF8(" " + units.getDimensions()[i].getDisplayString(pDataModel)));
      setItem((int) rowCounter, 4, pItem);

      // add a line for a metabolite Parameter
      if ((usage == CFunctionParameter::SUBSTRATE)
          || (usage == CFunctionParameter::PRODUCT)
          || (usage == CFunctionParameter::MODIFIER))
        {
          // get the list of possible metabs (for the combo box)
          if (usage == CFunctionParameter::MODIFIER) //get all metabs; modifiers are never locked
            vectorOfStrings2QStringList(getListOfAllMetabNames(model, ri), qsl);
          else //only get the modifiers from the ChemEq
            {
              if (!ri.isLocked(i))
                vectorOfStrings2QStringList(ri.getListOfMetabs(usage), qsl);
            }

          metabNames = &(ri.getMappings(i));

          if (!ri.isVector(i))
            {
              if (ri.isLocked(i))
                {
开发者ID:ShuoLearner,项目名称:COPASI,代码行数:67,代码来源:CQParameterTable.cpp

示例14: sAdd

void RenderWindow::sAdd()
{
  bool ok = false;
  bool active = false;

  QString name;
  QString varType;
  QVariant var;

  NewVariant newVar(this);

  while(!ok)
  {
    if(newVar.exec() != QDialog::Accepted)
      return;

    name = newVar._name->text();
    varType = newVar._type->currentText();

    ok = !_params.contains(name);
    if(!ok)
      QMessageBox::warning(this, tr("Name already exists"), tr("The name for the parameter you specified already exists in the list."));
  }


  BoolEdit * be = 0;
  IntEdit * ie = 0;
  DoubleEdit * de = 0;
  StringEdit * se = 0;
  ListEdit * le = 0;

  if(varType == NewVariant::tr("String")) {
    se = new StringEdit(this);
    se->_name->setText(name);
    ok = (se->exec() == QDialog::Accepted);
    var = QVariant(se->_value->text());
    active = se->_active->isChecked();
    delete se;
    se = 0;
  } else if(varType == NewVariant::tr("Int")) {
    ie = new IntEdit(this);
    ie->_name->setText(name);
    ok = (ie->exec() == QDialog::Accepted);
    var = QVariant(ie->_value->text().toInt());
    active = ie->_active->isChecked();
    delete ie;
    ie = 0;
  } else if(varType == NewVariant::tr("Double")) {
    de = new DoubleEdit(this);
    de->_name->setText(name);
    ok = (de->exec() == QDialog::Accepted);
    var = QVariant(de->_value->text().toDouble());
    active = de->_active->isChecked();
    delete de;
    de = 0;
  } else if(varType == NewVariant::tr("Bool")) {
    be = new BoolEdit(this);
    be->_name->setText(name);
    ok = (be->exec() == QDialog::Accepted);
    var = QVariant((bool)be->value());
    active = be->_active->isChecked();
    delete be;
    be = 0;
  } else if(varType == NewVariant::tr("List")) {
    le = new ListEdit(this);
    le->_name->setText(name);
    ok = (le->exec() == QDialog::Accepted);
    var = QVariant(le->list());
    active = le->_active->isChecked();
    delete le;
    le = 0;
  } else {
    QMessageBox::warning(this, tr("Unknown Type"), QString(tr("I do not understand the type %1.")).arg(varType));
    return;
  }

  if(!ok)
    return;

  _params[name] = var;

  int r = _table->rowCount();
  _table->setRowCount(r+1);
  QTableWidgetItem * ctItem = new QTableWidgetItem();
  ctItem->setFlags(Qt::ItemIsUserCheckable);
  ctItem->setCheckState((active ? Qt::Checked : Qt::Unchecked));
  _table->setItem(r, 0, ctItem);
  _table->setItem(r, 1, new QTableWidgetItem(name));
  _table->setItem(r, 2, new QTableWidgetItem(var.typeName()));
  _table->setItem(r, 3, new QTableWidgetItem(var.toString()));
  sSelectionChanged();
}
开发者ID:Wushaowei001,项目名称:xtuple,代码行数:92,代码来源:renderwindow.cpp

示例15: loadData

void FahrtagWindow::loadData()
{
    if (nehme) {
        nehme = false;
        // Allgemeine Daten von AActivity
        ui->dateDate->setDate(fahrtag->getDatum());
        ui->textAnlass->clear();
        ui->textAnlass->insertPlainText(fahrtag->getAnlass());
        ui->timeEnde->setTime(fahrtag->getZeitEnde());
        ui->checkBoxBenoetigt->setChecked(fahrtag->getPersonalBenoetigt());

        // Daten von Manager_Reservierungen
        ui->comboWagenreihung->setCurrentText(fahrtag->getWagenreihung());
        QSetIterator<Reservierung*> iter = fahrtag->getReservierungen();
        while(iter.hasNext()) {
            Reservierung *r = iter.next();
            QListWidgetItem *item = new QListWidgetItem(r->getName());
            resToItem->insert(r, item);
            itemToRes->insert(item, r);
            ui->listRes->insertItem(0, item);
        }
        ui->listRes->sortItems();
        ui->checkBoxAll->setEnabled(false);
        ui->buttonVerteile->setEnabled(Fahrtag::Nikolauszug == fahrtag->getArt());

        ui->checkBoxAll->setChecked(fahrtag->getCheckAll());
        ui->checkBoxAll->setEnabled(fahrtag->getArt() == Fahrtag::Nikolauszug);
        ui->buttonVerteile->setEnabled(fahrtag->getArt() == Fahrtag::Nikolauszug);

        // Daten von Fahrtag
        ui->comboArt->setCurrentIndex((int)fahrtag->getArt());
        ui->comboTimeTfH->setCurrentText(fahrtag->getZeitTf().toString("HH"));
        ui->comboTimeTfM->setCurrentText(fahrtag->getZeitTf().toString("mm"));
        ui->comboTimeZH->setCurrentText(fahrtag->getZeitAnfang().toString("HH"));
        ui->comboTimeZM->setCurrentText(fahrtag->getZeitAnfang().toString("mm"));
        ui->checkWichtig->setChecked(fahrtag->getWichtig());
        ui->checkTf->setChecked(fahrtag->getBenoetigeTf());
        ui->checkZf->setChecked(fahrtag->getBenoetigeZf());
        ui->checkZub->setChecked(fahrtag->getBenoetigeZub());
        ui->checkService->setChecked(fahrtag->getBenoetigeService());

        /* LIstTf, ListZf, ListZub, ListService fehlt noch */
        QMap<Person*, AActivity::Infos*> tf;
        QMap<Person*, AActivity::Infos*> zf;
        QMap<Person*, AActivity::Infos*> zub;
        QMap<Person*, AActivity::Infos*> service;
        QMap<Person*, AActivity::Infos*> sonstige;

        listeMitNamen = new QMap<QListWidgetItem*, QString>();
        listToTable = new QMap<QListWidgetItem*, QTableWidgetItem*>();
        namen = new QSet<QString>();

        // Aufsplitten der Personen auf die Einzelnen Listen
        for(Person *p: fahrtag->getPersonen()->keys()) {
            AActivity::Infos *info = fahrtag->getPersonen()->value(p);

            QListWidgetItem *item;
            if (info->bemerkung == "") {
                item = new QListWidgetItem(p->getName());
            } else {
                item = new QListWidgetItem(p->getName()+"; "+info->bemerkung);
            }
            item->setFlags(Qt::ItemIsSelectable|Qt::ItemIsEditable|Qt::ItemIsEnabled);
            listeMitNamen->insert(item, p->getName());
            namen->insert(p->getName());

            bool block = true;

            switch (fahrtag->getPersonen()->value(p)->kategorie) {
            case AActivity::Tf:
            case AActivity::Tb:
                tf.insert(p, info);
                ui->listTf->insertItem(0, item);
                ui->buttonTfDelete->setEnabled(true);
                break;
            case AActivity::Zf:
                zf.insert(p, info);
                ui->listZf->insertItem(0, item);
                ui->buttonZfDelete->setEnabled(true);
                break;
            case AActivity::Zub:
            case AActivity::Begleiter:
                zub.insert(p, info);
                ui->listZub->insertItem(0, item);
                ui->buttonZubDelete->setEnabled(true);
                break;
            case AActivity::Service:
                service.insert(p, info);
                ui->listService->insertItem(0, item);
                ui->buttonServiceDelete->setEnabled(true);
                break;
            default:
                sonstige.insert(p, info);
                block = false;
                ui->buttonRemove->setEnabled(true);
                break;
            }

            // Zeile für die Person in die Tabelle einfügen
            QString bem = info->bemerkung.toUpper();
//.........这里部分代码省略.........
开发者ID:philjosch,项目名称:Einsatzplaner,代码行数:101,代码来源:fahrtagwindow.cpp


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