core/util: move DropEmitter to utils and add generic accessor macros

This commit is contained in:
outfoxxed 2024-07-30 12:19:59 -07:00
parent abc0201f6e
commit 3a8e67e8ab
Signed by untrusted user: outfoxxed
GPG key ID: 4C88A185FB89301E
3 changed files with 81 additions and 44 deletions

View file

@ -21,22 +21,3 @@ Qt::Edges Edges::toQt(Edges::Flags edges) { return Qt::Edges(edges.toInt()); }
bool Edges::isOpposing(Edges::Flags edges) {
return edges.testFlags(Edges::Top | Edges::Bottom) || edges.testFlags(Edges::Left | Edges::Right);
}
DropEmitter::DropEmitter(DropEmitter&& other) noexcept: object(other.object), signal(other.signal) {
other.object = nullptr;
}
DropEmitter& DropEmitter::operator=(DropEmitter&& other) noexcept {
this->object = other.object;
this->signal = other.signal;
other.object = nullptr;
return *this;
}
DropEmitter::~DropEmitter() { this->call(); }
void DropEmitter::call() {
if (!this->object) return;
this->signal(this->object);
this->object = nullptr;
}