1. 获取容器的最大最小值,注意返回的不是数值,需要 *。

```c++ min_data = min_element(myarr.begin(),myarr.end()); auto mydata = minmax_element(myarr.begin(),myarr.end()); cout<<"min: " << mydata.first << " max: " << *mydata.second << "\n";

QVector::iterator max = std::max_element(std::begin(data) std::end(data));


参考: https://en.cppreference.com/w/cpp/algorithm/minmax
https://blog.csdn.net/weixin_43971252/article/details/88831917
https://www.icxbk.com/ask/detail?tid=38382
https://blog.csdn.net/Littlehero_121/article/details/100565527

# 2. 需要字符串中的字串:
```c++
QString QString::mid(int position, int n = -1) const

std::basic_string::substr(size_type __pos, size_type __n) const
basic_string substr(size_type pos = 0, size_type count = npos);

参考:https://blog.csdn.net/u014252478/article/details/80034026

3. 信号与槽

https://blog.csdn.net/humanking7/article/details/86071134 https://www.cnblogs.com/raina/p/11312097.html

4. 当需要容器即可以随机存取,也可以在头部添加删除数据的时候,可以选用 deque。

参考: https://blog.csdn.net/weixin_42462202/article/details/87537503 https://blog.csdn.net/gogokongyin/article/details/51178378

5. mainwindow 里面 增加 graphicview,可以把 graphicview 当作一个 widget 来添加。

```c++ m_view1 = new View("left front"); ui->gridLayout->addWidget(m_view1, 0, 0);


# 6. 两个 QString 比较不区分大小写

qDebug() << str1.compare(str2, Qt::CaseInsensitive);


参考: https://blog.csdn.net/Colin_RZL/article/details/106642982

# 7. QTextBrowser的一些设置
https://blog.csdn.net/u010779194/article/details/9075309

# 8. timer 暂停就用 stop(),恢复就用 start()
参考: https://oomake.com/question/5276301  
https://bbs.csdn.net/topics/310074466  

# 9. 菜单项快捷键使用 `&`, 比如说: `File(&F)`
参考: https://blog.csdn.net/weixin_44591035/article/details/102674002  

# 10. about 提示框 `QMessageBox::about(this, tr("About消息框"), tr("这是一个About消息框测试!"));`
参考: https://blog.csdn.net/qq_36908789/article/details/106439905  

# 11. 菜单项 connect 槽函数,信号是 `&QAction::triggered`
参考: https://blog.csdn.net/dianzishi123/article/details/85854321  

标签: Qt

添加新评论