Table View学习笔记—第一部分

Qt的table view学习 简单学习Qt的table view 文章参考:吓人的猿(Qt深入浅出(十五)QTableView) tabel view类似于excel,目前用到就来学习学习。 目前暂且不管什么复杂的实现东西,我就想知道怎么用。 table view感觉就是一个展示的控件,数据来源要借助于<QStandardItemModel> 下面附上详细内容 //.pro QT += core gui... 阅读详情

各位iOS开发大佬们好:
我是一名Swift+SwiftUI栈的iOS小白,目前还在上大三,最近准备实习,面试的过程中发现现在大公司很多还在用OC + UIKit的技术栈,OC我还在考虑要不要学,目前想先把UIKit学完,这是我在官网学习UIKit英文文档时摘录的本人认为的重点,如果你们也觉得对你们有用的话欢迎持续关注,我大概一天更一节,有事除外。格式什么的我也就不做了,翻译都是我自己翻译的,哪里不对欢迎在评论区指正,感谢各位大佬支持

今天2021年12月15日,明天有点事,可能更不了

这一章是Table View的第一部分

Overview

table view其实就是一个纵向的可滚动视图被分割成一行一行的,section可以将这些行分组
一个table view由以下几部分组成
Cells. A cell provides the visual representation for your content. You can use the default cells provided by UIKit or define custom cells to suit the needs of your app.
Table view controller. You typically use a UITableViewController object to manage a table view. You can use other view controllers too, but a table view controller is required for some table-related features to work.
Your data source object. This object adopts the UITableViewDataSource protocol and provides the data for the table.
Your delegate object. This object adopts the UITableViewDelegate protocol and manages user interactions with the table’s contents.

单元,就是每一行,里面的内容可以由多个默认单元组合成自定义单元
TVC,管理tableview的各种比如大小,位置,布局等等乱七八糟的
数据源,遵守UITableViewDataSource 协议并为table view提供data
代理对象,遵守UITableViewDelegate 协议管理用户与内容的交互

Saving and Restoring the Table’s Current State
Table views support UIKit app restoration. To save and restore the table’s data, assign a nonempty value to the table view’s restorationIdentifier property. When you save its parent view controller, the table view automatically saves the index paths for the currently selected and visible rows. If the table’s data source object adopts the UIDataSourceModelAssociation protocol, the table stores the unique IDs that you provide for those items instead of their index paths.

保存和重载table当前状态,给TV的restorationIdentifier 属性赋一个非空值,当保存它的父VC时,TV自动保存当前被选中的可视行的索引路径,如果table的数据源遵守UIDataSourceModelAssociation 协议,那么table将会保存你提供给item的唯一ID

Filling a Table with Data

TV是数据驱动的,你需要提供一个遵守UITableViewDataSource 协议的数据源对象,TV管理着view并且和数据源对象一起保证数据最新

Provide the Numbers of Rows and Sections

Before it appears onscreen, a table view asks you to specify the total number of rows and sections. Your data source object provides this information using two methods:
func numberOfSections(in tableView: UITableView) -> Int // Optional
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
In your implementations of these methods, return the row and section counts as quickly as possible. Doing so might require you to structure your data in a way that makes it easy to retrieve the row and section information. For example, consider using arrays to manage your table’s data. Arrays are good tools for organizing both sections and rows because they match the natural organization of the table view itself.
TV显示之前必须知道一共有多少行有多少section,用这两个方法告诉它
func numberOfSections(in tableView: UITableView) -> Int // Optional
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
这两个方法的实现当中,尽快的返回行数和section数,需要你以一个简单的方法结构化你的数据使它能够快速取到行数和section数的信息,比如将数据弄成数组,与TV很贴合,取大小也能直接用内置count

Before a table view appears onscreen, it asks its data source object to provide cells for the rows in or near the visible portion of the table. Your data source object’s tableView(:cellForRowAt:) method must respond quickly. Implement this method with the following pattern:
Call the table view’s dequeueReusableCell(withIdentifier:for:) method to retrieve a cell object.
Configure the cell’s views with your app’s custom data.
Return the cell to the table view.
For standard cell styles, UITableViewCell contains properties with the views you need to configure. For custom cells, you add views to your cell at design time and outlets to access them.
TV可视前需要数据源提供每行的单元,数据源对象的tableView(
:cellForRowAt:) 方法必须快速响应,以下模式实现这个方法:
调用TV的 dequeueReusableCell(withIdentifier:for:) 方法取一个单元对象
用数据配置单元
返回单元给TV
对于标准单元风格, UITableViewCell里面有你需要的属性,对于自定义单元,你需要在设计时就添加好view并为他们设计访问接口
代码示例

