跳转至

example/ui/widget/material/textfield/TextFieldExampleWindow.h

Material Design 3 TextField Example - Main Window. More...

Namespaces

Name
cf
cf::ui
cf::ui::example

Classes

Name
class cf::ui::example::TextFieldExampleWindow
Main window for the Material TextField Example.

Detailed Description

Material Design 3 TextField Example - Main Window.

Author: CFDesktop Team

Version: 0.1

Date: 2026-03-01

A visual gallery to display all Material Design 3 text field variants with various states and configurations.

Source code

#pragma once

#include <QGridLayout>
#include <QGroupBox>
#include <QHBoxLayout>
#include <QLabel>
#include <QMainWindow>
#include <QScrollArea>
#include <QVBoxLayout>
#include <QWidget>

namespace cf::ui::example {

class TextFieldExampleWindow : public QMainWindow {
    Q_OBJECT

  public:
    explicit TextFieldExampleWindow(QWidget* parent = nullptr);
    ~TextFieldExampleWindow() override;

  private:
    void setupUI();
    void createHeader();
    void createTextFieldVariantsSection();
    void createTextFieldStatesSection();
    void createTextFieldWithIconsSection();
    void createTextFieldWithErrorSection();
    void createTextFieldAdvancedSection();

    QGroupBox* createGroupBox(const QString& title);
    QWidget* createScrollContent();

  private slots:
    void onTextChanged(const QString& text);
    void onValidateClicked();
    void onClearClicked();

  private:
    // UI components
    QWidget* centralWidget_;
    QVBoxLayout* mainLayout_;
    QScrollArea* scrollArea_;
    QWidget* scrollContent_;
    QVBoxLayout* scrollLayout_;

    // Header
    QLabel* titleLabel_;
    QLabel* subtitleLabel_;
};

} // namespace cf::ui::example

Updated on 2026-03-09 at 10:14:01 +0000