OSDN Git Service

various cleanups
authorIvailo Monev <xakepa10@laimg.moc>
Mon, 10 Oct 2016 17:01:58 +0000 (17:01 +0000)
committerIvailo Monev <xakepa10@laimg.moc>
Mon, 10 Oct 2016 17:01:58 +0000 (17:01 +0000)
Signed-off-by: Ivailo Monev <xakepa10@laimg.moc>
src/gui/kernel/qaction.cpp
src/gui/kernel/qaction_p.h
src/gui/kernel/qdesktopwidget.cpp
src/gui/kernel/qdrag.cpp
src/gui/kernel/qdrag.h
src/gui/kernel/qformlayout.cpp
src/gui/widgets/qtoolbutton.cpp

index 7eb10a8..97f2d6a 100644 (file)
@@ -80,7 +80,7 @@ static QString qt_strippedText(QString s)
 
 
 QActionPrivate::QActionPrivate() : group(0), enabled(1),
-                                   visible(1), checkable(0), checked(0), separator(0), fontSet(false),
+                                   visible(1), checkable(0), checked(0), separator(0),
                                    menuRole(QAction::TextHeuristicRole),
                                    priority(QAction::NormalPriority)
 {
@@ -557,7 +557,6 @@ void QAction::setFont(const QFont &font)
     if (d->font == font)
         return;
 
-    d->fontSet = true;
     d->font = font;
     d->sendDataChanged();
 }
index a258374..22750eb 100644 (file)
@@ -97,7 +97,6 @@ public:
     uint checkable : 1;
     uint checked : 1;
     uint separator : 1;
-    uint fontSet : 1;
 
     QFont font;
     QPointer<QMenu> menu;
index 87a8f8f..1d6bcda 100644 (file)
@@ -52,10 +52,10 @@ const QRect QDesktopWidget::screenGeometry(const QWidget *widget) const
                  "to get the screen geometry of a null widget");
         return QRect();
     }
-    QRect rect = QWidgetPrivate::screenGeometry(widget);
+    const QRect rect = QWidgetPrivate::screenGeometry(widget);
     if (rect.isNull())
         return screenGeometry(screenNumber(widget));
-    else return rect;
+    return rect;
 }
 
 const QRect QDesktopWidget::availableGeometry(const QWidget *widget) const
@@ -65,11 +65,10 @@ const QRect QDesktopWidget::availableGeometry(const QWidget *widget) const
                  "to get the available geometry of a null widget");
         return QRect();
     }
-    QRect rect = QWidgetPrivate::screenGeometry(widget);
+    const QRect rect = QWidgetPrivate::screenGeometry(widget);
     if (rect.isNull())
         return availableGeometry(screenNumber(widget));
-    else
-        return rect;
+    return rect;
 }
 
 QT_END_NAMESPACE
index 38fabfe..19a1db5 100644 (file)
@@ -224,26 +224,6 @@ QWidget *QDrag::target() const
 
     Starts the drag and drop operation and returns a value indicating the requested
     drop action when it is completed. The drop actions that the user can choose
-    from are specified in \a supportedActions. The default proposed action will be selected
-    among the allowed actions in the following order: Move, Copy and Link.
-
-    \bold{Note:} On Linux and Mac OS X, the drag and drop operation
-    can take some time, but this function does not block the event
-    loop. Other events are still delivered to the application while
-    the operation is performed. On Windows, the Qt event loop is
-    blocked while during the operation.
-*/
-
-Qt::DropAction QDrag::exec(Qt::DropActions supportedActions)
-{
-    return exec(supportedActions, Qt::IgnoreAction);
-}
-
-/*!
-    \since 4.3
-
-    Starts the drag and drop operation and returns a value indicating the requested
-    drop action when it is completed. The drop actions that the user can choose
     from are specified in \a supportedActions.
 
     The \a defaultDropAction determines which action will be proposed when the user performs a
index 2baf428..b07119e 100644 (file)
@@ -78,8 +78,8 @@ public:
     QWidget *target() const;
 
     Qt::DropAction start(Qt::DropActions supportedActions = Qt::CopyAction);
-    Qt::DropAction exec(Qt::DropActions supportedActions = Qt::MoveAction);
-    Qt::DropAction exec(Qt::DropActions supportedActions, Qt::DropAction defaultAction);
+    Qt::DropAction exec(Qt::DropActions supportedActions = Qt::MoveAction,
+                        Qt::DropAction defaultAction = Qt::IgnoreAction);
 
     void setDragCursor(const QPixmap &cursor, Qt::DropAction action);
 
index a22c5c2..7ff9f5b 100644 (file)
@@ -264,9 +264,8 @@ static Qt::Alignment fixedAlignment(Qt::Alignment alignment, Qt::LayoutDirection
         return Qt::Alignment((alignment & ~(Qt::AlignLeft | Qt::AlignRight | Qt::AlignAbsolute))
                              | ((alignment & Qt::AlignRight) ? Qt::AlignLeft : 0)
                              | ((alignment & Qt::AlignLeft) ? Qt::AlignRight : 0));
-    } else {
-        return alignment & ~Qt::AlignAbsolute;
     }
+    return alignment & ~Qt::AlignAbsolute;
 }
 
 static int storageIndexFromLayoutItem(const QFormLayoutPrivate::ItemMatrix &m,
index 3a1a23f..56de9ae 100644 (file)
@@ -929,8 +929,7 @@ void QToolButton::setDefaultAction(QAction *action)
     setCheckable(action->isCheckable());
     setChecked(action->isChecked());
     setEnabled(action->isEnabled());
-    if (action->d_func()->fontSet)
-        setFont(action->font());
+    setFont(action->font());
 }