override func tableView(_ tableView: UITableView,
                        cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   // Ask for a cell of the appropriate type.
   let cell = tableView.dequeueReusableCell(withIdentifier: "basicStyleCell", for: indexPath)
        
   // Configure the cell’s contents with the row and section number.
   // The Basic cell style guarantees a label view is present in textLabel.
   cell.textLabel!.text = "Row \(indexPath.row)"
   return cell
}

Table views do not ask you to create cells for each of the table’s rows. Instead, table views manage cells lazily, asking you only for those cells that are in or near the visible portion of the table. Creating cells lazily reduces the amount of memory the table uses. However, it also means your data source object must create cells quickly. Do not use your tableView(:cellForRowAt:) method to load your table’s data or perform lengthy operations
TV不会要求你为table的每一行创建单元,TV懒管理(即有需要才管理)单元格,仅要求您提供表可见部分内或附近的单元格。懒加载减少了table的内存使用,当然这就需要数据源对象必须很快的创建单元,所以不要用tableView(
:cellForRowAt:) 方法加载table的数据或执行耗时操作
提前匹配数据以提高性能
滚动体验对于TV很重要,如果table匹配数据会引起很繁琐的操作,比如需要动数据库,那就用一个遵守UITableViewDataSourcePrefetching协议的prefetching 数据源对象就行,在滑动前异步加载数据

Estimating the Height of a Table’s Scrolling Area

Before a table view appears onscreen, it must compute the height of its content view, because it needs that information to configure scrolling-related parameters. If you don’t provide estimated heights for items, the table view must compute the actual height of items up front, which can be expensive.
TV显示之前必须计算内容的高度,因为TV需要这个值配置跟滑动有关的参数,如果你不提供高度预估,那么TV必须计算实际已显示的内容高度,这对性能影响很大

The table view provides default height estimates for table view items based on the standard header, footer, and row styles. If your table’s items are significantly shorter or taller than the default values, you can supply custom estimates by assigning values to your table’s estimatedRowHeight, estimatedSectionHeaderHeight, and estimatedSectionFooterHeight properties. If the height of individual items varies, provide custom estimates using the following methods of your delegate object:

tableView(_:estimatedHeightForRowAt:)
tableView(_:estimatedHeightForHeaderInSection:)
tableView(_:estimatedHeightForFooterInSection:) 

When estimating the heights of headers, footers, and rows, speed is more important than precision. The table view asks for estimates for every item in your table, so do not perform long-running operations in your delegate methods. Instead, generate estimates that are close enough to be useful for scrolling. The table view replaces your estimates with the actual item heights as those items appear onscreen.
TV根据标准header,footer还有row style提供了默认的高度预估,如果你的这些东西都明显比标准的高或者低,那么需要通过给table的estimatedRowHeight, estimatedSectionHeaderHeight, 和 estimatedSectionFooterHeight 属性赋值来自定义预估值,如果个别的差距很大的话用一下代理对象的方法提供预估值:
tableView(:estimatedHeightForRowAt:)
tableView(
:estimatedHeightForHeaderInSection:)
tableView(_:estimatedHeightForFooterInSection:)
预估时越快越好,因为最后当那些东西出现在屏幕上时TV会用实际值替代预估值
When the table view uses height estimates, it actively manages the contentOffset and contentSize properties inherited from its scroll view. Do not attempt to read or modify these properties directly. Their values are meaningful only to UITableView.
当TV用高度预估的时候,它会管理从scroll view那继承来的contentOffset 和 contentSize 属性,不要尝试读取或更改这俩属性值,

为每个单元赋一个重用标识符

Reuse identifiers facilitate the creation and recycling of your table’s cells. A reuse identifier is a string that you assign to each prototype cell of your table.Each cell in a table view must have a unique reuse identifier
When you need a cell object at runtime, call the table view’s dequeueReusableCell(withIdentifier:for:) method, passing the reuse identifier for the cell you want. The table view maintains an internal queue of already-created cells. If the queue contains a cell of the requested type, the table view returns that cell. If not, it creates a new cell using the prototype cell in your storyboard. Reusing cells improves performance by minimizing memory allocations during critical times, such as during scrolling.
重用标识符简化了单元创建和回收的过程,它是一个赋值给table里每个prototype单元的字符串,table中的每个单元都必须有唯一的重用标识符。当你在运行时需要一个单元对象,调用TV的dequeueReusableCell(withIdentifier:for:) 方法并传入你需要的单元的重用标识符。TV持有一个已创建单元的队列,如果这个队列里有传进来的那个单元,那么此方法将返回这个单元,如果没有,他会用原始类型的单元创建一个新的单元。单元的重用通过减少在关键时刻比如滚动时对内存的申请和使用提高性能

Configure a Cell with a Built-In Style

