Skip to content

emit#

emits the specified signal in context of this object.

Header:#include <AUI/Common/AObject.h>
CMake:aui_link(my_target PUBLIC aui::core)

Definition#

#define emit (*this) ^

Examples#

examples/app/fractal/src/FractalView.cpp

Fractal Example - Fractal viewer application demonstrating usage of custom shaders.

void FractalView::handleMatrixUpdated() {
    mShader.use();
    mShader.set(UNIFORM_TR, mTransform);
    emit centerPosChanged(getPlotPosition(), getPlotScale());
}

void FractalView::onKeyDown(AInput::Key key) {
    AView::onKeyDown(key);
    onKeyRepeat(key);

examples/app/game_of_life/src/main.cpp

Game of Life - Game of Life implementation that uses advanced large dynamic data rendering techniques such as ITexture, AImage to be GPU friendly. The computation is performed in AThreadPool.

                }
            }
            std::swap(mStorage, mNextPopulation);

            emit frameComplete;
        };
    }

    [[nodiscard]] glm::ivec2 size() const noexcept { return mSize; }

examples/app/minesweeper/src/MinesweeperWindow.cpp

Minesweeper Game - Minesweeper game implementation driven by ass.

    if (bool(c & FieldCell::HAS_BOMB)) {
        if (doGameLoseIfBomb) {
            c |= FieldCell::RED_BG;
            mReveal = true;
            emit customCssPropertyChanged();
            redraw();
            AMessageBox::show(this, "You lost!", "You lost! Ahahahhaa!");
        }
        return;
    }

examples/ui/views/src/DemoListModel.cpp

Views Example - All-in-one views building example.

}

void DemoListModel::addItem() {
    mListSize += 1;
    emit dataInserted(range({mListSize - 1}));
}

void DemoListModel::removeItem() {
    if (mListSize > 0) {
        mListSize -= 1;

examples/ui/contacts/src/view/ContactDetailsView.cpp

AUI Contacts - Usage of AUI_DECLARATIVE_FOR to make a contacts-like application.

void ContactDetailsView::drop() {
    if (!mEditorMode) {
        // delete
        emit deleteAction;
        return;
    }

    // discard
    if (AMessageBox::show(dynamic_cast<AWindow*>(AWindow::current()), "Do you really want to discard?", "This action is irreversible!", AMessageBox::Icon::NONE, AMessageBox::Button::YES_NO) != AMessageBox::ResultButton::YES) {

Examples#

examples/app/minesweeper/src/CellView.cpp

Minesweeper Game - Minesweeper game implementation driven by ass.

#include "AUI/Render/IRenderer.h"

CellView::CellView(FieldCell& cell) : mCell(cell), mCellValueCopy(cell) {
    connect(clickedButton, this, [&]() {
        emit customCssPropertyChanged();
    });
}

void CellView::render(ARenderContext context) {
    if (mCell != mCellValueCopy) {