本文整理汇总了C++中endInsertRows函数的典型用法代码示例。如果您正苦于以下问题:C++ endInsertRows函数的具体用法?C++ endInsertRows怎么用?C++ endInsertRows使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了endInsertRows函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: beginInsertRows
void ItemModel::insert(const Item &item, int index)
{
beginInsertRows(QModelIndex(), index, 0);
m_items.insert(index, item);
endInsertRows();
}
示例2: endInsertRows
void PlaylistModel::endInsertItems()
{
endInsertRows();
}
示例3: Q_UNUSED
void DescriptionModel::descriptionAdded(const QString &description)
{
Q_UNUSED(description)
endInsertRows();
}
示例4: removeDeco
int DivePlannerPointsModel::addStop(int milimeters, int seconds, int cylinderid_in, int ccpoint, bool entered)
{
int cylinderid = 0;
bool usePrevious = false;
if (cylinderid_in)
cylinderid = cylinderid_in;
else
usePrevious = true;
if (recalcQ())
removeDeco();
int row = divepoints.count();
if (seconds == 0 && milimeters == 0 && row != 0) {
/* this is only possible if the user clicked on the 'plus' sign on the DivePoints Table */
const divedatapoint t = divepoints.at(lastEnteredPoint());
milimeters = t.depth;
seconds = t.time + 600; // 10 minutes.
cylinderid = t.cylinderid;
ccpoint = t.setpoint;
} else if (seconds == 0 && milimeters == 0 && row == 0) {
milimeters = M_OR_FT(5, 15); // 5m / 15ft
seconds = 600; // 10 min
// Default to the first cylinder
cylinderid = 0;
}
// check if there's already a new stop before this one:
for (int i = 0; i < row; i++) {
const divedatapoint &dp = divepoints.at(i);
if (dp.time == seconds) {
row = i;
beginRemoveRows(QModelIndex(), row, row);
divepoints.remove(row);
endRemoveRows();
break;
}
if (dp.time > seconds) {
row = i;
break;
}
}
// Previous, actually means next as we are typically subdiving a segment and the gas for
// the segment is determined by the waypoint at the end.
if (usePrevious) {
if (row < divepoints.count()) {
cylinderid = divepoints.at(row).cylinderid;
} else if (row > 0) {
cylinderid = divepoints.at(row - 1).cylinderid;
}
}
// add the new stop
beginInsertRows(QModelIndex(), row, row);
divedatapoint point;
point.depth = milimeters;
point.time = seconds;
point.cylinderid = cylinderid;
point.setpoint = ccpoint;
point.entered = entered;
point.next = NULL;
divepoints.append(point);
std::sort(divepoints.begin(), divepoints.end(), divePointsLessThan);
endInsertRows();
return row;
}
示例5: beginInsertRows
bool UdpListModel::insertRow(int row, const QModelIndex &parent)
{
beginInsertRows(parent, row, row + 1);
endInsertRows();
return true;
}
示例6: append
void append(const Vehicle & vehicle) {
beginInsertRows({}, m_data.count(), m_data.count());
m_data.append(vehicle);
endInsertRows();
}
示例7: beginInsertRows
void DiveListModel::addDive(dive *d)
{
beginInsertRows(QModelIndex(), rowCount(), rowCount());
m_dives.append(MobileDive(d));
endInsertRows();
}
示例8: beginInsertRows
// actually add to table in GUI
void RecentRequestsTableModel::addNewRequest(RecentRequestEntry &recipient)
{
beginInsertRows(QModelIndex(), 0, 0);
list.prepend(recipient);
endInsertRows();
}
示例9: beginInsertRows
void PgnDatabaseModel::onDatabaseAdded(int index)
{
beginInsertRows(QModelIndex(), index, index);
endInsertRows();
}
示例10: beginInsertRows
void PluginModel::addPlugin(PluginInterface *plugin)
{
beginInsertRows(QModelIndex(), m_plugins.count(), m_plugins.count());
m_plugins.append(plugin);
endInsertRows();
}
示例11: f
LogMonitorFileModel::LogMonitorFileModel(const QString &dbPath, QObject *parent)
:AbstractLogModel(parent)
{
m_statistics.error = 0;
m_statistics.warning = 0;
m_statistics.notice = 0;
m_statistics.info = 0;
m_statistics.clients = 0;
QFile f(dbPath);
if (!f.exists())
{
QMessageBox msg;
msg.setIcon(QMessageBox::Warning);
msg.setText("File not found");
msg.setInformativeText(QString("Could not find file %1").arg(dbPath));
msg.exec();
return;
}
QSqlDatabase db = QSqlDatabase::addDatabase("QSQLITE");
db.setDatabaseName(dbPath);
auto success = db.open();
if (!success)
{
auto e = db.lastError();
QMessageBox msg;
msg.setIcon(QMessageBox::Warning);
msg.setText("Open failed");
msg.setInformativeText(QString("Failed to open the file %1.\nError message: %2").arg(dbPath, e.text()));
msg.exec();
return;
}
QSqlQuery query("SELECT m.time, m.pid, m.level, h.name, c.facility, c.object, m.message, p.process"
" FROM messages AS m INNER JOIN hosts AS h ON m.host=h.id INNER JOIN channels AS c ON m.channel=c.id INNER JOIN processes AS p ON m.pid=p.id",
db);
query.setForwardOnly(true);
success = query.exec();
if (!success)
{
auto e = db.lastError();
QMessageBox msg;
msg.setIcon(QMessageBox::Warning);
msg.setText("Open failed");
msg.setInformativeText(QString("Failed to open the file %1.\nError message: %2").arg(dbPath, e.text()));
msg.exec();
return;
}
while (query.next())
{
auto message = new LogMessage;
message->timestamp.setMSecsSinceEpoch(qint64(query.value(0).toDouble() * 1000));
message->pid = query.value(1).toULongLong();
message->severity = LogSeverity(query.value(2).toInt());
message->machineName = query.value(3).toString();
message->module = query.value(4).toString();
message->channel = query.value(5).toString();
message->message = query.value(6).toString();
message->executablePath = query.value(7).toString();
switch (message->severity)
{
case SEVERITY_ERR:
m_statistics.error++;
break;
case SEVERITY_WARN:
m_statistics.warning++;
break;
case SEVERITY_NOTICE:
m_statistics.notice++;
break;
case SEVERITY_INFO:
m_statistics.info++;
break;
default:
break;
}
addMessage(message);
}
if (m_messages.size())
{
beginInsertRows(QModelIndex(), 0, m_messages.size() - 1);
endInsertRows();
}
db.close();
}
示例12: beginInsertRows
void InterfaceTreeCacheModel::addDevice(interface_t * newDevice)
{
emit beginInsertRows(QModelIndex(), rowCount(), rowCount());
newDevices << newDevice;
emit endInsertRows();
}
示例13: beginInsertRows
void FavoriteTagsModel::appendTag(const ItemFavoriteTagItem &item)
{
beginInsertRows(QModelIndex(), m_tags.size(), m_tags.size());
m_tags << item;
endInsertRows();
}
示例14: beginInsertRows
bool TutorModel::insertRows(int row, int count, const QModelIndex &parent)
{
beginInsertRows(QModelIndex(), row, row+count-1);
endInsertRows();
return true;
}
示例15: endInsertRows
void TaskModelAdapter::taskAdded( TaskId id )
{
endInsertRows();
}