Change hyperlink text color in QT

1
2
3
4
5
6
	// ui->btnEdit is a QLabel.
	ui->btnEdit->setText(QString("<a href=\"localhost\"><font color=\"#ff0000\">") + tr("Edit") + QString("</font></a>"));
	ui->btnEdit->setAlignment(Qt::AlignLeft | Qt::AlignVCenter);
	connect(ui->btnEdit, &QLabel::linkActivated, [=, this](QString url) {
		...
	});

refer to:
https://www.lmlphp.com/user/507/article/item/13949

ERROR 2003 (HY000): Can't connect to MySQL server on ... 113

1
2
3
4
5
6
7
8
9
telnet 192.168.1.165 3306
 
# firewall in ubuntu
sudo ufw disable
 
# or found ip changed
vi /etc/mysql/mysql.conf.d/mysqld.cnf
systemctl restart mysql
systemctl status mysql

refer to:
https://blog.csdn.net/zhangasas/article/details/89432832

西方科学年表

1
2
3
4
5
6
7
8
1452-1519	Leonardo da Vinci 达芬奇
1473-1543	Mikołaj Kopernik 哥白尼
1564-1642	Galileo 伽利略
1596-1650	René Descartes 笛卡尔
1643-1727	Isaac Newton 牛顿
1707-1783	Leonhard Euler 欧拉
1736-1813	Joseph-Louis Lagrange 拉格朗日
1789		法国大革命

Recording video or audio in Windows

1
2
3
4
5
6
7
ffmpeg -f dshow -list_devices true -i dummy
 
#can only play one instance simultaneously
ffplay -f dshow -i video="Integrated Webcam"
 
#can play multiple instances at once
ffmpeg -f dshow -i audio="Microphone (Realtek(R) Audio)" out2.wav

refer to:
https://blog.csdn.net/qq_43627907/article/details/124416450
compiled ok in Qt5.15.2.

https://blog.csdn.net/how0723/article/details/77418421
https://zhuanlan.zhihu.com/p/31348306
search 'QAudioOutput' in Qt Creator Examples.

https://blog.csdn.net/jlf521521/article/details/106689503
QT5 使用QCustomplot绘制频谱瀑布图并封快速傅里叶变换fft类
https://blog.csdn.net/u013915524/article/details/122288358

QTimeLine starts very slowly

Need to set the time line execution curve as linear.

1
2
3
4
5
	m_time_line.reset(new QTimeLine(m_span_msecs * count, this));
	m_time_line->setFrameRange(0, count);
	m_time_line->setEasingCurve(QEasingCurve::Linear);
	// below is deprecated
	//m_time_line->setCurveShape(QTimeLine::LinearCurve);

refer to:
http://www.wjhsh.net/rickyk-p-4044875.html

Retrieve all widgets after times of calling addWidget at same position

Don't call QGridLayout::itemAtPosition.

Like this,

1
2
3
4
5
6
7
8
9
10
11
12
for (int i = 0; i < grid_layout->count(); i++)
{
	QLayoutItem* item = grid_layout->itemAt(i);
 
	if (item->widget() == widget_wanted)
	{
		int row, column, row_span, column_span;
		grid_layout->getItemPosition(i, &row, &column, &row_span, &column_span);
 
		// grid_layout->addWidget(frame, row, column);
	}
}