/**
 * @brief Converts a selection of this model to a selection in the source model.
 *
 * Reimplemented from QSortFilterProxyModel to peacefully handle items that do
 * not exist in the source model.
 *
 * @param proxy_selection A selection in this model.
 * @return The corresponding source selection.
 */
QItemSelection QuestFilesModel::mapSelectionToSource(const QItemSelection& proxy_selection) const {

  QItemSelection source_selection;

  const QModelIndexList& indexes = proxy_selection.indexes();
  Q_FOREACH (const QModelIndex& index, indexes) {
    const QModelIndex& source_index = mapToSource(index);
    if (!index.isValid()) {
      // Selected item that does not exist in the source model.
      continue;
    }
    source_selection.append(QItemSelectionRange(source_index));
  }

  return source_selection;
}
Пример #2
0
	QVariant FontFilter::data(const QModelIndex &index, int role) const {
		if (not index.isValid())
			return QVariant();

		if (showMoreItem(index)) {
			switch (role) {
				case Qt::BackgroundRole:
					return QVariant(QBrush(QColor(190, 210, 255)));
				default:
					break;
			}
			return QVariant();
		}

		return fontsModel()->data(mapToSource(index), role);
	}
Пример #3
0
Qt::ItemFlags CheckableProxyModel::flags(const QModelIndex &index) const
{
    if (!index.isValid())
        return Qt::NoItemFlags;

    QModelIndex sourceIndex = mapToSource(index);
    Qt::ItemFlags flags = sourceIndex.flags();
    if (index.column() == 0) {
        flags |= Qt::ItemIsUserCheckable;
        if (sourceIndex.model()->hasChildren(sourceIndex)) {
            flags |= Qt::ItemIsTristate;
        }
    }

    return flags;
}
Пример #4
0
/*!
    \reimp
 */
QModelIndexList QIdentityProxyModel::match(const QModelIndex& start, int role, const QVariant& value, int hits, Qt::MatchFlags flags) const
{
    Q_D(const QIdentityProxyModel);
    Q_ASSERT(start.isValid() ? start.model() == this : true);
    if (!d->model)
        return QModelIndexList();

    const QModelIndexList sourceList = d->model->match(mapToSource(start), role, value, hits, flags);
    QModelIndexList::const_iterator it = sourceList.constBegin();
    const QModelIndexList::const_iterator end = sourceList.constEnd();
    QModelIndexList proxyList;
    proxyList.reserve(sourceList.count());
    for ( ; it != end; ++it)
        proxyList.append(mapFromSource(*it));
    return proxyList;
}
Пример #5
0
QVariant SelectionProxyModel::data(const QModelIndex &index, int role) const
{
    if (role==Qt::SizeHintRole) {
        QModelIndex sourceRowIndex = mapToSource(index.sibling(index.row(), 0));
        while (sourceRowIndex.isValid()) {
            if (m_sourceSelectedRows.contains(sourceRowIndex)) {
                return KRecursiveFilterProxyModel::data(index, role);
            }
            sourceRowIndex = sourceRowIndex.parent();
        }

        return QSize(0, 0); // Ultimately we don't want to display those

    } else {
        return KRecursiveFilterProxyModel::data(index, role);
    }
}
QModelIndex MergedProxyModel::index(int row, int column, const QModelIndex &parent) const {
  QModelIndex source_index;

  if (!parent.isValid()) {
    source_index = sourceModel()->index(row, column, QModelIndex());
  } else {
    QModelIndex source_parent = mapToSource(parent);
    const QAbstractItemModel* child_model = merge_points_.key(source_parent);

    if (child_model)
      source_index = child_model->index(row, column, QModelIndex());
    else
      source_index = source_parent.model()->index(row, column, source_parent);
  }

  return mapFromSource(source_index);
}
Пример #7
0
int PlacesModel::indexForUrl(const QString& url) const
{
    QUrl _url(url);
    QModelIndex idx;

    for (int i = 0; i < rowCount(); i++) {
        if (_url == m_sourceModel->url(mapToSource(index(i, 0)))) {
            idx = index(i, 0);
            break;
        }
    }

    if (idx.isValid()) {
        return idx.row();
    }

    return -1;
}
Пример #8
0
void DraftDelegate::paint(QPainter* painter, const QStyleOptionViewItem& option, const QModelIndex& index) const
{
    // Get Player::ownerId
    auto proxyModel = dynamic_cast<const QSortFilterProxyModel*>(index.model());
    auto srcIdx = proxyModel->mapToSource(index);
    auto ownerIdx = m_playerTableModel->index(srcIdx.row(), PlayerTableModel::COLUMN_OWNER);
    auto ownerId = m_playerTableModel->data(ownerIdx, PlayerTableModel::RawDataRole);

    QStyleOptionButton pushButtonOption;
    pushButtonOption.rect = option.rect;
    pushButtonOption.text = (ownerId == 0) ? "Draft" : "Return";
    pushButtonOption.state = QStyle::State_Mini;

    auto opacity = painter->opacity();
    painter->setOpacity(ownerId == 0 ? 1.0f : 0.3f);
    QApplication::style()->drawControl(QStyle::CE_PushButton, &pushButtonOption, painter);
    painter->setOpacity(opacity);
}
Пример #9
0
QModelIndex MessagesProxyModel::getNextUnreadItemIndex(int default_row, int max_row) const {
  while (default_row <= max_row) {
    // Get info if the message is read or not.
    const QModelIndex proxy_index = index(default_row, MSG_DB_READ_INDEX);
    const bool is_read = m_sourceModel->data(mapToSource(proxy_index).row(),
                                             MSG_DB_READ_INDEX, Qt::EditRole).toInt() == 1;

    if (!is_read) {
      // We found unread message, mark it.
      return proxy_index;
    }
    else {
      default_row++;
    }
  }

  return QModelIndex();
}
/**
 * @brief Returns the path of the file at the specified index.
 *
 * Only the row of the index is considered, so the result is the same for all
 * columns.
 *
 * @param index Index of an item in this model.
 * @return The corresponding path.
 */
