本文整理汇总了C++中columnCount函数的典型用法代码示例。如果您正苦于以下问题:C++ columnCount函数的具体用法?C++ columnCount怎么用?C++ columnCount使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了columnCount函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: width
int KColorCells::sizeHintForColumn( int /*column*/ ) const
{
return width() / columnCount() ;
}
开发者ID:Ramblurr,项目名称:PietCreator,代码行数:4,代码来源:KColorCells.cpp
示例2: ResizeAllCols
void DGameTree::ResizeAllCols()
{
for (int i = 0; i < columnCount(); i++)
resizeColumnToContents(i);
}
开发者ID:BananaMuffinFrenzy,项目名称:dolphin,代码行数:5,代码来源:GameTree.cpp
示例3: dataChanged
void EntryAttachmentsModel::attachmentChange(const QString& key)
{
int row = m_entryAttachments->keys().indexOf(key);
Q_EMIT dataChanged(index(row, 0), index(row, columnCount()-1));
}
开发者ID:Amazeus-Mozart,项目名称:keepassx,代码行数:5,代码来源:EntryAttachmentsModel.cpp
示例4: dataChanged
void ListModel::Update (int pos)
{
emit dataChanged (index (pos, 0),
index (pos, columnCount () - 1));
}
开发者ID:SboichakovDmitriy,项目名称:leechcraft,代码行数:5,代码来源:listmodel.cpp
示例5: foreach
Message ChatLineModel::takeMessageAt(int i)
{
Message msg = _messageList[i].message();
_messageList.removeAt(i);
return msg;
}
void ChatLineModel::styleChanged()
{
foreach(ChatLineModelItem item, _messageList) {
item.invalidateWrapList();
}
emit dataChanged(index(0, 0), index(rowCount()-1, columnCount()-1));
}
QDataStream &operator<<(QDataStream &out, const ChatLineModel::WrapList wplist)
{
out << wplist.count();
ChatLineModel::WrapList::const_iterator it = wplist.begin();
while (it != wplist.end()) {
out << (*it).start << (*it).width << (*it).trailing;
++it;
}
return out;
}
开发者ID:AGBrown,项目名称:quassel-ABContrib,代码行数:27,代码来源:chatlinemodel.cpp
示例6: QVariant
QVariant QgsNodeEditorModel::data( const QModelIndex& index, int role ) const
{
if ( !index.isValid() ||
( role != Qt::DisplayRole && role != Qt::EditRole && role != MinRadiusRole && role != Qt::FontRole ) )
return QVariant();
if ( index.row() >= mSelectedFeature->vertexMap().count() )
return QVariant();
if ( index.column() >= columnCount() )
return QVariant();
//get QgsVertexEntry for row
const QgsVertexEntry* vertex = mSelectedFeature->vertexMap().at( index.row() );
if ( !vertex )
{
return QVariant();
}
if ( role == Qt::FontRole )
{
double r = 0;
double minRadius = 0;
if ( calcR( index.row(), r, minRadius ) )
{
QFont curvePointFont = mWidgetFont;
curvePointFont.setItalic( true );
return curvePointFont;
}
else
{
return QVariant();
}
}
if ( role == MinRadiusRole )
{
if ( index.column() == mRCol )
{
double r = 0;
double minRadius = 0;
if ( calcR( index.row(), r, minRadius ) )
{
return minRadius;
}
}
return QVariant();
}
if ( index.column() == 0 )
return vertex->point().x();
else if ( index.column() == 1 )
return vertex->point().y();
else if ( index.column() == mZCol )
return vertex->point().z();
else if ( index.column() == mMCol )
return vertex->point().m();
else if ( index.column() == mRCol )
{
double r = 0;
double minRadius = 0;
if ( calcR( index.row(), r, minRadius ) )
{
return r;
}
return QVariant();
}
else
{
return QVariant();
}
}
开发者ID:3liz,项目名称:Quantum-GIS,代码行数:73,代码来源:qgsnodeeditor.cpp
示例7: dataChanged
void TorrentContentModel::selectNone()
{
for (int i = 0; i < m_rootItem->childCount(); ++i)
m_rootItem->child(i)->setPriority(prio::IGNORED);
emit dataChanged(index(0, 0), index(rowCount(), columnCount()));
}
开发者ID:aj-m,项目名称:qBittorrent,代码行数:6,代码来源:torrentcontentmodel.cpp
示例8: data
QVariant SimpleTreeItem::data(int column, int role) const {
if(column >= columnCount() || role != Qt::DisplayRole)
return QVariant();
else
return _itemData[column];
}
开发者ID:Yofel,项目名称:quassel-log-export,代码行数:6,代码来源:treemodel.cpp
示例9: Iax2AnalysisTreeWidgetItem
Iax2AnalysisTreeWidgetItem(QTreeWidget *tree, tap_iax2_stat_t *statinfo, packet_info *pinfo) :
QTreeWidgetItem(tree, iax2_analysis_type_)
{
frame_num_ = pinfo->fd->num;
pkt_len_ = pinfo->fd->pkt_len;
flags_ = statinfo->flags;
if (flags_ & STAT_FLAG_FIRST) {
delta_ = 0.0;
jitter_ = 0.0;
} else {
delta_ = statinfo->delta;
jitter_ = statinfo->jitter;
}
bandwidth_ = statinfo->bandwidth;
ok_ = false;
QColor bg_color = QColor();
QString status;
if (statinfo->flags & STAT_FLAG_WRONG_SEQ) {
status = QObject::tr("Wrong sequence number");
bg_color = ColorUtils::expert_color_error;
} else if (statinfo->flags & STAT_FLAG_REG_PT_CHANGE) {
status = QObject::tr("Payload changed to PT=%1").arg(statinfo->pt);
bg_color = color_rtp_warn_;
} else if (statinfo->flags & STAT_FLAG_WRONG_TIMESTAMP) {
status = QObject::tr("Incorrect timestamp");
/* color = COLOR_WARNING; */
bg_color = color_rtp_warn_;
} else if ((statinfo->flags & STAT_FLAG_PT_CHANGE)
&& !(statinfo->flags & STAT_FLAG_FIRST)
&& !(statinfo->flags & STAT_FLAG_PT_CN)
&& (statinfo->flags & STAT_FLAG_FOLLOW_PT_CN)
&& !(statinfo->flags & STAT_FLAG_MARKER)) {
status = QObject::tr("Marker missing?");
bg_color = color_rtp_warn_;
} else {
if (statinfo->flags & STAT_FLAG_MARKER) {
bg_color = color_rtp_warn_;
}
}
if (status.isEmpty()) {
ok_ = true;
status = UTF8_CHECK_MARK;
}
setText(packet_col_, QString::number(frame_num_));
setText(delta_col_, QString::number(delta_, 'f', 2));
setText(jitter_col_, QString::number(jitter_, 'f', 2));
setText(bandwidth_col_, QString::number(bandwidth_, 'f', 2));
setText(status_col_, status);
setText(length_col_, QString::number(pkt_len_));
setTextAlignment(packet_col_, Qt::AlignRight);
setTextAlignment(delta_col_, Qt::AlignRight);
setTextAlignment(jitter_col_, Qt::AlignRight);
setTextAlignment(bandwidth_col_, Qt::AlignRight);
setTextAlignment(length_col_, Qt::AlignRight);
if (bg_color.isValid()) {
for (int col = 0; col < columnCount(); col++) {
setBackground(col, bg_color);
setForeground(col, ColorUtils::expert_color_foreground);
}
}
}
开发者ID:kinglongmee,项目名称:wireshark,代码行数:67,代码来源:iax2_analysis_dialog.cpp
示例10: SetCurrentCell
void cCustomShotTable::SetCurrentCell(int Index) {
if ((Index<0)||(Index>=columnCount())) return;
setCurrentCell(0,Index,QItemSelectionModel::Select|QItemSelectionModel::Current);
}
开发者ID:JonasCz,项目名称:ffdiaporama-1604-builds,代码行数:4,代码来源:cCustomShotTable.cpp
示例11: RepaintCell
void cCustomShotTable::RepaintCell(int Index) {
if ((Index<0)||(Index>=columnCount())) return;
update(model()->index(0,Index));
}
开发者ID:JonasCz,项目名称:ffdiaporama-1604-builds,代码行数:5,代码来源:cCustomShotTable.cpp
示例12: columnCount
int cCustomShotTable::NbrItem() {
return columnCount();
}
开发者ID:JonasCz,项目名称:ffdiaporama-1604-builds,代码行数:3,代码来源:cCustomShotTable.cpp
示例13: layerBoundsInFlowThread
void RenderMultiColumnSet::collectLayerFragments(LayerFragments& fragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect)
{
// Let's start by introducing the different coordinate systems involved here. They are different
// in how they deal with writing modes and columns. RenderLayer rectangles tend to be more
// physical than the rectangles used in RenderObject & co.
//
// The two rectangles passed to this method are physical, except that we pretend that there's
// only one long column (that's the flow thread). They are relative to the top left corner of
// the flow thread. All rectangles being compared to the dirty rect also need to be in this
// coordinate system.
//
// Then there's the output from this method - the stuff we put into the list of fragments. The
// translationOffset point is the actual physical translation required to get from a location in
// the flow thread to a location in some column. The paginationClip rectangle is in the same
// coordinate system as the two rectangles passed to this method (i.e. physical, in flow thread
// coordinates, pretending that there's only one long column).
//
// All other rectangles in this method are slightly less physical, when it comes to how they are
// used with different writing modes, but they aren't really logical either. They are just like
// RenderBox::frameRect(). More precisely, the sizes are physical, and the inline direction
// coordinate is too, but the block direction coordinate is always "logical top". These
// rectangles also pretend that there's only one long column, i.e. they are for the flow thread.
//
// To sum up: input and output from this method are "physical" RenderLayer-style rectangles and
// points, while inside this method we mostly use the RenderObject-style rectangles (with the
// block direction coordinate always being logical top).
// Put the layer bounds into flow thread-local coordinates by flipping it first. Since we're in
// a renderer, most rectangles are represented this way.
LayoutRect layerBoundsInFlowThread(layerBoundingBox);
flowThread()->flipForWritingMode(layerBoundsInFlowThread);
// Now we can compare with the flow thread portions owned by each column. First let's
// see if the rect intersects our flow thread portion at all.
LayoutRect clippedRect(layerBoundsInFlowThread);
clippedRect.intersect(RenderRegion::flowThreadPortionOverflowRect());
if (clippedRect.isEmpty())
return;
// Now we know we intersect at least one column. Let's figure out the logical top and logical
// bottom of the area we're checking.
LayoutUnit layerLogicalTop = isHorizontalWritingMode() ? layerBoundsInFlowThread.y() : layerBoundsInFlowThread.x();
LayoutUnit layerLogicalBottom = (isHorizontalWritingMode() ? layerBoundsInFlowThread.maxY() : layerBoundsInFlowThread.maxX()) - 1;
// Figure out the start and end columns and only check within that range so that we don't walk the
// entire column set.
unsigned startColumn = columnIndexAtOffset(layerLogicalTop);
unsigned endColumn = columnIndexAtOffset(layerLogicalBottom);
LayoutUnit colLogicalWidth = computedColumnWidth();
LayoutUnit colGap = columnGap();
unsigned colCount = columnCount();
RenderBlockFlow* parentFlow = toRenderBlockFlow(parent());
bool progressionReversed = parentFlow->multiColumnFlowThread()->progressionIsReversed();
bool progressionIsInline = parentFlow->multiColumnFlowThread()->progressionIsInline();
LayoutUnit initialBlockOffset = initialBlockOffsetForPainting();
for (unsigned i = startColumn; i <= endColumn; i++) {
// Get the portion of the flow thread that corresponds to this column.
LayoutRect flowThreadPortion = flowThreadPortionRectAt(i);
// Now get the overflow rect that corresponds to the column.
LayoutRect flowThreadOverflowPortion = flowThreadPortionOverflowRect(flowThreadPortion, i, colCount, colGap);
// In order to create a fragment we must intersect the portion painted by this column.
LayoutRect clippedRect(layerBoundsInFlowThread);
clippedRect.intersect(flowThreadOverflowPortion);
if (clippedRect.isEmpty())
continue;
// We also need to intersect the dirty rect. We have to apply a translation and shift based off
// our column index.
LayoutPoint translationOffset;
LayoutUnit inlineOffset = progressionIsInline ? i * (colLogicalWidth + colGap) : LayoutUnit();
bool leftToRight = style().isLeftToRightDirection() ^ progressionReversed;
if (!leftToRight) {
inlineOffset = -inlineOffset;
if (progressionReversed)
inlineOffset += contentLogicalWidth() - colLogicalWidth;
}
translationOffset.setX(inlineOffset);
LayoutUnit blockOffset = initialBlockOffset + (isHorizontalWritingMode() ? -flowThreadPortion.y() : -flowThreadPortion.x());
if (!progressionIsInline) {
if (!progressionReversed)
blockOffset = i * colGap;
else
blockOffset -= i * (computedColumnHeight() + colGap);
}
if (isFlippedBlocksWritingMode(style().writingMode()))
blockOffset = -blockOffset;
translationOffset.setY(blockOffset);
if (!isHorizontalWritingMode())
translationOffset = translationOffset.transposedPoint();
// FIXME: The translation needs to include the multicolumn set's content offset within the
// multicolumn block as well. This won't be an issue until we start creating multiple multicolumn sets.
// Shift the dirty rect to be in flow thread coordinates with this translation applied.
//.........这里部分代码省略.........
开发者ID:boska,项目名称:webkit,代码行数:101,代码来源:RenderMultiColumnSet.cpp
示例14: toRenderBlockFlow
void RenderMultiColumnSet::paintColumnRules(PaintInfo& paintInfo, const LayoutPoint& paintOffset)
{
if (paintInfo.context->paintingDisabled())
return;
RenderMultiColumnFlowThread* flowThread = toRenderBlockFlow(parent())->multiColumnFlowThread();
const RenderStyle& blockStyle = parent()->style();
const Color& ruleColor = blockStyle.visitedDependentColor(CSSPropertyWebkitColumnRuleColor);
bool ruleTransparent = blockStyle.columnRuleIsTransparent();
EBorderStyle ruleStyle = blockStyle.columnRuleStyle();
LayoutUnit ruleThickness = blockStyle.columnRuleWidth();
LayoutUnit colGap = columnGap();
bool renderRule = ruleStyle > BHIDDEN && !ruleTransparent;
if (!renderRule)
return;
unsigned colCount = columnCount();
if (colCount <= 1)
return;
bool antialias = shouldAntialiasLines(paintInfo.context);
if (flowThread->progressionIsInline()) {
bool leftToRight = style().isLeftToRightDirection() ^ flowThread->progressionIsReversed();
LayoutUnit currLogicalLeftOffset = leftToRight ? LayoutUnit() : contentLogicalWidth();
LayoutUnit ruleAdd = logicalLeftOffsetForContent();
LayoutUnit ruleLogicalLeft = leftToRight ? LayoutUnit() : contentLogicalWidth();
LayoutUnit inlineDirectionSize = computedColumnWidth();
BoxSide boxSide = isHorizontalWritingMode()
? leftToRight ? BSLeft : BSRight
: leftToRight ? BSTop : BSBottom;
for (unsigned i = 0; i < colCount; i++) {
// Move to the next position.
if (leftToRight) {
ruleLogicalLeft += inlineDirectionSize + colGap / 2;
currLogicalLeftOffset += inlineDirectionSize + colGap;
} else {
ruleLogicalLeft -= (inlineDirectionSize + colGap / 2);
currLogicalLeftOffset -= (inlineDirectionSize + colGap);
}
// Now paint the column rule.
if (i < colCount - 1) {
LayoutUnit ruleLeft = isHorizontalWritingMode() ? paintOffset.x() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd : paintOffset.x() + borderLeft() + paddingLeft();
LayoutUnit ruleRight = isHorizontalWritingMode() ? ruleLeft + ruleThickness : ruleLeft + contentWidth();
LayoutUnit ruleTop = isHorizontalWritingMode() ? paintOffset.y() + borderTop() + paddingTop() : paintOffset.y() + ruleLogicalLeft - ruleThickness / 2 + ruleAdd;
LayoutUnit ruleBottom = isHorizontalWritingMode() ? ruleTop + contentHeight() : ruleTop + ruleThickness;
IntRect pixelSnappedRuleRect = pixelSnappedIntRectFromEdges(ruleLeft, ruleTop, ruleRight, ruleBottom);
drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias);
}
ruleLogicalLeft = currLogicalLeftOffset;
}
} else {
bool topToBottom = !style().isFlippedBlocksWritingMode() ^ flowThread->progressionIsReversed();
LayoutUnit ruleLeft = isHorizontalWritingMode() ? LayoutUnit() : colGap / 2 - colGap - ruleThickness / 2;
LayoutUnit ruleWidth = isHorizontalWritingMode() ? contentWidth() : ruleThickness;
LayoutUnit ruleTop = isHorizontalWritingMode() ? colGap / 2 - colGap - ruleThickness / 2 : LayoutUnit();
LayoutUnit ruleHeight = isHorizontalWritingMode() ? ruleThickness : contentHeight();
LayoutRect ruleRect(ruleLeft, ruleTop, ruleWidth, ruleHeight);
if (!topToBottom) {
if (isHorizontalWritingMode())
ruleRect.setY(height() - ruleRect.maxY());
else
ruleRect.setX(width() - ruleRect.maxX());
}
ruleRect.moveBy(paintOffset);
BoxSide boxSide = isHorizontalWritingMode() ? topToBottom ? BSTop : BSBottom : topToBottom ? BSLeft : BSRight;
LayoutSize step(0, topToBottom ? computedColumnHeight() + colGap : -(computedColumnHeight() + colGap));
if (!isHorizontalWritingMode())
step = step.transposedSize();
for (unsigned i = 1; i < colCount; i++) {
ruleRect.move(step);
IntRect pixelSnappedRuleRect = pixelSnappedIntRect(ruleRect);
drawLineForBoxSide(paintInfo.context, pixelSnappedRuleRect.x(), pixelSnappedRuleRect.y(), pixelSnappedRuleRect.maxX(), pixelSnappedRuleRect.maxY(), boxSide, ruleColor, ruleStyle, 0, 0, antialias);
}
}
}
开发者ID:boska,项目名称:webkit,代码行数:84,代码来源:RenderMultiColumnSet.cpp
示例15: dataChanged
void ConnectionModel::updateAll()
{
emit dataChanged(index(0, 0), index(rowCount(), columnCount()));
}
开发者ID:Drakey83,项目名称:steamlink-sdk,代码行数:4,代码来源:signalsloteditorwindow.cpp
示例16: ClearPix
void SeView::dropEvent(QDropEvent * e)
{
QString str, tmp;
bool lastPage = false;
if (e->mimeData()->hasFormat("page/magic"))
{
e->setDropAction(Qt::MoveAction);
e->accept();
// HACK to prevent strange Qt4 cursor behaviour after dropping. It's examined by Trolltech now - PV.
// It's the one and only reason why to include QApplication here.
// But sadly this destroys our normal Cursors
// Fixed at least in Qt-4.4.2
// QApplication::restoreOverrideCursor();
str = e->mimeData()->text();
ClearPix();
if (str.startsWith("1"))
{
int a = rowAt(e->pos().y());
int b = columnAt(e->pos().x());
int p;
tmp = str.remove(0,1);
if ((a == -1) || (b == -1))
return;
if (a == rowCount()-1)
{
emit NewPage(MaxC+1, tmp);
return;
}
p = GetPage(a, b, &lastPage);
if (columnCount() == 1)
{
if ((a % 2) == 0)
emit NewPage(p, tmp);
else
{
emit UseTemp(tmp, p);
QTableWidgetItem* ite = item(a, b);
if (ite == 0)
return;
if (ite->type() == 1002)
{
SeItem* it = (SeItem*)ite;
it->pageName = tmp;
}
}
return;
}
else
{
if ((b % 2) == 0)
{
if (lastPage)
emit NewPage(p+1, tmp);
else
emit NewPage(p, tmp);
}
else
{
emit UseTemp(tmp, p);
QTableWidgetItem* ite = item(a, b);
if (ite == 0)
return;
if (ite->type() == 1002)
{
SeItem* it = (SeItem*)ite;
it->pageName = tmp;
}
}
return;
}
}
if (str.startsWith("2"))
{
int st = str.indexOf(" ");
int en = str.indexOf(" ", st+1);
tmp = str.mid(en+1);
int dr = str.mid(st, en-st).toInt();
int a = rowAt(e->pos().y());
int b = columnAt(e->pos().x());
int p;
if ((a == -1) || (b == -1))
return;
QTableWidgetItem* ite = item(a, b);
p = GetPage(a, b, &lastPage);
if (a == rowCount()-1)
{
emit movePage(dr, p+1);
return;
}
if (columnCount() == 1)
{
if ((a % 2) == 0)
emit movePage(dr, p);
else
{
emit UseTemp(tmp, p);
if (ite == 0)
return;
SeItem* it = (SeItem*)ite;
it->pageName = tmp;
//.........这里部分代码省略.........
开发者ID:ivro,项目名称:scribus,代码行数:101,代码来源:pagepalette.cpp
示例17: clearSelection
void MemoryViewWidget::Update()
{
clearSelection();
setColumnCount(3 + GetColumnCount(m_type));
if (rowCount() == 0)
setRowCount(1);
setRowHeight(0, 24);
// Calculate (roughly) how many rows will fit in our table
int rows = std::round((height() / static_cast<float>(rowHeight(0))) - 0.25);
setRowCount(rows);
for (int i = 0; i < rows; i++)
{
setRowHeight(i, 24);
u32 addr = m_address - ((rowCount() / 2) * 16) + i * 16;
auto* bp_item = new QTableWidgetItem;
bp_item->setFlags(Qt::ItemIsEnabled);
bp_item->setData(Qt::UserRole, addr);
setItem(i, 0, bp_item);
auto* addr_item = new QTableWidgetItem(QStringLiteral("%1").arg(addr, 8, 16, QLatin1Char('0')));
addr_item->setData(Qt::UserRole, addr);
addr_item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
setItem(i, 1, addr_item);
if (addr == m_address)
addr_item->setSelected(true);
if (Core::GetState() != Core::State::Paused || !PowerPC::HostIsRAMAddress(addr))
{
for (int c = 2; c < columnCount(); c++)
{
auto* item = new QTableWidgetItem(QStringLiteral("-"));
item->setFlags(Qt::ItemIsEnabled);
item->setData(Qt::UserRole, addr);
setItem(i, c, item);
}
continue;
}
auto* description_item =
new QTableWidgetItem(QString::fromStdString(PowerPC::debug_interface.GetDescription(addr)));
description_item->setForeground(Qt::blue);
description_item->setFlags(Qt::ItemIsEnabled);
setItem(i, columnCount() - 1, description_item);
bool row_breakpoint = true;
auto update_values = [&](auto value_to_string) {
for (int c = 0; c < GetColumnCount(m_type); c++)
{
auto* hex_item = new QTableWidgetItem;
hex_item->setFlags(Qt::ItemIsEnabled | Qt::ItemIsSelectable);
const u32 address = addr + c * (16 / GetColumnCount(m_type));
if (PowerPC::memchecks.OverlapsMemcheck(address, 16 / GetColumnCount(m_type)))
hex_item->setBackground(Qt::red);
else
row_breakpoint = false;
setItem(i, 2 + c, hex_item);
if (PowerPC::HostIsRAMAddress(address))
{
hex_item->setText(value_to_string(address));
hex_item->setData(Qt::UserRole, address);
}
else
{
hex_item->setFlags(0);
hex_item->setText(QStringLiteral("-"));
}
}
};
switch (m_type)
{
case Type::U8:
update_values([](u32 address) {
const u8 value = PowerPC::HostRead_U8(address);
return QStringLiteral("%1").arg(value, 2, 16, QLatin1Char('0'));
});
break;
case Type::ASCII:
update_values([](u32 address) {
const char value = PowerPC::HostRead_U8(address);
//.........这里部分代码省略.........
开发者ID:MerryMage,项目名称:dolphin,代码行数:101,代码来源:MemoryViewWidget.cpp
示例18: if
bool JSON_Model::setData(QModelIndex const& index, QVariant const& value, int role)
{
if (!index.isValid())
{
return false;
}
auto* ti = (Tree_Item*)index.internalPointer();
if (!ti || !ti->m_json)
{
return false;
}
bool modified = false;
auto* json = ti->m_json;
if (role == Qt::DisplayRole || role == Qt::EditRole)
{
if (index.column() == 1)
{
if (json->IsBool())
{
json->SetBool(value.toBool());
modified = true;
}
else if (json->IsInt())
{
json->SetInt(value.toInt());
modified = true;
}
else if (json->IsUint())
{
json->SetUint(value.toUInt());
modified = true;
}
else if (json->IsInt64())
{
json->SetInt64(value.toLongLong());
modified = true;
}
else if (json->IsUint64())
{
json->SetUint64(value.toULongLong());
modified = true;
}
else if (json->IsDouble() || json->IsNumber())
{
json->SetDouble(value.toDouble());
modified = true;
}
else if (json->IsString())
{
json->SetString(value.toString().toLatin1().data(), m_document->GetAllocator());
modified = true;
}
}
}
if (modified)
{
emit dataChanged(createIndex(index.row(), 0, index.internalPointer()), createIndex(index.row(), columnCount(), index.internalPointer()));
}
return modified;
}
开发者ID:ggggamer,项目名称:silkopter,代码行数:64,代码来源:JSON_Model.cpp
示例19: layerBoundsInFlowThread
void RenderMultiColumnSet::collectLayerFragments(LayerFragments& fragments, const LayoutRect& layerBoundingBox, const LayoutRect& dirtyRect)
{
// The two rectangles passed to this method are physical, except that we pretend that there's
// only one long column (that's how a flow thread works).
//
// Then there's the output from this method - the stuff we put into the list of fragments. The
// fragment.paginationOffset point is the actual physical translation required to get from a
// location in the flow thread to a location in a given column. The fragment.paginationClip
// rectangle, on the other hand, is in the same coordinate system as the two rectangles passed
// to this method (flow thread coordinates).
//
// All other rectangles in this method are sized physically, and the inline direction coordinate
// is physical too, but the block direction coordinate is "logical top". This is the same as
// e.g. RenderBox::frameRect(). These rectangles also pretend that there's only one long column,
// i.e. they are for the flow thread.
// Put the layer bounds into flow thread-local coordinates by flipping it first. Since we're in
// a renderer, most rectangles are represented this way.
LayoutRect layerBoundsInFlowThread(layerBoundingBox);
flowThread()->flipForWritingMode(layerBoundsInFlowThread);
// Now we can compare with the flow thread portions owned by each column. First let's
// see if the rect intersects our flow thread portion at all.
LayoutRect clippedRect(layerBoundsInFlowThread);
clippedRect.intersect(RenderRegion::flowThreadPortionOverflowRect());
if (clippedRect.isEmpty())
return;
// Now we know we intersect at least one column. Let's figure out the logical top and logical
// bottom of the area we're checking.
LayoutUnit layerLogicalTop = isHorizontalWritingMode() ? layerBoundsInFlowThread.y() : layerBoundsInFlowThread.x();
LayoutUnit layerLogicalBottom = (isHorizontalWritingMode() ? layerBoundsInFlowThread.maxY() : layerBoundsInFlowThread.maxX()) - 1;
// Figure out the start and end columns and only check within that range so that we don't walk the
// entire column set.
unsigned startColumn = columnIndexAtOffset(layerLogicalTop);
unsigned endColumn = columnIndexAtOffset(layerLogicalBottom);
LayoutUnit colLogicalWidth = computedColumnWidth();
LayoutUnit colGap = columnGap();
unsigned colCount = columnCount();
for (unsigned i = startColumn; i <= endColumn; i++) {
// Get the portion of the flow thread that corresponds to this column.
LayoutRect flowThreadPortion = flowThreadPortionRectAt(i);
// Now get the overflow rect that corresponds to the column.
LayoutRect flowThreadOverflowPortion = flowThreadPortionOverflowRect(flowThreadPortion, i, colCount, colGap);
// In order to create a fragment we must intersect the portion painted by this column.
LayoutRect clippedRect(layerBoundsInFlowThread);
clippedRect.intersect(flowThreadOverflowPortion);
if (clippedRect.isEmpty())
continue;
// We also need to intersect the dirty rect. We have to apply a translation and shift based off
// our column index.
LayoutPoint translationOffset;
LayoutUnit inlineOffset = i * (colLogicalWidth + colGap);
if (!style()->isLeftToRightDirection())
inlineOffset = -inlineOffset;
translationOffset.setX(inlineOffset);
LayoutUnit blockOffset = isHorizontalWritingMode() ? -flowThreadPortion.y() : -flowThreadPortion.x();
if (isFlippedBlocksWritingMode(style()->writingMode()))
blockOffset = -blockOffset;
translationOffset.setY(blockOffset);
if (!isHorizontalWritingMode())
translationOffset = translationOffset.transposedPoint();
// FIXME: The translation needs to include the multicolumn set's content offset within the
// multicolumn block as well. This won't be an issue until we start creating multiple multicolumn sets.
// Shift the dirty rect to be in flow thread coordinates with this translation applied.
LayoutRect translatedDirtyRect(dirtyRect);
translatedDirtyRect.moveBy(-translationOffset);
// See if we intersect the dirty rect.
clippedRect = layerBoundingBox;
clippedRect.intersect(translatedDirtyRect);
if (clippedRect.isEmpty())
continue;
// Something does need to paint in this column. Make a fragment now and supply the physical translation
// offset and the clip rect for the column with that offset applied.
LayerFragment fragment;
fragment.paginationOffset = translationOffset;
LayoutRect flippedFlowThreadOverflowPortion(flowThreadOverflowPortion);
// Flip it into more a physical (RenderLayer-style) rectangle.
flowThread()->flipForWritingMode(flippedFlowThreadOverflowPortion);
fragment.paginationClip = flippedFlowThreadOverflowPortion;
fragments.append(fragment);
}
}
开发者ID:junmin-zhu,项目名称:blink,代码行数:93,代码来源:RenderMultiColumnSet.cpp
示例20: index
QModelIndex GlodonTableModel::index(int row, int column, const QModelIndex &parent) const
{
if (row < 0 || column < 0 || row >= rowCount(parent) || column >= columnCount(parent))
return QModelIndex();
return createIndex(row, column);
}
开发者ID:chen12nan,项目名称:customlib,代码行数:6,代码来源:GlodonModel.cpp
注:本文中的columnCount函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论