このページでは

QDesignerFormWindowCursorInterface Class

QDesignerFormWindowCursorInterface クラスを使用すると、フォームウィンドウのウィジェット選択状態を取得・変更できるほか、そのフォーム内のすべてのウィジェットのプロパティを変更することもできます。詳細...

ヘッダー: #include <QDesignerFormWindowCursorInterface>
CMake: find_package(Qt6 REQUIRED COMPONENTS Designer)
target_link_libraries(mytarget PRIVATE Qt6::Designer)
qmake: QT += designer

パブリック型

enum MoveMode { MoveAnchor, KeepAnchor }
enum MoveOperation { NoMove, Start, End, Next, Prev, …, Down }

パブリック関数

QDesignerFormWindowCursorInterface()
QDesignerFormWindowCursorInterface(const QDesignerFormWindowCursorInterface &)
QDesignerFormWindowCursorInterface(QDesignerFormWindowCursorInterface &&)
virtual ~QDesignerFormWindowCursorInterface()
virtual QWidget *current() const = 0
virtual QDesignerFormWindowInterface *formWindow() const = 0
virtual bool hasSelection() const = 0
bool isWidgetSelected(QWidget *widget) const
virtual bool movePosition(QDesignerFormWindowCursorInterface::MoveOperation operation, QDesignerFormWindowCursorInterface::MoveMode mode = MoveAnchor) = 0
virtual int position() const = 0
virtual void resetWidgetProperty(QWidget *widget, const QString &name) = 0
virtual QWidget *selectedWidget(int index) const = 0
virtual int selectedWidgetCount() const = 0
virtual void setPosition(int position, QDesignerFormWindowCursorInterface::MoveMode mode = MoveAnchor) = 0
virtual void setProperty(const QString &name, const QVariant &value) = 0
virtual void setWidgetProperty(QWidget *widget, const QString &name, const QVariant &value) = 0
virtual QWidget *widget(int index) const = 0
virtual int widgetCount() const = 0
QDesignerFormWindowCursorInterface &operator=(QDesignerFormWindowCursorInterface &&)
QDesignerFormWindowCursorInterface &operator=(const QDesignerFormWindowCursorInterface &)

詳細な説明

QDesignerFormWindowCursorInterface は、関連付けられたフォームウィンドウのテキストカーソルへのインターフェースを提供する利便性クラスです。このクラスは、特定のフォームウィンドウの選択範囲を照会したり、定義されたモード (MoveMode) や移動 (MoveOperation) に基づいて選択範囲のフォーカスを変更したりできる一連の関数を提供します。 また、このインターフェースを使用して、フォームのウィジェットを照会したり、そのプロパティを変更したりすることもできます。

このインターフェースは、直接インスタンス化されることを意図したものではなく、Qt Widgets Designer の現在のフォームウィンドウの選択範囲やウィジェットへのアクセスを提供するためのものです。QDesignerFormWindowInterface は常に、関連するカーソルインターフェースを提供します。特定のウィジェットに対応するフォームウィンドウは、静的関数QDesignerFormWindowInterface::findFormWindow()を使用して取得できます。例:

    auto *formWindow = QDesignerFormWindowInterface::findFormWindow(myWidget);

    formWindow->cursor()->setProperty(myWidget, myProperty, newValue);

Qt Widgets Designer のform window manager を使用することで、Qt Widgets Designer の現在のフォームウィンドウを任意に取得できます。

フォームウィンドウのカーソルインターフェースを取得したら、hasSelection() 関数を使用して、そのフォームウィンドウに選択項目があるかどうかを確認できます。フォームウィンドウの総数については、widgetCount() およびselectedWidgetCount() を照会できます。現在選択されているウィジェット(1つまたは複数)は、current() またはselectedWidget() 関数を使用して取得できます。

widget() 関数を使用すると、フォームウィンドウ内の任意のウィジェットを取得でき、isWidgetSelected() 関数を使用してウィジェットが選択されているかどうかを確認できます。setProperty() 関数を使用すると、選択されているウィジェットのプロパティを設定でき、setWidgetProperty() またはresetWidgetProperty() 関数を使用して、任意のウィジェットのプロパティを変更できます。

最後に、setPosition() およびmovePosition() 関数を使用して、テキストカーソルのposition() を変更することで、選択内容を変更することができます。

「 QDesignerFormWindowInterface 」および「QDesignerFormWindowManagerInterface 」も参照してください 。

メンバ型のドキュメント

enum QDesignerFormWindowCursorInterface::MoveMode

この列挙型は、テキストカーソルの移動時に使用されるさまざまなモードを表しています。

定数値説明
QDesignerFormWindowCursorInterface::MoveAnchor0アンカーはカーソルとともに新しい位置に移動します。
QDesignerFormWindowCursorInterface::KeepAnchor1アンカーは、カーソルの元の位置に残ります。

enum QDesignerFormWindowCursorInterface::MoveOperation

この列挙型は、フォームウィンドウで発生し得るテキストカーソルの操作の種類を表します。

