summaryrefslogtreecommitdiffstats
path: root/src/widgets/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/widgets/util')
-rw-r--r--src/widgets/util/qflickgesture.cpp2
-rw-r--r--src/widgets/util/qscroller.cpp6
-rw-r--r--src/widgets/util/qscroller_mac.mm2
-rw-r--r--src/widgets/util/qscrollerproperties.cpp4
-rw-r--r--src/widgets/util/qsystemtrayicon.cpp2
-rw-r--r--src/widgets/util/qundostack.cpp27
-rw-r--r--src/widgets/util/qundostack.h1
7 files changed, 35 insertions, 9 deletions
diff --git a/src/widgets/util/qflickgesture.cpp b/src/widgets/util/qflickgesture.cpp
index 57db9ff7fc..10e92e04e1 100644
--- a/src/widgets/util/qflickgesture.cpp
+++ b/src/widgets/util/qflickgesture.cpp
@@ -460,7 +460,7 @@ QGestureRecognizer::Result QFlickGestureRecognizer::recognize(QGesture *state,
}
break;
-#if defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
// the only way to distinguish between real mouse wheels and wheel
// events generated by the native 2 finger swipe gesture is to listen
// for these events (according to Apple's Cocoa Event-Handling Guide)
diff --git a/src/widgets/util/qscroller.cpp b/src/widgets/util/qscroller.cpp
index 9973940c16..a348327c92 100644
--- a/src/widgets/util/qscroller.cpp
+++ b/src/widgets/util/qscroller.cpp
@@ -1011,12 +1011,12 @@ bool QScroller::handleInput(Input input, const QPointF &position, qint64 timesta
return false;
}
-#if !defined(Q_DEAD_CODE_FROM_QT4_MAC)
+#if 1 // Used to be excluded in Qt4 for Q_WS_MAC
// the Mac version is implemented in qscroller_mac.mm
QPointF QScrollerPrivate::realDpi(int screen) const
{
-# if defined(Q_DEAD_CODE_FROM_QT4_X11) && !defined(QT_NO_XRANDR)
+# if 0 /* Used to be included in Qt4 for Q_WS_X11 */ && !defined(QT_NO_XRANDR)
if (X11 && X11->use_xrandr && X11->ptrXRRSizes && X11->ptrXRRRootToScreen) {
int nsizes = 0;
// QDesktopWidget is based on Xinerama screens, which do not always
@@ -1042,7 +1042,7 @@ QPointF QScrollerPrivate::realDpi(int screen) const
return QPointF(w->physicalDpiX(), w->physicalDpiY());
}
-#endif // !Q_DEAD_CODE_FROM_QT4_MAC
+#endif
/*! \internal
diff --git a/src/widgets/util/qscroller_mac.mm b/src/widgets/util/qscroller_mac.mm
index 31316f5518..6dbb483089 100644
--- a/src/widgets/util/qscroller_mac.mm
+++ b/src/widgets/util/qscroller_mac.mm
@@ -39,7 +39,7 @@
#include <QtCore/qglobal.h>
-#ifdef Q_DEAD_CODE_FROM_QT4_MAC
+#if 0 // Used to be included in Qt4 for Q_WS_MAC
#import <AppKit/AppKit.h>
diff --git a/src/widgets/util/qscrollerproperties.cpp b/src/widgets/util/qscrollerproperties.cpp
index 35e1be15db..c26fba2cd3 100644
--- a/src/widgets/util/qscrollerproperties.cpp
+++ b/src/widgets/util/qscrollerproperties.cpp
@@ -40,7 +40,7 @@
#include <QPointer>
#include <QObject>
#include <QtCore/qmath.h>
-#ifdef Q_DEAD_CODE_FROM_QT4_WIN
+#if 0 // Used to be included in Qt4 for Q_WS_WIN
# include <QLibrary>
#endif
@@ -73,7 +73,7 @@ QScrollerPropertiesPrivate *QScrollerPropertiesPrivate::defaults()
spp.overshootDragDistanceFactor = qreal(1);
spp.overshootScrollDistanceFactor = qreal(0.5);
spp.overshootScrollTime = qreal(0.7);
-# ifdef Q_DEAD_CODE_FROM_QT4_WIN
+# if 0 // Used to be included in Qt4 for Q_WS_WIN
if (QLibrary::resolve(QLatin1String("UxTheme"), "BeginPanningFeedback"))
spp.overshootScrollTime = qreal(0.35);
# endif
diff --git a/src/widgets/util/qsystemtrayicon.cpp b/src/widgets/util/qsystemtrayicon.cpp
index e44207301b..64daad87ae 100644
--- a/src/widgets/util/qsystemtrayicon.cpp
+++ b/src/widgets/util/qsystemtrayicon.cpp
@@ -586,7 +586,7 @@ void QBalloonTip::balloon(const QPoint& pos, int msecs, bool showArrow)
}
QPainterPath path;
-#if defined(QT_NO_XSHAPE) && defined(Q_DEAD_CODE_FROM_QT4_X11)
+#if defined(QT_NO_XSHAPE) && 0 /* Used to be included in Qt4 for Q_WS_X11 */
// XShape is required for setting the mask, so we just
// draw an ugly square when its not available
path.moveTo(0, 0);
diff --git a/src/widgets/util/qundostack.cpp b/src/widgets/util/qundostack.cpp
index 18f85ca505..59d517e77b 100644
--- a/src/widgets/util/qundostack.cpp
+++ b/src/widgets/util/qundostack.cpp
@@ -633,7 +633,7 @@ void QUndoStack::push(QUndoCommand *cmd)
commands, it emits the signal cleanChanged(). This signal is also
emitted when the stack leaves the clean state.
- \sa isClean(), cleanIndex()
+ \sa isClean(), resetClean(), cleanIndex()
*/
void QUndoStack::setClean()
@@ -648,6 +648,30 @@ void QUndoStack::setClean()
}
/*!
+ \since 5.8
+
+ Leaves the clean state and emits cleanChanged() if the stack was clean.
+ This method resets the clean index to -1.
+
+ This is typically called in the following cases, when a document has been:
+ \li created basing on some template and has not been saved,
+ so no filename has been associated with the document yet.
+ \li restored from a backup file.
+ \li changed outside of the editor and the user did not reload it.
+
+ \sa isClean(), setClean(), cleanIndex()
+*/
+
+void QUndoStack::resetClean()
+{
+ Q_D(QUndoStack);
+ const bool was_clean = isClean();
+ d->clean_index = -1;
+ if (was_clean)
+ emit cleanChanged(false);
+}
+
+/*!
If the stack is in the clean state, returns \c true; otherwise returns \c false.
\sa setClean(), cleanIndex()
@@ -668,6 +692,7 @@ bool QUndoStack::isClean() const
some commands are undone, then a new command is pushed. Since
push() deletes all the undone commands before pushing the new command, the stack
can't return to the clean state again. In this case, this function returns -1.
+ The -1 may also be returned after an explicit call to resetClean().
\sa isClean(), setClean()
*/
diff --git a/src/widgets/util/qundostack.h b/src/widgets/util/qundostack.h
index f4db78300b..ca918b0618 100644
--- a/src/widgets/util/qundostack.h
+++ b/src/widgets/util/qundostack.h
@@ -128,6 +128,7 @@ public:
public Q_SLOTS:
void setClean();
+ void resetClean();
void setIndex(int idx);
void undo();
void redo();