Change hyperlink 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

win32限制改变窗口大小

响应WM_SIZING消息,消息函数中做如下处理

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
void CDemoDlg::OnSizing(UINT fwSide, LPRECT pRect)
{
	if (pRect->right - pRect->left < minWidth_)
	{
		if (fwSide == WMSZ_LEFT
			|| fwSide == WMSZ_TOPLEFT
			|| fwSide == WMSZ_BOTTOMLEFT)
		{
			pRect->left = pRect->right - minWidth_;
		}
		else
			pRect->right = pRect->left + minWidth_;
	}
	if (pRect->bottom - pRect->top < memHdcHeight_)
	{
		if (fwSide == WMSZ_TOP
			|| fwSide == WMSZ_TOPLEFT
			|| fwSide == WMSZ_TOPRIGHT)
		{
			pRect->top = pRect->bottom - minHeight_;
		}
		else
			pRect->bottom = pRect->top + minHeight_;
	}
 
	CDialogEx::OnSizing(fwSide, pRect);
}