定数値説明
QDesignerFormWindowCursorInterface::NoMove0カーソルは移動しません。
QDesignerFormWindowCursorInterface::Start1カーソルをフォーカスチェーンの先頭に移動します。
QDesignerFormWindowCursorInterface::End2カーソルをフォーカスチェーンの末尾に移動します。
QDesignerFormWindowCursorInterface::Next3カーソルをフォーカスチェーン内の次のウィジェットに移動します。
QDesignerFormWindowCursorInterface::Prev4カーソルをフォーカスチェーン内の前のウィジェットに移動します。
QDesignerFormWindowCursorInterface::Left5カーソルが左に移動します。
QDesignerFormWindowCursorInterface::Right6カーソルが右に移動します。
QDesignerFormWindowCursorInterface::Up7カーソルが上に移動します。
QDesignerFormWindowCursorInterface::Down8カーソルが下に移動します。

メンバ関数のドキュメント

[constexpr noexcept default] QDesignerFormWindowCursorInterface::QDesignerFormWindowCursorInterface()

QDesignerFormWindowCursorInterface のインスタンスをデフォルトコンストラクタで生成します。

[delete] QDesignerFormWindowCursorInterface::QDesignerFormWindowCursorInterface(const QDesignerFormWindowCursorInterface &)

QDesignerFormWindowCursorInterface のインスタンスをコピーして生成します。この関数は削除されています。

[delete] QDesignerFormWindowCursorInterface::QDesignerFormWindowCursorInterface(QDesignerFormWindowCursorInterface &&)

QDesignerFormWindowCursorInterface のインスタンスをMoveコンストラクタで生成します。この関数は削除されています。

[virtual constexpr noexcept default] QDesignerFormWindowCursorInterface::~QDesignerFormWindowCursorInterface()

カーソルインターフェースを破棄します。

[pure virtual] QWidget *QDesignerFormWindowCursorInterface::current() const

フォームウィンドウで現在選択されているウィジェットを返します。

selectedWidget()も参照してください 。

[pure virtual] QDesignerFormWindowInterface *QDesignerFormWindowCursorInterface::formWindow() const

このカーソルインターフェースに関連付けられたフォームウィンドウインターフェースを返します。

[pure virtual] bool QDesignerFormWindowCursorInterface::hasSelection() const

フォームウィンドウに選択範囲が含まれている場合は true を返し、そうでない場合は false を返します。

bool QDesignerFormWindowCursorInterface::isWidgetSelected(QWidget *widget) const

指定されたwidget が選択されている場合はtrueを返し、そうでない場合はfalseを返します。

[pure virtual] bool QDesignerFormWindowCursorInterface::movePosition(QDesignerFormWindowCursorInterface::MoveOperation operation, QDesignerFormWindowCursorInterface::MoveMode mode = MoveAnchor)

指定されたmode を使用して、カーソルに対して指定されたoperation を実行し、正常に完了した場合はtrueを返し、そうでない場合はfalseを返します。

position() およびsetPosition()も参照してください 。

[pure virtual] int QDesignerFormWindowCursorInterface::position() const

カーソルの位置を返します。

setPosition() およびmovePosition()も参照してください 。

[pure virtual] void QDesignerFormWindowCursorInterface::resetWidgetProperty(QWidget *widget, const QString &name)

指定されたwidget に対して、name が指定されたプロパティをデフォルト値にリセットします。

setProperty() およびsetWidgetProperty()も参照してください 。

[pure virtual] QWidget *QDesignerFormWindowCursorInterface::selectedWidget(int index) const

指定されたindex を持つウィジェットを、選択されたウィジェットのリストから返します。

current() およびwidget()も参照してください 。

[pure virtual] int QDesignerFormWindowCursorInterface::selectedWidgetCount() const

フォームウィンドウ内で選択されているウィジェットの数を返します。

widgetCount()も参照してください 。

[pure virtual] void QDesignerFormWindowCursorInterface::setPosition(int position, QDesignerFormWindowCursorInterface::MoveMode mode = MoveAnchor)

mode を使用して、指定されたposition へカーソルの位置を設定し、その移動方法を指定します。

position() およびmovePosition()も参照してください 。

[pure virtual] void QDesignerFormWindowCursorInterface::setProperty(const QString &name, const QVariant &value)

現在選択されているウィジェットの、指定されたname を持つプロパティを、指定されたvalue に設定します。

setWidgetProperty() およびresetWidgetProperty()も参照してください 。

[pure virtual] void QDesignerFormWindowCursorInterface::setWidgetProperty(QWidget *widget, const QString &name, const QVariant &value)

指定されたname を持つ、指定されたwidget のプロパティを、指定されたvalue に設定します。

resetWidgetProperty() およびsetProperty()も参照してください 。

[pure virtual] QWidget *QDesignerFormWindowCursorInterface::widget(int index) const

フォームウィンドウのウィジェット一覧から、指定されたindex を持つウィジェットを返します。

selectedWidget()も参照してください 。

[pure virtual] int QDesignerFormWindowCursorInterface::widgetCount() const

フォームウィンドウ内のウィジェットの数を返します。

selectedWidgetCount()も参照してください 。

[delete] QDesignerFormWindowCursorInterface &QDesignerFormWindowCursorInterface::operator=(QDesignerFormWindowCursorInterface &&)

other をこのQDesignerFormWindowCursorInterface インスタンスに割り当てます。この関数は削除されます。

[delete] QDesignerFormWindowCursorInterface &QDesignerFormWindowCursorInterface::operator=(const QDesignerFormWindowCursorInterface &)

other をこのQDesignerFormWindowCursorInterface インスタンスにコピーして割り当てます。この関数は削除されます。

© 2026 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.