Skip to content

AAbstractTypeableView#

Basic implementation of type shortcuts and selection for editable text fields.

Header:#include <AUI/View/AAbstractTypeableView.h>
CMake:aui_link(my_target PUBLIC aui::views)

Detailed Description#

Used as base in ATextArea and ATextField, both of them using own way of text handling and rendering.

Public Methods#

text#


auto AAbstractTypeableView::text()

Text property.

Examples:

examples/app/fractal/src/JumpToCoordsWindow.cpp

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

        _new<AButton>("Jump").connect(
            &AButton::clicked, this,
            [&, fractalView, re, im, scale]() {
                try {
                    auto dRe = std::stod((*re->text()).toStdString());
                    auto dIm = -std::stod((*re->text()).toStdString());
                    auto dScale = std::stod((*re->text()).toStdString());
                    fractalView->setPlotPositionAndScale(glm::dvec2 { dRe, dIm }, dScale);
                    close();
                } catch (...) {
examples/ui/views/tests/LayoutManagerTest.cpp

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

 * Checks height of all buttons - they should be the same (see "Show all views..." button above).
 */
TEST_F(UILayoutManager, Height) {
    // check height
    (By::text("Common button") | By::text("Show all views...")).check(sameHeight(), "height mismatch");
}


/**
 * Checks alignment (see "Alex2772, 2021, alex2772.ru" - it is not perfectly aligned)
examples/7guis/flight_booker/src/main.cpp

7GUIs Flight Booker - Flight Booker.

                if (state.userChangesText.is_locked()) {
                    return;
                }

                it.text() = formatDate(*value);
            });
        AObject::connect(it->text().changed, state->parsed, [&it = *it, &state = *state](const AString& s) {
            std::unique_lock lock(state.userChangesText);
            state.parsed = parseDate(s);
        });