本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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);
}
示例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;
}
示例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;
}
示例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;
}
示例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());
}
示例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ínea.
/// Formamos la línea.
datos << lcuenta << ldenominacion << lsaldoant << ldebe << lhaber << lsaldo << ldebeej << lhaberej << lsaldoej;
/// Si se van mostrar también las cuentas superiores, habrá que
/// jerarquizar el árbol. Sino, se pinta cada línea al mismo nivel.
if ( jerarquico ) { /// jerarquizando...
nivelActual = lcuenta.length();
if ( nivelActual == 2 ) {
/// La hoja cuelga de la raíz principal.
it = new QTreeWidgetItem ( mui_list, datos );
} else {
while ( ptrIt.key() >= nivelActual )
/// Ascendemos por el á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ó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ón de los saldos totales en formato
/// españ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 árbol de la memória y cerramos la conexió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
}