The simplest way to configure a cell is to use one of the built-in styles provided by UITableViewCell. You use these styles as is; you do not need to provide a custom subclass to manage the cell. Each style incorporates one or two labels, with the style determining the positions of the labels within the cell’s content area. Most of the styles also incorporate an image at the leading edge of the cell’s content.
In your tableView(:cellForRowAt:) method, configure the content of your cell using the textLabel, detailTextLabel, and imageView properties of UITableViewCell. Those properties contain views, but the cell object only assigns a view if the style supports the corresponding content. For example, the Basic cell style does not support a detail string, so the detailTextLabel property is nil for that style.
使用UITableViewCell提供的内置style配置单元,不需要提供子类去管理单元。在tableView(
:cellForRowAt:) 方法中使用UITableViewCell的 textLabel, detailTextLabel, and imageView 属性配置单元的内容。这些属性包含视图,但单元对象单元对象仅会在样式支持相应内容时分配视图。
示例代码如下

override func tableView(_ tableView: UITableView, 
             cellForRowAt indexPath: IndexPath) -> UITableViewCell {
   // Reuse or create a cell. 
   let cell = tableView.dequeueReusableCell(withIdentifier: "basicStyle", for: indexPath)


   // For a standard cell, use the UITableViewCell properties.
   cell.textLabel!.text = "Title text"
   cell.imageView!.image = UIImage(named: "bunny")
   return cell
}

Configure a Cell with Custom Views

For appearances other than the standard styles, use the custom cell style. With a custom cell, you specify the views you want in the cell, their configurations, and their sizes and positions. Static views such as labels and images make the best content for cells. Avoid views that require user interactions such as controls. Do not include scroll views, table views, collection views, or other complex container views in cells. You may include stack views in your cells, but minimize the number of items in your stack view to improve performance.
For custom cells, you need to define a UITableViewCell subclass to access your cell’s views. Add outlets to your subclass and connect those outlets to the corresponding views in your prototype cell.
自定义单元最好用静态视图,不要用容器VC,可以用横纵排列的视图,但要控制横纵排列的量,写一个 UITableViewCell 子类访问单元的视图,记得写好接口

class FoodCell: UITableViewCell {
    @IBOutlet var name : UILabel?
    @IBOutlet var plantDescription : UILabel?
    @IBOutlet var picture : UIImageView?
}

In the tableView(:cellForRowAt:) method of your data source, use your cell’s outlets to assign values to any views.
在数据源的tableView(
:cellForRowAt:) 方法中,用单元的接口给其他视图赋值

override func tableView(_ tableView: UITableView, 
             cellForRowAt indexPath: IndexPath) -> UITableViewCell {


   // Reuse or create a cell of the appropriate type.
   let cell = tableView.dequeueReusableCell(withIdentifier: "foodCellType", 
                         for: indexPath) as! FoodCell


   // Fetch the data for the row.
   let theFood = foods[indexPath.row]
        
   // Configure the cell’s contents with data from the fetched object.
   cell.name?.text = theFood.name
   cell.plantDescription?.text = theFood.description
   cell.picture?.image = theFood.picture
        
   return cell
}

Change the Height of Rows

A table view tracks the height of rows separately from the cells that represent them. UITableView provides default sizes for rows, but you can override the default height by assigning a custom value to the table view’s rowHeight property. Always use this property when the height of all of your rows is the same. Doing so is more efficient than returning the height values from your delegate object.
If the row heights are not all the same, or can change dynamically, provide the heights using the tableView(:heightForRowAt:) method of your delegate object. When you implement this method, you must provide values for every row in your table. The following example code shows how to return a custom height for the first row of each section and use the default height for all other rows.
改变行高
UIKIt默认提供行的大小,也可通过给TV的rowHeight 属性赋值自定义行高,当table的行高都一样的时候必须用这个方法,比从代理对象那取值方便,如果行高不同或可以动态变化,那么就用代理对象的tableView(
:heightForRowAt:) 方法提供行高,当你实现这个方法的时候,你必须提供每一行的高度,底下示例代码

override func tableView(_ tableView: UITableView, 
           heightForRowAt indexPath: IndexPath) -> CGFloat {
   // Make the first row larger to accommodate a custom cell.
  if indexPath.row == 0 {
      return 80
   }


   // Use the default size for all other rows.
   return UITableView.automaticDimension
}

The table view asks for the heights of visible rows only. As the user scrolls, the table view asks you to provide the height for each row as it appears, including when it moves offscreen and then back onscreen.
TV只会要可见的行的行高,滑动时当滑出会滑入屏幕时会需要行高

Restore Your Cell’s Original Appearance Before Reuse

