更新代码
This commit is contained in:
@@ -319,7 +319,7 @@ bool FramelessDialog::nativeEvent(const QByteArray &eventType, void *message, lo
|
||||
}
|
||||
|
||||
//识别标题栏拖动产生半屏全屏效果
|
||||
if (titleBar != 0 && titleBar->rect().contains(pos)) {
|
||||
if (titleBar && titleBar->rect().contains(pos)) {
|
||||
QWidget *child = titleBar->childAt(pos);
|
||||
if (!child) {
|
||||
*result = HTCAPTION;
|
||||
|
||||
@@ -319,7 +319,7 @@ bool FramelessMainWindow::nativeEvent(const QByteArray &eventType, void *message
|
||||
}
|
||||
|
||||
//识别标题栏拖动产生半屏全屏效果
|
||||
if (titleBar != 0 && titleBar->rect().contains(pos)) {
|
||||
if (titleBar && titleBar->rect().contains(pos)) {
|
||||
QWidget *child = titleBar->childAt(pos);
|
||||
if (!child) {
|
||||
*result = HTCAPTION;
|
||||
|
||||
@@ -319,7 +319,7 @@ bool FramelessWidget::nativeEvent(const QByteArray &eventType, void *message, lo
|
||||
}
|
||||
|
||||
//识别标题栏拖动产生半屏全屏效果
|
||||
if (titleBar != 0 && titleBar->rect().contains(pos)) {
|
||||
if (titleBar && titleBar->rect().contains(pos)) {
|
||||
QWidget *child = titleBar->childAt(pos);
|
||||
if (!child) {
|
||||
*result = HTCAPTION;
|
||||
|
||||
@@ -26,7 +26,7 @@ FramelessWidget2::FramelessWidget2(QObject *parent) : QObject(parent)
|
||||
|
||||
bool FramelessWidget2::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (widget != 0 && watched == widget) {
|
||||
if (widget && watched == widget) {
|
||||
if (event->type() == QEvent::WindowStateChange) {
|
||||
//解决mac系统上无边框最小化失效的bug
|
||||
#ifdef Q_OS_MACOS
|
||||
|
||||
@@ -17,7 +17,7 @@ LunarCalendarWidget::LunarCalendarWidget(QWidget *parent) : QWidget(parent)
|
||||
if (!fontDb.families().contains("FontAwesome")) {
|
||||
int fontId = fontDb.addApplicationFont(":/font/fontawesome-webfont.ttf");
|
||||
QStringList fontName = fontDb.applicationFontFamilies(fontId);
|
||||
if (fontName.count() == 0) {
|
||||
if (fontName.size() == 0) {
|
||||
qDebug() << "load fontawesome-webfont.ttf error";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ void MaskWidget::setBgColor(const QColor &bgColor)
|
||||
|
||||
void MaskWidget::showEvent(QShowEvent *)
|
||||
{
|
||||
if (mainWidget != 0) {
|
||||
if (mainWidget) {
|
||||
this->setGeometry(mainWidget->geometry());
|
||||
}
|
||||
}
|
||||
@@ -91,7 +91,7 @@ bool MaskWidget::eventFilter(QObject *obj, QEvent *event)
|
||||
}
|
||||
} else if (event->type() == QEvent::WindowActivate) {
|
||||
//当主窗体激活时,同时激活遮罩层
|
||||
if (mainWidget != 0) {
|
||||
if (mainWidget) {
|
||||
if (obj->objectName() == mainWidget->objectName()) {
|
||||
if (this->isVisible()) {
|
||||
this->activateWindow();
|
||||
|
||||
@@ -13,7 +13,7 @@ MoveWidget::MoveWidget(QObject *parent) : QObject(parent)
|
||||
|
||||
bool MoveWidget::eventFilter(QObject *watched, QEvent *event)
|
||||
{
|
||||
if (widget != 0 && watched == widget) {
|
||||
if (widget && watched == widget) {
|
||||
QMouseEvent *mouseEvent = (QMouseEvent *)event;
|
||||
if (mouseEvent->type() == QEvent::MouseButtonPress) {
|
||||
//如果限定了只能鼠标左键拖动则判断当前是否是鼠标左键
|
||||
@@ -38,7 +38,7 @@ bool MoveWidget::eventFilter(QObject *watched, QEvent *event)
|
||||
bool xyOut = (x + widget->width() < offset || y + widget->height() < offset);
|
||||
bool whOut = false;
|
||||
QWidget *w = (QWidget *)widget->parent();
|
||||
if (w != 0) {
|
||||
if (w) {
|
||||
whOut = (w->width() - x < offset || w->height() - y < offset);
|
||||
}
|
||||
if (xyOut || whOut) {
|
||||
@@ -71,4 +71,4 @@ void MoveWidget::setWidget(QWidget *widget)
|
||||
this->widget = widget;
|
||||
this->widget->installEventFilter(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user