CustomView type object

In Qt applications, ListView, TableView, and TreeView are all derived from AbstractView. AbstractView are an abstract realization of views, allowing developers to derive various custom views from them. Take the "Chart" sample provided by Qt (as shown in the figure below) as an example. It has a table control on the left, but the chart on the right is a custom view component derived from an abstract view. Chart Application In Qt, such custom components derived from abstract views will be treated as custom view ItemView controls by CukeTest.

In fact, list view, table view and tree view are all derived from abstract views, but CukeTest supports these commonly used views, so they will not be treated as ItemView controls but their relative controls.

The relationship between the custom view and the list, table, and tree views

From the introduction at the beginning, we learned that the list, table, and tree views are also a custom view derived from the abstract view. And, from the type definition of the custom view, as follows:

JavaScript
Python
export interface IQItemView extends IQtControl {
    data(): Promise<string[] | string[][]>;
    select(index: number): Promise<void>;
    selectedIndex(): Promise<number>;

    rowCount(): Promise<number>;
    columnCount(): Promise<number>;

    scrollToTop(): Promise<void>;
    scrollTo(index: number): Promise<void>;
    scrollToBottom(): Promise<void>;
}

export interface IQItemViewItem extends IQtControl {
    value(): Promise<string>;
    select(): Promise<void>;
}
class QItemView(QtControl):
	def data() -> Union[List[str], List[List[str]]]
	def select(, index: int) -> "QItemViewItem"
	def selectedIndex() -> int
	def rowCount() -> int
	def columnCount() -> int
	def scrollToTop() -> None
	def scrollTo(, index: int) -> "QItemViewItem"
	def scrollToBottom() -> None
    
class QItemViewItem(QtControl):
	def value() -> str
	def select() -> None
	def editable() -> bool
	def selected() -> bool
As you can see, many methods provided by the list, table, and tree views are similar to custom views.

It can be said that the relationship between the custom view and the other three views is understood as: The three views inherit the methods of custom views, and extend the inherited methods according to their own characteristics, so that they have different operations and attribute methods.

Chinese version click here.

results matching ""

    No results matching ""