Qtablewidget的竖直滑块
时间: 2023-08-25 08:07:27 浏览: 47
QTableWidget的竖直滑块可以通过以下方法来获取和设置滑块的位置:
1. 获取滑块位置:使用`sliderPosition()`方法可以获取当前竖直滑块的位置。例如,如果你有一个QTableWidget对象叫做`tableWidget`,你可以使用以下代码获取滑块的位置:
```
int sliderPosition = tableWidget->verticalScrollBar()->sliderPosition();
```
引用了中的代码。
2. 设置滑块位置:使用`setSliderPosition()`方法可以设置竖直滑块的位置。例如,如果你有一个QTableWidget对象叫做`tableWidget`,你可以使用以下代码将滑块位置设置为`sliderPosition`:
```
tableWidget->verticalScrollBar()->setSliderPosition(sliderPosition);
```
引用了中的代码。
请注意,以上的代码片段假设你已经创建了一个QTableWidget对象,并且它被命名为`tableWidget`。你可以根据实际情况修改对象的名称。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* *2* *3* [QTableWidget懒加载(动态加载)实现](https://blog.csdn.net/weixin_30768175/article/details/96556912)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v93^chatsearchT3_1"}}] [.reference_item style="max-width: 100%"]
[ .reference_list ]
相关推荐
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![pdf](https://img-home.csdnimg.cn/images/20210720083512.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)