1,fix viewmodeldelegate not update method paint when mouse hover in macOS or xp
listView_->viewport()->setAttribute(Qt::WA_Hover,true);
2,fix 列表Item重叠
QListWidgetItem *ITEM = new QListWidgetItem();
myLiveListItem->setWidgetItem(ITEM);
QSize size = ITEM->sizeHint();
ITEM->setSizeHint(QSize(0, 146));
3,QCheckBox在自定义选中样式,在某些情况下无效时,添加如下:
<property name="focusPolicy">
<enum>Qt::NoFocus</enum>
</property>
4,监听全屏显示
void MainWindow::changeEvent(QEvent *event)
{
if(event->type() == QEvent::WindowStateChange){
if((windowState() & Qt::WindowFullScreen)){
if(likeWidget_){
likeWidget_->setOffsetBottom(ui->widgetToolBar->height());
}
ui->meetOperatorBtn->hide();
ui->widget->layout()->removeWidget(ui->widgetToolBar);
ui->widgetToolBar->move(0, this->height() - ui->widgetToolBar->height());
}
}
}
5,titlebar的设置(注意下面代码所在的文件后缀需要是.mm)
extern "C" void hideTitleBarButton(WId winId, bool minBtnVisible, bool closeBtnVisible, bool zoomBtnVisible)
{
if (winId == 0) {
return;
}
NSView* view = (NSView*)winId;
NSWindow* window = [view window];
window.titlebarAppearsTransparent = YES;
NSButton *button = [window standardWindowButton:NSWindowMiniaturizeButton];
button.hidden = !minBtnVisible;
button.enabled = minBtnVisible;
button = [window standardWindowButton:NSWindowCloseButton];
button.hidden = !closeBtnVisible;
button.enabled = closeBtnVisible;
button = [window standardWindowButton:NSWindowZoomButton];
button.hidden = !zoomBtnVisible;
button.enabled = zoomBtnVisible;
window.styleMask = NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable
| NSWindowStyleMaskResizable | NSWindowStyleMaskTitled
| NSWindowStyleMaskFullSizeContentView;
}
6,setWindowFlags(Qt::Popup t);mac上点击空白不会消失
修改dialog.exec()为dialog->show()
7,workaround : mac下mouse hover一些情况下一直保持
extern void clearMouseHover(QWidget * widget);
void clearMouseHover(QWidget *widget)
{
#ifdef __APPLE__
if(widget){
widget->setAttribute(Qt::WA_UnderMouse, false);
QHoverEvent hoverEvent(QEvent::HoverLeave, QPoint(40, 40), QPoint(0, 0));
QCoreApplication::sendEvent(widget, &hoverEvent);
}
#endif
}
8,mac上QCombox一条数据时,点击显示下拉框异常
对应的UI上添加样式QComboBox{combobox-popup:0};
或者代码里统一设置
application.setStyleSheet(a.styleSheet() + "QComboBox{combobox-popup:0}");
9,fix mac 主窗体在全屏时(专注模式下)其它子窗体在本屏幕叠加显示
extern void setSubWindowInFullScreenParent(QWidget * parentWindow , QWidget * subWindow);
void setSubWindowInFullScreenParent(QWidget * parentWindow , QWidget *subWindow)
{
#ifdef __APPLE__
if(parentWindow && parentWindow->isFullScreen() && subWindow){
subWindow->setParent(parentWindow);
subWindow->setParent(nullptr);
subWindow->setWindowFlags(subWindow->windowFlags() | Qt::Dialog);
}
#endif
}
- 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
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102