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


C++ QTreeWidgetItem::columnCount方法代码示例

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


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

示例1: toString

QString QTreeWidgetItemProto::toString()    	const
{
  QTreeWidgetItem *item = qscriptvalue_cast<QTreeWidgetItem*>(thisObject());
  if (item)
    return QString("[QTreeWidgetItem with %1 children and %2 columns]")
                   .arg(item->childCount())
                   .arg(item->columnCount());
  return QString();
}
开发者ID:,项目名称:,代码行数:9,代码来源:

示例2: findColumnWithName

int LogbookTreeWidget::findColumnWithName(const std::string &name) {
	QTreeWidgetItem *item = headerItem();
	for (int i = 0; i < item->columnCount(); i++) {
		if (item->text(i).toStdString() == name) {
			return i;
		}
	}

	return -1;
}
开发者ID:hanzz,项目名称:hamlog,代码行数:10,代码来源:logbooktreewidget.cpp

示例3: columns

QVariantList QcTreeWidget::columns() const
{
  QVariantList varList;
  QTreeWidgetItem *header = headerItem();
  if( header ) {
    for( int i = 0; i < header->columnCount(); ++i ) {
      varList << header->text(i);
    }
  }
  return varList;
}
开发者ID:8c6794b6,项目名称:supercollider,代码行数:11,代码来源:QcTreeWidget.cpp

示例4: setHeader

void TreeWidgetHeaderSetupDialog::setHeader(QTreeWidget* view, int)
{
    m_view = view;

    QTreeWidgetItem* header = view->headerItem();
    for( int i=0;i<header->columnCount();i++ )
    {
        QTreeWidgetItem* item = new QTreeWidgetItem(ui->MasterView);
        item->setText(0, header->text(i));
        item->setTextAlignment(0, header->textAlignment(i));
        item->setCheckState(0, view->isColumnHidden(i) ? Qt::Unchecked : Qt::Checked);
    }
}
开发者ID:GoogleLonely,项目名称:tianchi,代码行数:13,代码来源:TreeWidgetHeaderSetupDialog.cpp

示例5: mouseMoveEvent

void RDTreeWidget::mouseMoveEvent(QMouseEvent *e)
{
  QTreeWidgetItem *item = itemAt(e->pos());

  clearHovers(invisibleRootItem(), item);

  if(item)
  {
    QVariant normalIcon = item->data(m_hoverColumn, Qt::DecorationRole);
    QVariant hoverIcon = item->data(m_hoverColumn, hoverIconRole);

    if(normalIcon.isValid() && hoverIcon.isValid())
    {
      item->setData(m_hoverColumn, hoverIconRole, QVariant());
      item->setData(m_hoverColumn, Qt::DecorationRole, hoverIcon);
      item->setData(m_hoverColumn, backupNormalIconRole, normalIcon);
    }

    if(!item->data(m_hoverColumn, backupBackColourRole).isValid())
    {
      QVariant backHoverColor = item->data(m_hoverColumn, hoverBackColourRole);

      QColor col = item->data(m_hoverColumn, hoverBackColourRole).value<QColor>();
      if(!col.isValid())
        col = m_defaultHoverColour;

      if(col.isValid())
      {
        item->setData(m_hoverColumn, backupBackColourRole, item->background(m_hoverColumn));
        for(int c = 0; c < item->columnCount(); c++)
          item->setData(c, Qt::BackgroundRole, QBrush(col));
      }
    }

    QModelIndex idx = indexAt(e->pos());

    if(idx.column() == m_hoverColumn && item->data(m_hoverColumn, Qt::DecorationRole).isValid() &&
       m_hoverHandCursor)
    {
      setCursor(QCursor(Qt::PointingHandCursor));
    }
    else
    {
      unsetCursor();
    }
  }

  emit mouseMove(e);

  QTreeWidget::mouseMoveEvent(e);
}
开发者ID:gwihlidal,项目名称:renderdoc,代码行数:51,代码来源:RDTreeWidget.cpp

示例6: adjustHeadersAndResizeToContents

void KForecastView::adjustHeadersAndResizeToContents(QTreeWidget *widget)
{
  QSize sizeHint(0, widget->sizeHintForRow(0));
  QTreeWidgetItem *header = widget->headerItem();
  for (int i = 0; i < header->columnCount(); ++i) {
    if (i > 0) {
      header->setData(i, Qt::TextAlignmentRole, Qt::AlignRight);
      // make sure that the row height stays the same even when the column that has icons is not visible
      if (m_totalItem) {
        m_totalItem->setSizeHint(i, sizeHint);
      }
    }
    widget->resizeColumnToContents(i);
  }
}
开发者ID:KDE,项目名称:kmymoney,代码行数:15,代码来源:kforecastview.cpp