When a cell moves offscreen, the table view removes it from its view hierarchy and places it in an internally managed recycling queue. When you request a new cell using the table view’s dequeueReusableCell(withIdentifier:for:) method, the table view returns cells from the recycling queue first. If the queue is empty, the table view instantiates a new cell from your storyboard.
If you change the appearance of your custom cell’s views, implement the prepareForReuse() method of your cell subclass. In your implementation, return the appearance of your cell’s views to their original state. For example, if you change the alpha property of a view in your cell, return that property to its original value. You do not need to clear label text, set images to nil, or do anything that would be corrected by your tableView(_:cellForRowAt:) method when configuring the cell for display.
在重用之前重载单元的原始样式
当单元滑出屏幕时,TV会将它从视图层级中移除,并放在回收队列中。当你调用TV的dequeueReusableCell(withIdentifier:for:) 方法准备取一个新单元时,TV先从回收队列中取一个单元,如果队列为空,UIKit才会新实例化一个单元。
如果你尝试改变单元View的外观,实现一下单元子类的prepareForReuse() 方法,在此方法的实现中,将单元View的外观还原成最开始的样子

Add an Accessory View to Your Cell

An accessory view is an optional, system-defined view that appears at the trailing edge of a cell. You use accessory views to communicate standard cell behaviors to users. For example, you add a detail button to let the user know that tapping the row displays more information about the row.
To configure an accessory view:
In your storyboard, use the cell’s Accessory attribute to select the accessory view you want.
In your code, change the value of the cell’s accessoryType property.
Users expect accessory views to have specific behaviors when tapped. For information about how to implement those behaviors, see UITableViewCell.AccessoryType.

给单元添加辅助view
辅助view是可选的,系统定义的出现在单元的边缘的view,比如说一个detail按钮,点了之后显示出详细信息那种,改一下
单元的accessoryType 属性值就可以配置辅助view

To create a basic header or footer with a text label, override the tableView(:titleForHeaderInSection:) or tableView(:titleForFooterInSection:) method of your table’s data source object. The table view creates a standard header or footer for you and inserts it into the table at the specified location.
通过重写table的数据源对象的 tableView(:titleForHeaderInSection:) or tableView(:titleForFooterInSection:)方法来创建基础的带有lable的header和footer

// Create a standard header that includes the returned text.
override func tableView(_ tableView: UITableView, titleForHeaderInSection 
                            section: Int) -> String? {
   return "Header \(section)"
}


// Create a standard footer that includes the returned text.
override func tableView(_ tableView: UITableView, titleForFooterInSection 
                            section: Int) -> String? {
   return "Footer \(section)"
}

Note
Headers and footers normally apply to a single section, but you can also provide a single header or footer view for the entire table by using the tableHeaderView or tableFooterView properties of your table view. The global header appears at the top of your table’s content, and the global footer appears at the bottom.
header和footer一般用于单个section,如果想为整个TV添加的话用TV的 tableHeaderView or tableFooterView 属性。全局的 header和footer会显示在整个TV的上方和下方

Customize the Header and Footer Views

With custom headers and footers, you specify the views you want and position them anywhere within the allotted space. You can also provide different header or footer views for different sections of your table.
To create custom header or footer views:
Use UITableViewHeaderFooterView objects to define the appearance of your headers and footers.
Register your UITableViewHeaderFooterView objects with your table view.
Implement the tableView(:viewForHeaderInSection:) and tableView(:viewForFooterInSection:) methods in your table view delegate object to create and configure your views.
自定义header和footer有以下步骤
用UITableViewHeaderFooterView 对象定义header和footer的外观
给TV整一个UITableViewHeaderFooterView 对象
实现TV代理对象的tableView(:viewForHeaderInSection:) 和 tableView(:viewForFooterInSection:) 方法去创建和配置view
Always use a UITableViewHeaderFooterView object for your headers and footers. That view supports the same reuse model that cells employ, allowing you to recycle views instead of creating them every time. After you register your header or footer view, use the table view’s dequeueReusableHeaderFooterView(withIdentifier:) method to request instances of that view. If recycled header or footer views are available, the table view returns those first, before creating new ones.
You can use a UITableViewHeaderFooterView object as is and add views to its contentView property, or you can subclass and add your views. Position your subviews inside the content view by using a stack view or Auto Layout constraints. To change the background behind your content, modify the backgroundView property of the header-footer view. The following example code shows a custom header view that positions the image and label views at creation time

最好用 UITableViewHeaderFooterView对象处理header和footer,跟单元一样支持复用,当注册好header和footer后用VC的dequeueReusableHeaderFooterView(withIdentifier:) 方法做一份view的实例

Handling Row Selection in a Table View

配置行选择
行选择行为相关属性
allowsSelection
Determines whether users can select a row when the table isn’t in editing mode. The default is true.
allowsMultipleSelection
Determines whether users can select more than one row when the table isn’t in editing mode. The default is false.
allowsSelectionDuringEditing
Determines whether user can select a row while the table view is in editing mode. The default is false.
allowsMultipleSelectionDuringEditing
Determines whether users can select a more than one row while in editing mode. The default is false.

