예제 #1
0
/*!
  Constructs a QThemeListItem.
  The \a parent is passed to the base class constructor.
*/
QThemeListItem::QThemeListItem(QThemeItem *parent)
        : QThemeWidgetItem(parent), d(new QThemeListItemPrivate)
{
    QThemeItem::registerType(Type);
    QListView *lv = new QListView;
    lv->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
    setWidget(lv);
}
예제 #2
0
/*!
    Returns the popup used to display completions.

    \sa setPopup()
*/
QAbstractItemView *QCompleter::popup() const
{
    Q_D(const QCompleter);
#ifndef QT_NO_LISTVIEW
    if (!d->popup && completionMode() != QCompleter::InlineCompletion) {
        QListView *listView = new QListView;
        listView->setEditTriggers(QAbstractItemView::NoEditTriggers);
        listView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);
        listView->setSelectionBehavior(QAbstractItemView::SelectRows);
        listView->setSelectionMode(QAbstractItemView::SingleSelection);
        listView->setModelColumn(d->column);
        QCompleter *that = const_cast<QCompleter*>(this);
        that->setPopup(listView);
    }
#endif // QT_NO_LISTVIEW
    return d->popup;
}