示例7:

dmz::V8Value
dmz::JsModuleUiV8QtBasic::_tree_item_col_count (const v8::Arguments &Args) {

   v8::HandleScope scope;
   V8Value result = v8::Undefined ();

   JsModuleUiV8QtBasic *self = _to_self (Args);
   if (self) {

      QTreeWidgetItem *item = self->_to_qtreewidgetitem (Args.This ());
      if (item) {

         result = v8::Number::New (item->columnCount ());
      }
   }

   return scope.Close (result);
}
开发者ID:bstewart33,项目名称:js,代码行数:18,代码来源:dmzJsModuleUiV8QtBasicTreeWidget.cpp

示例8: treeWidgetToTextTable

int treeWidgetToTextTable(QTreeWidgetItem *item, QTextTable *table, int rowNum) {
	for (int c = 0; c < item->childCount(); ++c) {
		QTreeWidgetItem *child = item->child(c);
		
		//export child
		table->appendRows(1);
		for (int colNum = 0; colNum < child->columnCount(); ++colNum) {
			table->cellAt(rowNum, colNum).firstCursorPosition().insertText(child->text(colNum));
		}
		++rowNum;
		
		//recurse to children
		if (child->isExpanded() && child->childCount() > 0) {
			rowNum = treeWidgetToTextTable(child, table, rowNum);
		}
	}
	
	return rowNum;
}
开发者ID:jhjonathanlee,项目名称:DataVis-Orange,代码行数:19,代码来源:DashboardWindow.cpp

示例9: addColumn

int toTreeWidget::addColumn(const QString &label, int width)
{
    QTreeWidgetItem *head = QTreeWidget::headerItem();
    if (!head)
        return -1;

    int index = head->columnCount();

    // dirty, dirty hack.

    // QTreeWidget appears to always have at least one column.  you're
    // meant to add columns by using setHeaderLabels() but this is a
    // lot of porting.

    // check if we have just 1 column and it's name is "1" and then
    // change the name.
    if (index == 1 && head->text(0) == "1")
        index = 0;              // don't add

    head->setText(index, label);
    return index;
}
开发者ID:netrunner-debian-kde-extras,项目名称:tora,代码行数:22,代码来源:totreewidget.cpp

示例10: getColumn

int ShapeFileOptionsWidget::getColumn(const QString& strField) const
{
   if (strField.isEmpty())
   {
      return -1;
   }

   QTreeWidgetItem* pHeaderItem = mpFeatureTree->headerItem();
   if (pHeaderItem != NULL)
   {
      for (int i = 0; i < pHeaderItem->columnCount(); i++)
      {
         QString strColumn = pHeaderItem->text(i);
         if (strColumn == strField)
         {
            return i;
         }
      }
   }

   return -1;
}
开发者ID:Siddharthk,项目名称:opticks,代码行数:22,代码来源:ShapeFileOptionsWidget.cpp

示例11: setSettings