字面意思都能看懂我就不翻译了

When the user taps a row, the table view calls the delegate method tableView(:didSelectRowAt:). At this point, your app performs the action, such as displaying the details of the selected hiking trail:
响应行选择,当用户点击一行时,TV调用它代理方法tableView(
:didSelectRowAt:). 在此方法中执行一些操作

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    let selectedTrail = trails[indexPath.row]
    
    if let viewController = storyboard?.instantiateViewController(identifier: "TrailViewController") as? TrailViewController {
        viewController.trail = selectedTrail
        navigationController?.pushViewController(viewController, animated: true)
    }
}

If you respond to the cell selection by pushing a new view controller onto the navigation stack, deselect the cell when the view controller pops off the stack. If you’re using a UITableViewController to display a table view, you get the behavior by setting the clearsSelectionOnViewWillAppear property to true. Otherwise, you can clear the selection in your view controller’s viewWillAppear(😃 method:
如果你想在行选择时让新VC进入navigation栈中,当VC从navigation栈弹出时取消选择,如果你使用UITableViewController 显示TV的话,应该将clearsSelectionOnViewWillAppear设置为true,你也可以在VC的viewWillAppear(
:)方法中取消选择。

override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)
    if let selectedIndexPath = tableView.indexPathForSelectedRow {
        tableView.deselectRow(at: selectedIndexPath, animated: animated)
    }
}

If the row displays the detail button accessory view and the user taps it, the table view calls the tableView(:accessoryButtonTappedForRowWith:) method instead of calling the tableView(:didSelectRowAt:) method.
如果行中有辅助view的话,点击时会调用tableView(:accessoryButtonTappedForRowWith:) 方法而非tableView(:didSelectRowAt:) 方法

The selection of a row may originate within the app itself rather than from a tap in the table view. For example, a user might add a new person to an address book, then return to the list of contacts. After returning to the contact list, the app scrolls the list to show the row of the newly added person. In this situation, use the table view method selectRow(at:animated:scrollPosition:) to select and scroll to the new row.
Note
Selecting a row programmatically doesn’t call the delegate methods tableView(:willSelectRowAt:) or tableView(:didSelectRowAt:), nor does it send selectionDidChangeNotification notifications to observers.
行选择可能更多的是由于app内部发生变化而非用户点击,比如用户添加了个新联系人,那么表里就会多出来一个,这种情况下用TV的selectRow(at:animated:scrollPosition:) 方法选择或滚动新行。
编程式的行选择不会调用代理方法tableView(:willSelectRowAt:) 或 tableView(:didSelectRowAt:),也不会给观察者发送selectionDidChangeNotification通知

Manage Selection Lists
You can also use cell selection to maintain inclusive and exclusive lists of selected items.
您还可以使用单元选择来维护所选项目的单选或多选列表表。
When providing a selection list in your app, don’t use the cell’s selected state to indicate the state of the item. Instead, display a checkmark or an accessory view. To indicate the state using a checkmark, implement the tableView(_:didSelectRowAt:) delegate method, then deselect the cell with deselectRow(at:animated:), followed by setting the cell’s accessoryType property to UITableViewCell.AccessoryType.checkmark.

在应用程序中提供选择列表时,不要使用单元格已被选定(就是变灰的那个)状态来指示项目的状态最好用辅助View,比如对勾或者其他什么的,实现 tableView(_:didSelectRowAt:) 委托方法,然后使用 deselectRow(at:animated:) 取消选择单元格,然后将单元格的 accessoryType 属性设置为 UITableViewCell.AccessoryType.checkmark。

示例代码:

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    // Unselect the row, and instead, show the state with a checkmark.
    tableView.deselectRow(at: indexPath, animated: false)
    
    guard let cell = tableView.cellForRow(at: indexPath) else { return }
    
    // Update the selected item to indicate whether the user packed it or not.
    let item = packingList[indexPath.row]
    let newItem = PackingItem(name: item.name, isPacked: !item.isPacked)
    packingList.remove(at: indexPath.row)
    packingList.insert(newItem, at: indexPath.row)
    
    // Show a check mark next to packed items.
    if newItem.isPacked {
        cell.accessoryType = .checkmark
    } else {
        cell.accessoryType = .none
    }
}

Managing an exclusive list is similar. Deselect the row and display a checkmark or an accessory view to indicate the selected state. But unlike an inclusive list, limit the exclusive list to only one selected item at a time.

单选同理

示例代码