QString QuestFilesModel::get_file_path(const QModelIndex& index) const {

  if (!index.isValid()) {
    return "";
  }

  QString extra_path;
  if (is_extra_path(index, extra_path)) {
    // The item is a declared resource element whose file is missing
    // (see how rowCount() adds rows for missing elements).
    return extra_path;
  }

  // The item is a file that exists on the filesystem.
  QModelIndex source_index = mapToSource(index);
  QModelIndex file_source_index = source_model->index(
        source_index.row(), FILE_COLUMN, source_index.parent());
  return source_model->filePath(file_source_index);
}
Пример #11
0
QVariant
PlayableProxyModel::data( const QModelIndex& index, int role ) const
{
    if ( role == StyleRole )
        return m_style;

    if ( !sourceModel() )
        return QVariant();
    if ( !m_headerStyle.contains( m_style ) )
        return QVariant();
    if ( index.column() < 0 || index.column() >= m_headerStyle[ m_style ].count() )
        return QVariant();

    PlayableModel::Columns col = m_headerStyle[ m_style ].at( index.column() );
    QModelIndex sourceIdx = mapToSource( index );
    QModelIndex idx = sourceModel()->index( sourceIdx.row(), (int)col, sourceIdx.parent() );

    return idx.data( role );
}
Пример #12
0
QVariant HistoryCompletionModel::data(const QModelIndex &index, int role) const
{
    if (sourceModel()
        && (role == Qt::EditRole || role == Qt::DisplayRole)
        && index.isValid()) {
        QModelIndex idx = mapToSource(index);
        idx = idx.sibling(idx.row(), 1);
        QString urlString = idx.data(HistoryModel::UrlStringRole).toString();
        if (index.row() % 2) {
            QUrl url = urlString;
            QString s = url.toString(QUrl::RemoveScheme
                                     | QUrl::RemoveUserInfo
                                     | QUrl::StripTrailingSlash);
            return s.mid(2);  // strip // from the front
        }
        return urlString;
    }
    return QAbstractProxyModel::data(index, role);
}
QVariant ImapAccountListModel::data(const QModelIndex &index, int role) const{
    if (index.row() < 0)
        return QVariant();

    QModelIndex sourceModelIndex = mapToSource(index);

    if(role == AccountNameRole) {
        qulonglong syncAccountid = QSettings().value("syncAccountId", -1).toULongLong();
        qulonglong currentAccountId = accountListModel->idFromIndex(sourceModelIndex).toULongLong();
        QString accountName = accountListModel->data(sourceModelIndex, QMailAccountListModel::NameTextRole).toString();
        if (currentAccountId == syncAccountid) {
            accountName += " *";
        }
        return accountName;
    } else if (role == AccountIdRole)
        return accountListModel->idFromIndex(sourceModelIndex).toULongLong();

    return QVariant();
}
int MergedProxyModel::rowCount(const QModelIndex &parent) const {
  if (!parent.isValid())
    return sourceModel()->rowCount(QModelIndex());

  QModelIndex source_parent = mapToSource(parent);
  if (!IsKnownModel(source_parent.model()))
    return 0;

  const QAbstractItemModel* child_model = merge_points_.key(source_parent);
  if (child_model) {
    // Query the source model but disregard what it says, so it gets a chance
    // to lazy load
    source_parent.model()->rowCount(source_parent);

    return child_model->rowCount(QModelIndex());
  }

  return source_parent.model()->rowCount(source_parent);
}
Пример #15
0
QMimeData *
PlaylistsInFoldersProxy::mimeData( const QModelIndexList &indexes ) const
{
    DEBUG_BLOCK
    AmarokMimeData* mime = new AmarokMimeData();
    QModelIndexList sourceIndexes;
    foreach( const QModelIndex &idx, indexes )
    {
        debug() << idx;
        if( isGroup( idx ) )
        {
            debug() << "is a group, add mimeData of all children";
        }
        else
        {
            debug() << "is original item, add mimeData from source model";
            sourceIndexes << mapToSource( idx );
        }
    }
Пример #16
0
QVariant QgsAttributeTableFilterModel::headerData( int section, Qt::Orientation orientation, int role ) const
{
  if ( orientation ==  Qt::Horizontal )
  {
    if ( mColumnMapping.at( section ) == -1 && role == Qt::DisplayRole )
      return tr( "Actions" );
    else
      return QSortFilterProxyModel::headerData( section, orientation, role );
  }
  else
  {
    if ( role == Qt::DisplayRole )
      return section + 1;
    else
    {
      int sourceSection = mapToSource( index( section, ( !mColumnMapping.isEmpty() && mColumnMapping.at( 0 ) == -1 ) ? 1 : 0 ) ).row();
      return sourceModel()->headerData( sourceSection, orientation, role );
    }
  }
}
Qt::ItemFlags TemplateListFilterModel::flags(const QModelIndex& index) const
{
	QModelIndex sourceIndex = mapToSource(index);
	Qt::ItemFlags f = sourceModel()->flags(sourceIndex);
	if (mTypesEnabled == EventListModel::ALL)
		return f;
	int type;
	switch (static_cast<EventListModel*>(sourceModel())->event(sourceIndex)->action())
	{
		case KAEventData::MESSAGE:
		case KAEventData::FILE:     type = EventListModel::DISPLAY;  break;
		case KAEventData::COMMAND:  type = EventListModel::COMMAND;  break;
		case KAEventData::EMAIL:    type = EventListModel::EMAIL;  break;
		case KAEventData::AUDIO:    type = EventListModel::AUDIO;  break;
		default:                    type = EventListModel::ALL;  break;
	}
	if (!(type & mTypesEnabled))
		f = static_cast<Qt::ItemFlags>(f & ~(Qt::ItemIsEnabled | Qt::ItemIsSelectable));
	return f;
}
Пример #18
0
//---------------------------------------------------
void Delegate::paint(QPainter *painter, const QStyleOptionViewItem &option,const QModelIndex &index) const
{
    QStyleOptionViewItem opt(option);
     QModelIndex sourceIndex = mapToSource( index );


    if (index.column() == status)
    {

        opt.palette.setColor(
            QPalette::Base,
            QColor(255, 255, 204));

        opt.palette.setColor(
            QPalette::Window,
            QColor(255, 255, 204));
    }

    return QItemDelegate::paint(painter, opt, index);
}
Пример #19
0
QModelIndex HistoryMenuModel::index(int row, int column, const QModelIndex &parent) const
{
    if (row < 0
        || column < 0 || column >= columnCount(parent)
        || parent.column() > 0)
        return QModelIndex();
    if (!parent.isValid())
        return createIndex(row, column, -1);

    QModelIndex treeIndexParent = mapToSource(parent);

    int bumpedItems = 0;
    if (treeIndexParent == m_treeModel->index(0, 0))
        bumpedItems = bumpedRows();
    QModelIndex treeIndex = m_treeModel->index(row + bumpedItems, column, treeIndexParent);
    QModelIndex historyIndex = m_treeModel->mapToSource(treeIndex);
    int historyRow = historyIndex.row();
    if (historyRow == -1)
        historyRow = treeIndex.row();
    return createIndex(row, column, historyRow);
}
Пример #20
0
QVariant ProxyModel::data(const QModelIndex &index, int role) const
{
	if (role == Qt::DisplayRole && index.column() < m_mapping.count())
	{
		const QVariant data = mapToSource(index.sibling(index.row(), 0)).data(m_mapping.at(index.column()).second);

		if (data.type() == QVariant::DateTime)
		{
			return Utils::formatDateTime(data.toDateTime());
		}

		return data;
	}

	if (role == Qt::DecorationRole && index.column() > 0)
	{
		return QVariant();
	}

	return QIdentityProxyModel::data(index.sibling(index.row(), 0), role);
}
void TransactionFilterProxy::getLast30DaysInOut(qint64& in, qint64& out)
{
    QDate today = QDate::currentDate();
    QDate cutoff = today.addDays(-30);
    in = out = 0;

    for(int i=0; i < rowCount(); i++)
    {
        QModelIndex idx = mapToSource(index(i, 0));
        TransactionRecord *rec = static_cast<TransactionRecord*>(idx.internalPointer());
        if(QDateTime::fromTime_t(static_cast<uint>(rec->time)).date() > cutoff)
        {
            if(rec->type != TransactionRecord::InternalSend && rec->type != TransactionRecord::InternalReceive)
            {
                in += rec->credit;
                out += rec->debit;
            }
            // Don't include internal transfers for 'all accounts' summary
            else if(addrPrefix != "")
            {
                // If it is a transaction from an account to the same account (Yes this is possible - because of 'sub' accounts for change etc.) then exclude it.
                if(rec->fromAddress != rec->address)
                {
                    QString toAddress = QString::fromStdString(rec->address);
                    QString fromAddress = QString::fromStdString(rec->fromAddress);
                    QString toLabel = walletModel->getAddressTableModel()->labelForAddress(toAddress);
                    QString fromLabel = walletModel->getAddressTableModel()->labelForAddress(fromAddress);
                    if (toAddress.contains(addrPrefix, Qt::CaseInsensitive) ||  toLabel.contains(addrPrefix, Qt::CaseInsensitive))
                    {
                        in += rec->credit;
                    }
                    else if (fromAddress.contains(addrPrefix, Qt::CaseInsensitive) ||  toLabel.contains(addrPrefix, Qt::CaseInsensitive))
                    {
                        out += rec->debit;
                    }
                }
            }
        }
    }
}
void SideBarModel::trigger(int row)
{
    const QModelIndex &idx = index(row, 0);
    const QModelIndex &sourceIndex = mapToSource(idx);

    if (sourceIndex.row() != m_activeSourceRow) {
        const QModelIndex &oldActiveIndex = mapFromSource(m_sourceModel->index(m_activeSourceRow, 0));

        m_activeSourceRow = sourceIndex.row();

        InstalledAppsFilterModel* model = 0;

        for(int i = 0; i < m_sourceModel->rowCount(); ++i) {
            model = static_cast<InstalledAppsFilterModel *>(m_sourceModel->modelForRow(i));
            model->setHidden(i != m_activeSourceRow);
        }

        emit dataChanged(oldActiveIndex, oldActiveIndex);
        emit dataChanged(idx, idx);
        invalidateFilter();
    }
}
DISABLE_COMPILER_WARNINGS
#include <QApplication>
#include <QKeyEvent>
#include <QLineEdit>
#include <QPlainTextEdit>
#include <QSortFilterProxyModel>
#include <QTextEdit>
#include <QTimer>
RESTORE_COMPILER_WARNINGS

// Item rename handling
void CFileListItemDelegate::setEditorData(QWidget * editor, const QModelIndex & index) const
{
	QStyledItemDelegate::setEditorData(editor, index);
	auto lineEditor = dynamic_cast<QLineEdit*>(editor);
	assert_r(lineEditor);
	assert_and_return_r(index.isValid(), );

	auto sortModel = dynamic_cast<const QSortFilterProxyModel*>(index.model());
	assert_and_return_message_r(sortModel, "Something has changed in the model hierarchy", );
	auto model = dynamic_cast<const CFileListModel*>(sortModel->sourceModel());
	assert_and_return_message_r(model, "Something has changed in the model hierarchy", );
	auto hash = model->itemHash(sortModel->mapToSource(index));
	const auto item = CController::get().itemByHash(model->panelPosition(), hash);

	if (item.isValid() && item.isFile())
	{
		const QString itemName = lineEditor->text();
		const int dot = itemName.lastIndexOf('.');
		if (dot != -1)
		{
			
			QTimer::singleShot(0, Qt::CoarseTimer, lineEditor, [=]() {
				lineEditor->setSelection(0, dot);
			});
		}
	}
}
Пример #24
0
Qt::ItemFlags XUPProjectModelProxy::flags( const QModelIndex& index ) const
{
    if ( !mSourceModel || !index.isValid() )
    {
        return 0;
    }
    
    QModelIndex idx = mapToSource( index );
    XUPItem* item = mSourceModel->itemFromIndex( idx );
    
    bool enabled = false;
    
    if ( item->type() == XUPItem::Project || item->type() == XUPItem::Scope )
    {
        enabled = true;
    }
    else if ( item->type() == XUPItem::Function && item->attribute( "name" ).toLower() != "include" )
    {
        enabled = true;
    }
    
    return enabled ? Qt::ItemIsEnabled | Qt::ItemIsSelectable : Qt::ItemFlags();
}
Пример #25
0
void
PlayableProxyModel::updateDetailedInfo( const QModelIndex& index )
{
    PlayableItem* item = itemFromIndex( mapToSource( index ) );

    if ( item->album() )
    {
        item->album()->cover( QSize( 0, 0 ) );
    }
    else if ( item->artist() )
    {
        item->artist()->cover( QSize( 0, 0 ) );
    }
    else if ( item->query() )
    {
        item->query()->track()->cover( QSize( 0, 0 ) );

/*        if ( style() == PlayableProxyModel::Fancy )
        {
            item->query()->track()->loadSocialActions();
        }*/
    }
}
KDevelop::ProjectBaseItem* ProjectProxyModel::itemFromProxyIndex( const QModelIndex& idx ) const
{
    return static_cast<KDevelop::ProjectBaseItem*>( projectModel()->itemFromIndex( mapToSource( idx ) ) );
}
Пример #27
0
QVariant PrettyMailboxModel::data(const QModelIndex &index, int role) const
{
    if (!index.isValid())
        return QVariant();

    if (index.column() != 0)
        return QVariant();

    if (index.row() < 0 || index.row() >= rowCount(index.parent()) || index.model() != this)
        return QVariant();

    switch (role) {
    case Qt::DisplayRole:
    {
        QModelIndex translated = mapToSource(index);
        qlonglong unreadCount = translated.data(RoleUnreadMessageCount).toLongLong();
        qlonglong recentCount = translated.data(RoleRecentMessageCount).toLongLong();
        // The "problem" is that the \Recent and (lack of) \Seen flags are orthogonal states.
        //
        // There is no rule saying that a recent message is still unseen (trivial example: an already-read message being copied),
        // or that an unread message is recent.
        //
        // That's not really so much of a problem after the mailbox has been synced because we have all flags for each and every
        // message, and can therefore easily compute the difference. The problem, however, is that there is no such feature
        // in the SELECT command (and before you ask, SEARCH requires a selected mailbox, and "selected" is very close to
        // "synchronized" in Trojita). Trojita tries to satisfy all requests for "message numbers" at once, via the STATUS command
        // for unselected mailboxes, or through the already-known and cached information in the message flags for the recently
        // synchronized ones. In theory, it is possible to implement a workaround involving EXAMINE and (E)SEARCH, but even that
        // has its drawbacks (like the necessary serialization of requests and the requirement for a ton of new code).
        //
        // So in short, this is why there's no "(1 + 5)" result with six unread an one recent message.
        //
        // We also deliberately put an emphasis on the "unread count", even to an extent where there's no special information
        // for mailboxes with some recent, but no unread messages.
        if (recentCount && unreadCount) {
            return tr("%1 (%2/%3)")
                   .arg(QSortFilterProxyModel::data(index, RoleShortMailboxName).toString(),
                        QString::number(recentCount), QString::number(unreadCount));
        } else if (unreadCount) {
            return tr("%1 (%2)")
                   .arg(QSortFilterProxyModel::data(index, RoleShortMailboxName).toString(),
                        QString::number(unreadCount));
        } else {
            return QSortFilterProxyModel::data(index, RoleShortMailboxName);
        }
    }
    case Qt::FontRole:
    {
        QModelIndex translated = mapToSource(index);
        if (translated.data(RoleMailboxNumbersFetched).toBool() &&
                translated.data(RoleUnreadMessageCount).toULongLong() > 0) {
            QFont font;
            font.setBold(true);
            return font;
        } else {
            return QVariant();
        }
    }
    case Qt::DecorationRole:
    {
        QModelIndex translated = mapToSource(index);
        if (translated.data(RoleMailboxItemsAreLoading).toBool())
            return UiUtils::loadIcon(QLatin1String("folder-grey"));
#ifdef XTUPLE_CONNECT
        else if (QSettings().value(Common::SettingsNames::xtSyncMailboxList).toStringList().contains(
                     translated.data(RoleMailboxName).toString()))
            return UiUtils::loadIcon(QLatin1String("folder-xt-sync.png"));
#endif
        else if (translated.data(RoleMailboxIsINBOX).toBool())
            return UiUtils::loadIcon(QLatin1String("mail-folder-inbox"));
        else if (translated.data(RoleRecentMessageCount).toInt() > 0)
            return UiUtils::loadIcon(QLatin1String("folder-bookmark"));
        else if (translated.data(RoleMailboxIsSelectable).toBool())
            return UiUtils::loadIcon(QLatin1String("folder"));
        else
            return UiUtils::loadIcon(QLatin1String("folder-open"));
    }
    case Qt::ToolTipRole:
    {
        QModelIndex translated = mapToSource(index);
        return QString(QLatin1String("<p>%1</p>\n<p>%2<br/>%3<br/>%4</p>")).arg(
                   UiUtils::Formatting::htmlEscaped(translated.data(RoleShortMailboxName).toString()),
                   tr("%n messages", 0, translated.data(RoleTotalMessageCount).toInt()),
                   tr("%n unread", 0, translated.data(RoleUnreadMessageCount).toInt()),
                   tr("%n recent", 0, translated.data(RoleRecentMessageCount).toInt()));
    }
    default:
        return QSortFilterProxyModel::data(index, role);
    }
}
Пример #28
0
Tomahawk::result_ptr
TrackProxyModel::siblingItem( int itemsAway )
{
    qDebug() << Q_FUNC_INFO;

    QModelIndex idx = index( 0, 0 );
    if( rowCount() )
    {
        if ( m_shuffled )
        {
            // random mode is enabled
            // TODO come up with a clever random logic, that keeps track of previously played items
            idx = index( qrand() % rowCount(), 0 );
        }
        else if ( currentItem().isValid() )
        {
            idx = currentItem();

            // random mode is disabled
            if ( m_repeatMode == PlaylistInterface::RepeatOne )
            {
                // repeat one track
                idx = index( idx.row(), 0 );
            }
            else
            {
                // keep progressing through the playlist normally
                idx = index( idx.row() + itemsAway, 0 );
            }
        }
    }

    if ( !idx.isValid() && m_repeatMode == PlaylistInterface::RepeatAll )
    {
        // repeat all tracks
        if ( itemsAway > 0 )
        {
            // reset to first item
            idx = index( 0, 0 );
        }
        else
        {
            // reset to last item
            idx = index( rowCount() - 1, 0 );
        }
    }

    // Try to find the next available PlaylistItem (with results)
    if ( idx.isValid() ) do
    {
        TrackModelItem* item = itemFromIndex( mapToSource( idx ) );
        qDebug() << item->query()->toString();
        if ( item && item->query()->playable() )
        {
            qDebug() << "Next PlaylistItem found:" << item->query()->toString() << item->query()->results().at( 0 )->url();
            setCurrentItem( idx );
            return item->query()->results().at( 0 );
        }

        idx = index( idx.row() + ( itemsAway > 0 ? 1 : -1 ), 0 );
    }
    while ( idx.isValid() );

    setCurrentItem( QModelIndex() );
    return Tomahawk::result_ptr();
}
Пример #29
0
bool PrettyMailboxModel::hasChildren(const QModelIndex &parent) const
{
    return sourceModel()->hasChildren(mapToSource(parent));
}
Пример #30
0
int HistoryMenuModel::columnCount(const QModelIndex &parent) const
{
    return m_treeModel->columnCount(mapToSource(parent));
}