ramlife

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

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

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<double>::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. 需要字符串中的字串:

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 来添加。

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

posted on 2020-10-22 20:28  ramlife  阅读(139)  评论(0编辑  收藏  举报