QT
ywp_1146
温故而知新,可以为师矣。
展开
-
QMenu圆角
基本样式menu的item的基础高度可以用参数 min-height属性控制保证item不会过于窄。QMenu menu;menu.setStyleSheet("QMenu{border-radius:4px;padding-top:6px;background-color:white;border: 1px solid #eaeaea;}QMenu::item{min-height:32px;background-color:transparent;border:0px;font: 14px ;原创 2022-03-11 16:58:37 · 282 阅读 · 0 评论 -
Qt setFocus无法生效问题
setFocus 无法生效的问题官方文档说的很明白当前部件或者其父部件必须是active window.所以mywidget.activateWindow()mywidget.setFocus()void myWidget::focusInEvent(QFocusEvent *event){ this.childa}但是有些时候这样也不会获得焦点,比如当自己内部需要setFocus的时候。可以通过focusOutEvent() or focusInEvent()来实现。void my原创 2021-03-19 16:05:19 · 2456 阅读 · 0 评论 -
Qt界面无边框拖拽及拉伸
无边框拖拽及拉伸由setWindowFlags(Qt::FramelessWindowHint)的无边框界面可以通过native接受windows消息处理。点击子界面支持拖拽必须有*result = HTCAPTION;bool Test20210311::nativeEvent(const QByteArray &eventType, void *message, long *result){ MSG* msg = (MSG*)message; switch(msg->原创 2021-03-12 10:00:55 · 622 阅读 · 0 评论 -
QListWidget
样式当然alternate属性得先设置setAlternatingRowColors(true)才生效QListWidget{//基本样式border:0px solid #d7d7d7;border-radius:4px;}QListWidget::item:hover:active{background-color:#ececec;}QListWidget::item:selected:active{background-color:#ececec;}QListWidge原创 2021-03-12 09:02:12 · 100 阅读 · 0 评论