void OptionsDialog::setSettings() {
    passwordEdit->setText(getSetting("password", "").toString());
    coreEdit->setText(getSetting("coreAddress", "localhost").toString());
    refreshSpin->setValue(getSetting("refresh", 3).toInt());
    savePassword->setChecked(getSetting("savePassword", false).toBool());
    useCompression->setChecked(getSetting("useCompression", false).toBool());
    showSplash->setChecked(getSetting("showSplash", true).toBool());
    trayCheckBox->setChecked(getSetting("useTray", false).toBool());
    altRowsCheckBox->setChecked(getSetting("altRows", false).toBool());
    serverEdit->setText(getSetting("serverURL", "http://www.applejuicenet.de/18.0.html").toString());
    launchCombo->setEditText(getSetting("launcher", launchCombo->itemText(0)).toString());
    int location = getSetting("location", AjSettings::SAME).toInt();
    sameComputerRadio->setChecked(location == AjSettings::SAME);
    specificRadio->setChecked(location == AjSettings::SPECIFIC);
    ftpRadio->setChecked(location == AjSettings::FTP);
    incomingSpecificEdit->setText(getSetting("incomingDirSpecific", "/").toString());
    tempSpecificEdit->setText(getSetting("tempDirSpecific", "/").toString());
    ftpServerEdit->setText(getSetting("ftp", "server", "localhost").toString());
    ftpPortEdit->setText(getSetting("ftp", "port", "21").toString());
    ftpUserEdit->setText(getSetting("ftp", "user", "anonymous").toString());
    ftpPasswordEdit->setText(getSetting("ftp", "password", "").toString());
    ftpInDirEdit->setText(getSetting("ftp", "inDir", "/").toString());
    ftpTmpDirEdit->setText(getSetting("ftp", "tmpDir", "/").toString());
    ftpActiveRadioButton->setChecked(getSetting("ftp", "mode", QFtp::Active) == QFtp::Active);
    ftpPassiveRadioButton->setChecked(getSetting("ftp", "mode", QFtp::Active) == QFtp::Passive);
    ftpMbSpinBox->setValue(getSetting("ftp", "mb", "10").toInt());
    bool ftpFull = getSetting("ftp", "full", false).toBool();
    ftpFullRadioButton->setChecked(ftpFull);
    ftpMbRadioButton->setChecked(!ftpFull);
    fetchServersCheckBox->setChecked(getSetting("fetchServersOnStartup", false).toBool());
    languageComboBox->setCurrentIndex(languageComboBox->findData(getSetting("language", "en").toString().split("_")[0]));

    // -- lists for optionaly showing columns/labales --
    statusbarList->clear();
    QList<QVariant> statusbarShow = getStatusbarShows(juicer->statusBarWidgets.size());
    for(int i=0; i<juicer->statusBarWidgets.size(); i++) {
        statusbarList->addItem(juicer->statusBarWidgets.at(i)->toolTip());
        statusbarList->item(statusbarList->count()-1)->setCheckState(
            statusbarShow.at(i).toBool()?Qt::Checked:Qt::Unchecked);
    }
    downloadTabList->clear();
    QTreeWidgetItem* h = juicer->downloadsTreeWidget->headerItem();
    for(int i=0; i<h->columnCount(); i++) {
        downloadTabList->addItem(h->text(i));
        downloadTabList->item(downloadTabList->count()-1)->setCheckState(
            juicer->downloadsTreeWidget->isColumnHidden(i)?Qt::Unchecked:Qt::Checked);
    }
    uploadTabList->clear();
    h = juicer->uploadsTreeWidget->headerItem();
    for(int i=0; i<h->columnCount(); i++) {
        uploadTabList->addItem(h->text(i));
        uploadTabList->item(uploadTabList->count()-1)->setCheckState(
            juicer->uploadsTreeWidget->isColumnHidden(i)?Qt::Unchecked:Qt::Checked);
    }

    QFont font;
    QVariant v = getSetting("font", QApplication::font());
    if (v.isValid() && ! v.toString().isEmpty()) {
        font = v.value<QFont>();
    }
    else {
      font = QFont("Arial", 9, QFont::Normal);
    }
    QApplication::setFont(font);
    fontComboBox->setCurrentFont(font);
    setFontSizes(font);
#ifdef Q_WS_WIN
    handlerCheckCheckBox->setChecked(!OptionsDialog::hasSetting("handler") || OptionsDialog::getSetting("handler", false).toBool());
    handlerDefaultCheckBox->setChecked(OptionsDialog::hasSetting("handler") && OptionsDialog::getSetting("handler", false).toBool());
    handlerDefaultCheckBox->setEnabled(handlerCheckCheckBox->isChecked());
#endif
    checkUpdatesCheckBox->setChecked(getSetting("checkUpdates", true).toBool());
    observeClipboardCheckBox->setChecked(getSetting("observeClipboard", false).toBool());
    quitGUIAfterCoreExitCheckBox->setChecked(getSetting("quitGUIAfterCoreExit", true).toBool());
    profilesStatusbarCheckBox->setChecked(getSetting("profilesStatusbar", false).toBool());
    videoEdit->setText(video());
    audioEdit->setText(audio());
    imageEdit->setText(image());
    textEdit->setText(text());
    archiveEdit->setText(archive());
    cddvdEdit->setText(cddvd());
}
开发者ID:BackupTheBerlios,项目名称:juicer-svn,代码行数:82,代码来源:optionsdialog.cpp

示例12: presentarSyS


