
QT
小黑土土777
这个作者很懒,什么都没留下…
展开
-
【QT】使用Windows API枚举窗口
#include <windows.h>#pragma comment(lib, "user32.lib")BOOL CALLBACK EnumWindowsProc( HWND hwnd, LPARAM lParam){ char buff[250]= {0};//全部填充为0 ::GetWindowTextA(hwnd,(LPSTR)buff,sizeof(buff));//获取windows窗口标题 qDebug()<<"buff=======.原创 2020-07-29 17:12:15 · 1025 阅读 · 0 评论 -
【QT】FillRect填充的区域实现部分区域透明
void MainWindow::paintEvent( QPaintEvent * event){ /* QPainter painter(this); */ QColor shadowColor; shadowColor = QColor(0, 0, 0, 100); //阴影颜色设置 QPainter painter(this); ...原创 2020-05-07 17:05:44 · 4755 阅读 · 0 评论 -
【QT】QLineEdit支持光标输入不接收键盘输入
重写QLineEdit类,在派生类中重写keyPressEvent和keyReleaseEvent函数,可以屏蔽键盘输入(包括搜狗输入法的中文输入问题)。void RbtLineEdit::keyReleaseEvent(QKeyEvent *event){ if (event->key() == Qt::Key_Shift) { setText(content); } }void RbtLineEdit::keyPressEvent(QKeyEvent *event){原创 2020-05-11 17:44:06 · 1829 阅读 · 0 评论 -
【QT】修改QLineEdit边框属性
border-style: outset; border-width: 2px; border-color: green;效果:原创 2020-05-12 09:29:27 · 6677 阅读 · 0 评论 -
【QT】QLineEdit判断鼠标点击进入的两种方法
1.重写QLineEdit类,在派生类中重写focusInEvent方法。缺点:输入光标也会消失,需要在重写光标显示。2.在主窗口增加事件过滤bool ShortKeySetWidget::eventFilter(QObject *watched, QEvent *event){ if (watched->objectName() == "m_lineEdit") { if (event->type() == QEvent::FocusIn) { this->原创 2020-05-13 10:19:34 · 2171 阅读 · 0 评论 -
【QT】清空QPixMap
QPixmap clearPix = QPixmap();sourcepx = clearPix;原创 2020-05-13 13:47:52 · 2142 阅读 · 0 评论 -
【QT】QWidget设置圆角窗口
当QWidget为模态的时候,用QSS (border-radius:6px;)设置圆角窗口时,会有直角阴影。后采用QBitmap类填充实现圆角窗口。{ QBitmap bmp(this->size()); bmp.fill(); QPainter painter(&bmp); painter.setPen(Qt::NoPen); painter.setBrush(Qt::black); painter.setRenderHint(QPainter::Antiali原创 2020-05-20 09:35:20 · 3542 阅读 · 0 评论