java.lang.Object
io.qt.core.QScopedPointer<O>
- All Implemented Interfaces:
AutoCloseable
Java wrapper for Qt class QScopedPointer to be used inside a try-with-resource block.
Example:
try(var pointer = QScopedPointer.disposing(new QDialog())){
QDialog dialog = pointer.get();
dialog.exec();
}
// dialog is disposed
Alternatively, performAndDispose disposes a recource after calling a lambda expression:
QScopedPointer.performAndDispose(QDialog::exec, new QDialog());
-
Method Summary
Modifier and TypeMethodDescriptionstatic <O> QScopedPointer<O>
static <O> QScopedPointer<O>
Deprecated.void
close()
data()
static <O extends QtObjectInterface>
QScopedPointer<O>disposing
(O data) static <O extends QObject>
QScopedPointer<O>disposingLater
(O data) get()
boolean
isNull()
static <O> void
performAndCleanup
(Consumer<O> action, Consumer<O> cleanup, O data) Performs an action on a resource which will be cleaned up subsequently.static <O,
R> R performAndCleanup
(Function<O, R> action, Consumer<O> cleanup, O data) Performs an action on a resource which will be cleaned up subsequently.static <O> double
performAndCleanup
(ToDoubleFunction<O> action, Consumer<O> cleanup, O data) Performs an action on a resource which will be cleaned up subsequently.static <O> int
performAndCleanup
(ToIntFunction<O> action, Consumer<O> cleanup, O data) Performs an action on a resource which will be cleaned up subsequently.static <O> long
performAndCleanup
(ToLongFunction<O> action, Consumer<O> cleanup, O data) Performs an action on a resource which will be cleaned up subsequently.static <O extends QtObjectInterface>
voidperformAndDispose
(Consumer<O> action, O data) Performs an action on a resource which will be disposes subsequently.static <O extends QtObjectInterface,
R>
RperformAndDispose
(Function<O, R> action, O data) Performs an action on a resource which will be disposes subsequently.static <O extends QtObjectInterface>
doubleperformAndDispose
(ToDoubleFunction<O> action, O data) Performs an action on a resource which will be disposes subsequently.static <O extends QtObjectInterface>
intperformAndDispose
(ToIntFunction<O> action, O data) Performs an action on a resource which will be disposes subsequently.static <O extends QtObjectInterface>
longperformAndDispose
(ToLongFunction<O> action, O data) Performs an action on a resource which will be disposes subsequently.static <O extends QObject>
voidperformAndDisposeLater
(Consumer<O> action, O data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.static <O extends QObject,
R>
RperformAndDisposeLater
(Function<O, R> action, O data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.static <O extends QObject>
doubleperformAndDisposeLater
(ToDoubleFunction<O> action, O data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.static <O extends QObject>
intperformAndDisposeLater
(ToIntFunction<O> action, O data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.static <O extends QObject>
longperformAndDisposeLater
(ToLongFunction<O> action, O data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.void
void
swap
(QScopedPointer<O> other) take()
-
Method Details
-
data
-
get
-
take
-
reset
-
isNull
-
swap
-
close
- Specified by:
close
in interfaceAutoCloseable
-
disposing
-
disposingLater
-
cleanup
Deprecated. -
cleanup
-
performAndDispose
@QtUninvokable public static <O extends QtObjectInterface> void performAndDispose(Consumer<O> action, O data) Performs an action on a resource which will be disposes subsequently.QScopedPointer.performAndDispose(QDialog::exec, new QDialog());
- Parameters:
action
- the actiondata
- the resource
-
performAndDisposeLater
@QtUninvokable public static <O extends QObject> void performAndDisposeLater(Consumer<O> action, O data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.QScopedPointer.performAndDispose(QDialog::exec, new QDialog());
- Parameters:
action
- the actiondata
- the resource
-
performAndCleanup
@QtUninvokable public static <O> void performAndCleanup(Consumer<O> action, Consumer<O> cleanup, O data) Performs an action on a resource which will be cleaned up subsequently.QScopedPointer.performAndCleanup(object-> { ...//action }, object -> { object.cleanup(); }, new CustomObject() );
- Parameters:
action
- the actiondata
- the resource
-
performAndDispose
@QtUninvokable public static <O extends QtObjectInterface,R> R performAndDispose(Function<O, R> action, O data) Performs an action on a resource which will be disposes subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-
performAndDisposeLater
@QtUninvokable public static <O extends QObject,R> R performAndDisposeLater(Function<O, R> action, O data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-
performAndCleanup
@QtUninvokable public static <O,R> R performAndCleanup(Function<O, R> action, Consumer<O> cleanup, O data) Performs an action on a resource which will be cleaned up subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-
performAndDispose
@QtUninvokable public static <O extends QtObjectInterface> int performAndDispose(ToIntFunction<O> action, O data) Performs an action on a resource which will be disposes subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-
performAndDisposeLater
@QtUninvokable public static <O extends QObject> int performAndDisposeLater(ToIntFunction<O> action, O data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-
performAndCleanup
@QtUninvokable public static <O> int performAndCleanup(ToIntFunction<O> action, Consumer<O> cleanup, O data) Performs an action on a resource which will be cleaned up subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-
performAndDispose
@QtUninvokable public static <O extends QtObjectInterface> double performAndDispose(ToDoubleFunction<O> action, O data) Performs an action on a resource which will be disposes subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-
performAndDisposeLater
@QtUninvokable public static <O extends QObject> double performAndDisposeLater(ToDoubleFunction<O> action, O data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-
performAndCleanup
@QtUninvokable public static <O> double performAndCleanup(ToDoubleFunction<O> action, Consumer<O> cleanup, O data) Performs an action on a resource which will be cleaned up subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-
performAndDispose
@QtUninvokable public static <O extends QtObjectInterface> long performAndDispose(ToLongFunction<O> action, O data) Performs an action on a resource which will be disposes subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-
performAndDisposeLater
@QtUninvokable public static <O extends QObject> long performAndDisposeLater(ToLongFunction<O> action, O data) Performs an action on aQObject
resource which will be calledQObject.disposeLater()
subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-
performAndCleanup
@QtUninvokable public static <O> long performAndCleanup(ToLongFunction<O> action, Consumer<O> cleanup, O data) Performs an action on a resource which will be cleaned up subsequently.- Parameters:
action
- the actiondata
- the resource- Returns:
- result
-