func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
    // Unselect the row.
    tableView.deselectRow(at: indexPath, animated: false)
    
    // Did the user tap on a selected filter item? If so, do nothing.
    let selectedFilterRow = selectedFilters[indexPath.section]
    if selectedFilterRow == indexPath.row {
        return
    }


    // Remove the checkmark from the previously selected filter item.
    if let previousCell = tableView.cellForRow(at: IndexPath(row: selectedFilterRow, section: indexPath.section)) {
        previousCell.accessoryType = .none
    }
    
    // Mark the newly selected filter item with a checkmark.
    if let cell = tableView.cellForRow(at: indexPath) {
        cell.accessoryType = .checkmark
    }
    
    // Remember this selected filter item.
    selectedFilters[indexPath.section] = indexPath.row
}

【PyQt学习篇 · ⑭】:QTableView的使用 QTableView 是 PyQt 中用于显示表格数据的窗口部件,它提供了一个灵活的方式来显示和编辑数据。QTableView 依赖于数据模型来提供数据。可以根据数据的不同复杂性来选择合适的数据模型。 阅读详情

相关推荐

【Qt笔记】QTableView控件详解

QTableView是Qt框架中非常重要的一个控件,专门用于展示和编辑二维表格数据。

qq_52924376的博客 9549

PyQt5中的Table view详解

二维表格数据展示:Table View 用于以行和列的形式展示数据,每个单元格可以包含文本、图像、复选框等内容。数据交互:用户可以与表格数据进行交互,例如选择单元格、编辑内容、排序和过滤数据等。在 PyQt5 中,是一个抽象基类,用于创建自定义的数据模型。它提供了处理复杂数据源(如数据库、文件、API 等)的灵活性。通过继承,可以实现自己的数据模型,并覆盖其必要的方法以提供数据和处理用户交互。要创建自定义的数据模型,需要继承方法描述返回表格的行数。返回表格的列数。返回指定索引和角色的数据。

xy_optics的博客 4305

view design之table自定义单元格模版

在 columns 的某列声明 slot 后,就可以在 Table 的 slot 中使用参数。slot 的参数有 3 个:当前行数据 row,当前列数据 column,当前行序号 index。

weixin_42949219的博客 1399

table和view区别

table和view区别

qianbihua00的博客 2552

view Table 自定义排序

vue ivew table组件,前端排序,合并行(适用于不分页的表)

zhualao的博客 721

ABAP CDS · DDL 语句全景解析与可运行示例:从 DEFINE VIEW 到 EXTEND VIEW,再到 TABLE FUNCTION

摘要:本文系统化介绍ABAP CDS的DDL语法,面向SAP ABAP工程师。主要内容包括:1)CDS DDL的核心语法(DEFINE VIEW/EXTEND VIEW/DEFINE TABLE FUNCTION)及应用场景;2)通过航空公司案例演示带参数视图、视图扩展和表函数的实现;3)提供可直接在ADT中使用的完整代码示例,展示如何构建可复用、可优化的语义数据层。文章强调CDS在声明式建模、无侵入扩展和复杂计算下沉方面的优势,帮助开发者在真实项目中落地CDS技术。

2007 年 ~ 2025 年,深耕 SAP 技术 18 年 285

jemeter学习之view result tree和view result table

还是用之前的测试数据(断言的添加之类的可看前面的)来解剖下view results tree和view results in table 具体内容: 一、view result tree: 新建listeners-view results tree,点击运行,查看结果;  目前是text模式,可下拉选择你需要的模式进行查看结果; Sampler result: Sampler测试的总体测...

小白shine33的博客 2083

H3C交换机Console口连接全攻略:从接线到PuTTY配置(附常见问题排查)

本文详细介绍了H3C交换机Console口的连接与配置方法,包括硬件线缆选择、驱动安装、PuTTY参数设置及常见问题排查。特别针对Console转USB线缆的兼容性和驱动安装难点提供实用建议,帮助网络工程师快速掌握串联调试技巧,解决连接中的黑屏、乱码等典型问题。

weixin_42549451的博客 679

table和view区别(转)

sql server中table和view区别 table 是实际表 view是虚表。你可以认为view是一个查询的结果。 我们经常用sql语句如; select 姓名,性别 from 学生表 对 学生这个table进行查询,这是个简单查询,但是当我们要将 table1,table2,table3 ,table4 ..........好多个表进行多表查询的时候,我们不想每次都写一连窜的连接语句...

qq_32800367的博客 1万+

Xilinx System Generator多速率系统(Multi-Rate Systems)的使用

在本实验练习中,您将学习在System Generator中如何使用多个时钟域有效地实现具有多个数据速率的设计。

白码王子小张的博客 1093

ESP32实战:破解校园网WPA2-Enterprise认证的完整指南

本文详细介绍了如何使用ESP32开发板破解校园网WPA2-Enterprise认证的完整指南。通过硬件准备、环境搭建、核心代码实现及常见问题排查,帮助开发者解决企业级WiFi连接难题,特别适用于校园网环境下的物联网设备开发。

weixin_29194817的博客 457

Vue中表格隐藏列的实现,基于i-view Table组件

