[][src]Struct qt_gui::QTextList

#[repr(C)]pub struct QTextList { /* fields omitted */ }

The QTextList class provides a decorated list of items in a QTextDocument.

C++ class: QTextList.

C++ documentation:

The QTextList class provides a decorated list of items in a QTextDocument.

A list contains a sequence of text blocks, each of which is marked with a bullet point or other symbol. Multiple levels of lists can be used, and the automatic numbering feature provides support for ordered numeric and alphabetical lists.

Lists are created by using a text cursor to insert an empty list at the current position or by moving existing text into a new list. The QTextCursor::insertList() function inserts an empty block into the document at the cursor position, and makes it the first item in a list.

QTextListFormat listFormat; if (list) { listFormat = list->format(); listFormat.setIndent(listFormat.indent() + 1); }

listFormat.setStyle(QTextListFormat::ListDisc); cursor.insertList(listFormat);

The QTextCursor::createList() function takes the contents of the cursor's current block and turns it into the first item of a new list.

The cursor's current list is found with QTextCursor::currentList().

The number of items in a list is given by count(). Each item can be obtained by its index in the list with the item() function. Similarly, the index of a given item can be found with itemNumber(). The text of each item can be found with the itemText() function.

Note that the items in the list may not be adjacent elements in the document. For example, the top-level items in a multi-level list will be separated by the items in lower levels of the list.

List items can be deleted by index with the removeItem() function. remove() deletes the specified item in the list.

The list's format is set with setFormat() and read with format(). The format describes the decoration of the list itself, and not the individual items.

Methods

impl QTextList[src]

pub unsafe fn add(&self, block: impl CastInto<Ref<QTextBlock>>)[src]

Makes the given block part of the list.

Calls C++ function: void QTextList::add(const QTextBlock& block).

C++ documentation:

Makes the given block part of the list.

See also remove() and removeItem().

pub unsafe fn count(&self) -> c_int[src]

Returns the number of items in the list.

Calls C++ function: int QTextList::count() const.

C++ documentation:

Returns the number of items in the list.

pub unsafe fn format(&self) -> CppBox<QTextListFormat>[src]

Returns the list's format.

Calls C++ function: QTextListFormat QTextList::format() const.

C++ documentation:

Returns the list's format.

See also setFormat().

pub unsafe fn is_empty(&self) -> bool[src]

Returns true if the list has no items; otherwise returns false.

Calls C++ function: bool QTextList::isEmpty() const.

C++ documentation:

Returns true if the list has no items; otherwise returns false.

Note: Empty lists are automatically deleted by the QTextDocument that owns them.

See also count().

pub unsafe fn item(&self, i: c_int) -> CppBox<QTextBlock>[src]

Returns the i-th text block in the list.

Calls C++ function: QTextBlock QTextList::item(int i) const.

C++ documentation:

Returns the i-th text block in the list.

See also count() and itemText().

pub unsafe fn item_number(&self, arg1: impl CastInto<Ref<QTextBlock>>) -> c_int[src]

Returns the index of the list item that corresponds to the given block. Returns -1 if the block was not present in the list.

Calls C++ function: int QTextList::itemNumber(const QTextBlock& arg1) const.

C++ documentation:

Returns the index of the list item that corresponds to the given block. Returns -1 if the block was not present in the list.

pub unsafe fn item_text(
    &self,
    arg1: impl CastInto<Ref<QTextBlock>>
) -> CppBox<QString>
[src]

Returns the text of the list item that corresponds to the given block.

Calls C++ function: QString QTextList::itemText(const QTextBlock& arg1) const.

C++ documentation:

Returns the text of the list item that corresponds to the given block.

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QTextList::metaObject() const.

pub unsafe fn new(doc: impl CastInto<Ptr<QTextDocument>>) -> QBox<QTextList>[src]

Calls C++ function: [constructor] void QTextList::QTextList(QTextDocument* doc).

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QTextList::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QTextList::qt_metacast(const char* arg1).

pub unsafe fn remove(&self, arg1: impl CastInto<Ref<QTextBlock>>)[src]

Removes the given block from the list.

Calls C++ function: void QTextList::remove(const QTextBlock& arg1).

C++ documentation:

Removes the given block from the list.

See also add() and removeItem().

pub unsafe fn remove_item(&self, i: c_int)[src]

Removes the item at item position i from the list. When the last item in the list is removed, the list is automatically deleted by the QTextDocument that owns it.

Calls C++ function: void QTextList::removeItem(int i).

C++ documentation:

Removes the item at item position i from the list. When the last item in the list is removed, the list is automatically deleted by the QTextDocument that owns it.

See also add() and remove().

pub unsafe fn set_format(&self, format: impl CastInto<Ref<QTextListFormat>>)[src]

Sets the list's format to format.

Calls C++ function: void QTextList::setFormat(const QTextListFormat& format).

C++ documentation:

Sets the list's format to format.

See also format().

pub unsafe fn static_meta_object() -> Ref<QMetaObject>[src]

Returns a reference to the staticMetaObject field.

pub unsafe fn tr(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QTextList::tr(const char* s, const char* c, int n).

pub unsafe fn tr_utf8(
    s: *const c_char,
    c: *const c_char,
    n: c_int
) -> CppBox<QString>
[src]

Calls C++ function: static QString QTextList::trUtf8(const char* s, const char* c, int n).

Methods from Deref<Target = QTextBlockGroup>

pub unsafe fn meta_object(&self) -> Ptr<QMetaObject>[src]

Calls C++ function: virtual const QMetaObject* QTextBlockGroup::metaObject() const.

pub unsafe fn qt_metacall(
    &self,
    arg1: Call,
    arg2: c_int,
    arg3: *mut *mut c_void
) -> c_int
[src]

Calls C++ function: virtual int QTextBlockGroup::qt_metacall(QMetaObject::Call arg1, int arg2, void** arg3).

pub unsafe fn qt_metacast(&self, arg1: *const c_char) -> *mut c_void[src]

Calls C++ function: virtual void* QTextBlockGroup::qt_metacast(const char* arg1).

Trait Implementations

impl CppDeletable for QTextList[src]

unsafe fn delete(&self)[src]

Calls C++ function: virtual [destructor] void QTextList::~QTextList().

impl Deref for QTextList[src]

type Target = QTextBlockGroup

The resulting type after dereferencing.

fn deref(&self) -> &QTextBlockGroup[src]

Calls C++ function: QTextBlockGroup* static_cast<QTextBlockGroup*>(QTextList* ptr).

impl DynamicCast<QTextList> for QTextBlockGroup[src]

unsafe fn dynamic_cast(ptr: Ptr<QTextBlockGroup>) -> Ptr<QTextList>[src]

Calls C++ function: QTextList* dynamic_cast<QTextList*>(QTextBlockGroup* ptr).

impl DynamicCast<QTextList> for QTextObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QTextObject>) -> Ptr<QTextList>[src]

Calls C++ function: QTextList* dynamic_cast<QTextList*>(QTextObject* ptr).

impl DynamicCast<QTextList> for QObject[src]

unsafe fn dynamic_cast(ptr: Ptr<QObject>) -> Ptr<QTextList>[src]

Calls C++ function: QTextList* dynamic_cast<QTextList*>(QObject* ptr).

impl StaticDowncast<QTextList> for QTextBlockGroup[src]

unsafe fn static_downcast(ptr: Ptr<QTextBlockGroup>) -> Ptr<QTextList>[src]

Calls C++ function: QTextList* static_cast<QTextList*>(QTextBlockGroup* ptr).

impl StaticDowncast<QTextList> for QTextObject[src]

unsafe fn static_downcast(ptr: Ptr<QTextObject>) -> Ptr<QTextList>[src]

Calls C++ function: QTextList* static_cast<QTextList*>(QTextObject* ptr).

impl StaticDowncast<QTextList> for QObject[src]

unsafe fn static_downcast(ptr: Ptr<QObject>) -> Ptr<QTextList>[src]

Calls C++ function: QTextList* static_cast<QTextList*>(QObject* ptr).

impl StaticUpcast<QObject> for QTextList[src]

unsafe fn static_upcast(ptr: Ptr<QTextList>) -> Ptr<QObject>[src]

Calls C++ function: QObject* static_cast<QObject*>(QTextList* ptr).

impl StaticUpcast<QTextBlockGroup> for QTextList[src]

unsafe fn static_upcast(ptr: Ptr<QTextList>) -> Ptr<QTextBlockGroup>[src]

Calls C++ function: QTextBlockGroup* static_cast<QTextBlockGroup*>(QTextList* ptr).

impl StaticUpcast<QTextObject> for QTextList[src]

unsafe fn static_upcast(ptr: Ptr<QTextList>) -> Ptr<QTextObject>[src]

Calls C++ function: QTextObject* static_cast<QTextObject*>(QTextList* ptr).

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, U> CastInto<U> for T where
    U: CastFrom<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> StaticUpcast<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.