//.........这里部分代码省略.........
                ldebe = QString::number ( ldebe.toDouble(), 'f', 2 );
                lhaber = QString::number ( lhaber.toDouble(), 'f', 2 );
                lsaldo = QString::number ( lsaldo.toDouble(), 'f', 2 );
                ldebeej = QString::number ( ldebeej.toDouble(), 'f', 2 );
                lhaberej = QString::number ( lhaberej.toDouble(), 'f', 2 );
                lsaldoej = QString::number ( lsaldoej.toDouble(), 'f', 2 );

                /// Ahora, vamos a pintar en el Widget cada l&iacute;nea.
                /// Formamos la l&iacute;nea.
                datos << lcuenta << ldenominacion << lsaldoant << ldebe << lhaber << lsaldo << ldebeej << lhaberej << lsaldoej;

                /// Si se van mostrar tambi&eacute;n las cuentas superiores, habr&aacute; que
                /// jerarquizar el &aacute;rbol. Sino, se pinta cada l&iacute;nea al mismo nivel.
                if ( jerarquico ) { /// jerarquizando...
                    nivelActual = lcuenta.length();
                    if ( nivelActual == 2 ) {
                        /// La hoja cuelga de la ra&iacute;z principal.
                        it = new QTreeWidgetItem ( mui_list, datos );
                    } else {
                        while ( ptrIt.key() >= nivelActual )
                            /// Ascendemos por el &aacute;rbol para colgar la hoja en el
                            /// lugar correcto.
                            ptrIt--;
                        it = new QTreeWidgetItem ( ptrIt.value(), datos );
                    } // end if
                    /// Insertamos el widget (hoja actual) en la tabla controlada y obtenemos
                    /// su puntero iterador.
                    ptrIt = ptrList.insert ( nivelActual, it );
                    mui_list->setItemExpanded ( it, true );
                    /// Borramos el resto de niveles que cuelgan, para no seguir colgando por
                    /// esa rama.
                    i = ptrIt + 1;
                    while ( i != ptrList.constEnd() ) {
                        /// Borra todas las entradas con la misma clave.
                        ptrList.remove ( i.key() );
                        ++i;
                    } // end while
                } else { /// sin jerarquizar...
                    it = new QTreeWidgetItem ( mui_list, datos );
                } // end if
                datos.clear();

                /// Formateamos un poquito la informaci&oacute;n mostrada.
                int tamanyo = 10;
                if ( ldenominacion.length() > 40 ) {
                    tamanyo -= 1;
                } else if ( ldenominacion.length() > 50 ) {
                    tamanyo -= 2;
                } // end if
                it->setFont ( DENOMINACION, QFont ( "Serif", tamanyo, -1, false ) );
                for ( int col = 0; col < it->columnCount(); col++ ) {

                    if ( col == DEBE || col == HABER || col == SALDO ||  col == DEBEEJ || col == HABEREJ || col == SALDOEJ ) {
                        it->setFont ( col, QFont ( "SansSerif", 9, QFont::DemiBold, false ) );
                    } else {
                        it->setFont ( col, QFont ( "SansSerif", 9, QFont::Normal, false ) );
                    } // end if
                    it->setTextAlignment ( col, Qt::AlignRight );

                    if ( lcuenta.size() == 2 ) {
                        it->setTextColor ( col, Qt::darkGray );
                        it->setFont ( col, QFont ( "SansSerif", 10, QFont::Bold, false ) );
                    } else if ( lcuenta.size() < 5 ) {
                        it->setTextColor ( col, Qt::blue );
                    } else {
                        if ( it->text ( col ).left ( 1 ) == "-" ) {
                            it->setTextColor ( col, Qt::darkRed );
                        } else {
                            it->setTextColor ( col, Qt::black );
                        } // end if
                    } // end if
                } // end for
            } // end if
        } // end while
        mui_list->resizeColumnToContents ( 1 );

        /// Hacemos la actualizaci&oacute;n de los saldos totales en formato
        /// espa&ntilde;ol y los ponemos en su Widget.
        QString totsaldoant = tsaldoant.toQString();
        QString totdebe = tdebe.toQString();
        QString tothaber = thaber.toQString();
        QString totsaldo = tsaldo.toQString();
        mui_totalSaldoAnterior->setText ( totsaldoant );
        mui_totalDebe->setText ( totdebe );
        mui_totalHaber->setText ( tothaber );
        mui_totalSaldo->setText ( totsaldo );

        /// Eliminamos el &aacute;rbol de la mem&oacute;ria y cerramos la conexi&oacute;n
        /// con la BD.
        delete arbol;
        mainCompany() ->commit();
    } catch ( ... ) {
        blMsgInfo ( _("Error en los calculos.") );
        mainCompany() ->rollback();
        /// Libermos posible memoria utilizada
        if ( ramas ) delete ramas;
        if ( hojas ) delete hojas;
    } // end try

}
开发者ID:i02sopop,项目名称:Bulmages,代码行数:101,代码来源:balanceview.cpp


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