VUE中Table隐藏列vue表格隐藏列使用i-view的Table组件隐藏列实现第一步:设置需要隐藏的列的宽度为0第二步:设置内容超出长度时隐藏第三步:删除标题 vue表格隐藏列 应用场景: 表格中的序号列为数据的联合主键,显示在表格中影响界面美观,但是在数据的修改和删除时又必须要使用到,所以希望这几列隐藏不展示. 使用i-view的Table组件 项目中使用vue框架,表格组件为i-view...

weixin_39172079的博客 4681

Java电商秒杀系统性能优化(一)——电商秒杀系统框架回顾

电商秒杀系统框架回顾项目简介外部依赖框架回顾项目要点项目中存在的问题小结 课程是免费的,课程地址如下:SpringBoot搭建电商秒杀项目,课程真的很棒,作者的思路很清晰,建议各位读者可以跟着视频练习一下这个项目; 项目简介 通过SpringBoot快速搭建的前后端分离的电商基础秒杀项目。项目通过应用领域驱动型的分层模型设计方式去完成:用户otp注册、登陆、查看、商品列表、进入商品详情以及倒计时秒...

ghw15221836342的博客 3725

DB中table view区别

table是实实在在保存数据的实体,写入的数据都保存在表中;view没有数据,view从table中获取数据,是一个查询语句。 table可以建立各种触发器,索引,主键,约束;view不能建立那些对象 table/view都可以更新,但是view更新受到限制

zl_1987的专栏 1390

软考29-上午题-【数据结构】-排序

数据结构7种排序

qq_31532983的博客 1580

GMSL2摄像头接入避坑指南:从FMC子卡配置到V4L2调用的完整流程(附Ubuntu20.04实测)

本文详细解析了GMSL2摄像头接入的全流程,从FMC子卡配置到V4L2调用的完整指南。基于XC7Z100平台实测经验,提供了硬件选型、带宽优化、Linux驱动配置及高分辨率采集的实战技巧,帮助开发者规避常见问题,提升系统稳定性与性能。

weixin_33737774的博客 420

table,view,mview(multiliazed view)的比较

总的来说, Table是View和MView的基础, 如果DB物理空间不是很充足,而且数据量不是很大的话,建议使用View, 如果DB物理空间充足,数据量大的话,而且对实时性没有太高要求的话,可以考虑使用MView   一般来说,如果系统庞大,数据量巨大,可以通过构筑MView的方式提升性能. 但是也要考虑到MView的refresh频率和时间,如果定义不好,反而会成为性能的负担.

小猪的成长专栏 773

桌面运维工程师面试题详解(一)

桌面运维工程师面试题详解(一)

jks212454的博客 1428

iOS开发基础之用三种不同方式创建Table View应用

在iOS中,有一种最常见的控件就是Table View,你也可以理解为shi

乞力马扎罗的雪CYF的博客 2077

audio语音相关的基础知识-VAD,ASR,AEC,AGC,BF等

有音素之间的间隙,也有静音和语音本身的间隙,为了对数据从时间上进行相对的校准,语音端点检测技术就应运而生了,因此端点检测技术可以决定这种校准的相对精度,使得同一内容的特征更趋于相同,当然,一般情况下是不可能完全相同的。盲源分离的目的是求得源信号的最佳估计,盲辨识的目的是求得传输通道的。这个技术的主要任务是从带有噪声的语音中准确的定位出语音的开始和结束点,因为语音中含有很长的静音,也就是把静音和实际语音分离开来,因为是语音数据的原始处理,所以VAD是语音信号处理过程的关键技术之一。呈现出与会者清晰的声音。

u013250861的博客 1037

贝叶斯统计 [韦来生编]

