Skip to content

AAbstractLabel#

Represents an abstract text display view.

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

Public Methods#

text#


auto AAbstractLabel::text()

Label's 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.

                  }
                  return sys_days(ymd);
              },
            }),
            it->text());
        it & state.parsed > [](AView& textField, const AOptional<system_clock::time_point>& value) {
            textField.setAssName(".red", !value.hasValue());
        };
    };
}
examples/7guis/counter/src/main.cpp

7GUIs Counter - Simple counter.

    CounterWindow(): AWindow("AUI - 7GUIs - Counter", 200_dp, 100_dp) {
        setContents(Centered {
          Horizontal {
            _new<ATextField>() AUI_LET {
                AObject::connect(mCounter.readProjected(AString::number<int>), it->text());
                it->setEditable(false);
            },
            Button { "Count" }.connect(&AView::clicked, [&] { mCounter += 1; }),
          },
        });