贝叶斯(Bayes)统计是近几十年来迅速发展起来的数理统计的一个重要分支。贝叶斯方法与经典统计方法的主要不同之处是进行统计推断时除了利用样本信息外,还要利用参数的先验信息,因此可以提高统计推断或统计决策的效果。它在经济、金融、生物、医学、自然科学和社会科学等许多领域具有广泛的应用。贝叶斯方法的研究已渗透到了统计学的几乎所有领域。作者在给中国科学技术大学概率论与数理统计专业本科生开设的“数理统计”课程中有一章专门讲授“贝叶斯方法和统计决策理论”,近十年来也给中国科学技术大学概率统计专业研究生开设过几次“贝叶斯分析”课。本书是在对过去讲稿的内容作了适当的增减和调整的基础上完成的。  本书共分六章。第1章是绪论,介绍了贝叶斯统计的若干基本概念,同时对必要的数理统计的基础知识有重点地作了回顾。第二章介绍了确定先验分布的若干可供选择的方法。第三章介绍了几类常见统计模型参数的后验分布的主要结果和计算方法。第四章和第五章分别介绍了“贝叶斯统计推断”和“贝叶斯统计决策”的内容。第六章介绍了贝叶斯统计计算的若干方法,包括蒙特卡洛方法和马尔可夫链蒙特卡洛(MCMC)方法以及相关统计软件的简介。本书的每一章附右大量的例题和习题,书末附有常用的几个表格和部分习题解答供读者查用。  大约可在54学时内讲授本书的第1章至第六章的主要内容,教师可根据学时需要选讲本书第1章至第六章的部分内容。书中标“*”号的章节可略去不讲,留给读者作为阅读材料。第六章例题中的R代码和部分例题的数据文件等可从作者个人主页下载。  作者在编写本书的过程中参考了J.O.Berger教授的《统计决策论及贝叶斯分析》和茆诗松教授编写的《贝叶斯统计》等书中的一些内容,以及《贝叶斯分析》一书中由张伟平博士编写的有关贝叶斯统计计算的一些内容。在此表示衷心感谢。  本书编写准备过程中,中国科学技术大学统计与金融系的几个研究生帮助完成了本书部分中文的录入和排版,作者对他们的辛勤工作表示真诚的感谢。高等教育出版社为本书的出版给予了大力支持。在此一并致谢。

xs-table-view 开发文档

xs-table-view 开发文档

xiao_shuai_shua的博客 507

jdk-8u144-linux-x64.tar.gz.

该资源为搭建Linux系统Java环境用,资源的后缀为tar.gz格式的压缩包

WDA学习笔记(三) TABLE

目标:通过实现简单的TABLE控件来加深一下对VIEW CONTEXT操作原理与方法。以下是一个简单的TABLE控件,通过ADD按钮 将INPUTFIELD内容APPEND到TABLE控件中,实现数据添加。 添加LAYOUT ELEMENTS 在页面中加入两个LAYOUT CONTAINER,LC1、LC2 LC1中加入INPUTFIELD和BUTTON LC2中加入TABLE 并和VIEW CONTEXT进行BINDING 在BUTTON的ACION中加入事件ONACTION.

BIRDMAN 789

TMS_WebGMaps_1.9.8.0_Full_Source

TMS_WebGMaps_1.9.8.0_Full_Source 全源码 delphi cbuilder

win10 跳过U8环境检测的IE WebControls.rar

win10 安装u8的时候 提示IE WebControls 不通过,这个工具可以欺骗u8的检查。 跳过U8环境检测的IE WebControls。提示导入失败后,重新检测通过。

轮廓系数详解:聚类质量评估的数学原理与工程实践

聚类效果评估是机器学习落地的关键环节,而轮廓系数作为不依赖降维、不依赖人眼判断的量化指标,从欧氏距离出发,通过内聚度与分离度两个可计算维度,客观衡量每个样本的归属合理性。其核心价值在于揭示数据在原始特征空间中的真实几何结构,避免t-SNE可视化带来的认知偏差,并支持细粒度诊断——如定位负分样本、识别错配点、驱动K值选择与算法选型。在用户分群、故障检测、文本聚类等实际场景中,轮廓系数不仅是模型调优工具,更是连接数学指标与业务决策的桥梁,尤其适用于高维、非标、需可解释性的工业级聚类任务。

weixin_34348805的博客 276

数据库系统概念中table/view/schema/index的关系

操作对象 创建 删除 修改 模式 CREATE SCHEMA DROP SCHEMA 表 CREATE TABLE DROP TABLE ALTER TABLE 视 图 CREATE VIEW DROP VIEW 索 引 CREATE INDEX DROP INDEX 表大家不一定要了解这个东西的准确定义是什么,

Mr.Phoebe的专栏 1万+

qt model和view的table 小记

QT中的model和view都是采用index索引   index含有两个成员变量一个是row   一个是column  对应该索引的行号列号model提供数据    view提供视图   view用来显示model的数据   必须将model绑定到某个view中才能显示 ui->tableView->setModel(model);ui->tableView->currentIndex();//获取选中单元格的index ui->tableView->currentIndex().column();//

leftover_crazy的专栏 4812

kubectl-view-allocations输出格式详解:Table与CSV灵活切换

kubectl-view-allocations是一款强大的Kubernetes资源分配查看工具,它能够清晰展示CPU、内存、GPU等资源的请求量、限制、可分配量和空闲量,帮助用户全面了解集群资源使用情况。本文将详细介绍如何灵活切换Table与CSV两种输出格式,满足不同场景下的资源分析需求。 ## 为什么需要多种输出格式? 在Kubernetes日常管理中,不同场景对资源数据的呈现方式有不同

gitblog_00909的博客 1108
上一篇: View Controller学习笔记—第四章Adaptivity and Size Change
下一篇: UIKIt学习笔记—App and Environment部分(一)
诚是张嘉诚
博客等级 码龄7年 15粉丝 24原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值