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 } |
パブリック関数
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 は、関連するフォームウィンドウのテキストカーソルへのインターフェイスを提供する便利なクラスです。指定されたフォームウィンドウの選択範囲を照会し、定義されたモード (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() を照会できます。current() またはselectedWidget() 関数を使用して、現在選択されているウィジェット (または複数のウィジェット) を取得できます。
widget() 関数を使用してフォーム・ウィンドウのウィジェットを取得し、isWidgetSelected() 関数を使用してウィジェットが選択されているかどうかを確認できます。選択されたウィジェットのプロパティを設定するにはsetProperty() 関数を使用し、指定されたウィジェットのプロパティを変更するにはsetWidgetProperty() またはresetWidgetProperty() 関数を使用します。
最後に、setPosition() およびmovePosition() 関数を使用して、テキスト・カーソルのposition() を変更することにより、選択範囲を変更できます。
QDesignerFormWindowInterface およびQDesignerFormWindowManagerInterfaceも参照のこと 。
メンバ型ドキュメント
enum QDesignerFormWindowCursorInterface::MoveMode
この列挙型は、テキストカーソルが移動するときに使用されるさまざまなモードを記述する。
定数 | 値 | 説明 |
---|---|---|
QDesignerFormWindowCursorInterface::MoveAnchor | 0 | アンカーはカーソルと共に新しい位置に移動する。 |
QDesignerFormWindowCursorInterface::KeepAnchor | 1 | アンカーはカーソルの古い位置に残る。 |
enum QDesignerFormWindowCursorInterface::MoveOperation
この列挙型は、フォームウィンドウで発生する可能性のあるテキストカーソル操作のタイプを記述します。
定数 | 値 | 説明 |
---|---|---|
QDesignerFormWindowCursorInterface::NoMove | 0 | カーソルは移動しません。 |
QDesignerFormWindowCursorInterface::Start | 1 | カーソルをフォーカスチェーンの先頭に移動する。 |
QDesignerFormWindowCursorInterface::End | 2 | カーソルをフォーカスチェーンの終端に移動する。 |
QDesignerFormWindowCursorInterface::Next | 3 | カーソルをフォーカスチェーンの次のウィジェットに移動する。 |
QDesignerFormWindowCursorInterface::Prev | 4 | カーソルをフォーカス・チェインの前のウィジェットに移動する。 |
QDesignerFormWindowCursorInterface::Left | 5 | カーソルが左に移動する。 |
QDesignerFormWindowCursorInterface::Right | 6 | カーソルが右に移動する。 |
QDesignerFormWindowCursorInterface::Up | 7 | カーソルが上方向に移動する。 |
QDesignerFormWindowCursorInterface::Down | 8 | カーソルは下方向に移動する。 |
メンバ関数ドキュメント
[virtual constexpr noexcept]
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 が選択されていれば真を返し、そうでなければ偽を返す。
[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)
指定されたwidget の指定されたname を持つプロパティを、指定されたvalue に設定します。
resetWidgetProperty() およびsetProperty()も参照 。
[pure virtual]
QWidget *QDesignerFormWindowCursorInterface::widget(int index) const
フォームウィンドウのウィジェットリストで、指定されたindex を持つウィジェットを返します。
selectedWidget()も参照してください 。
[pure virtual]
int QDesignerFormWindowCursorInterface::widgetCount() const
フォームウィンドウ内のウィジェットの数を返します。
selectedWidgetCount()も参照ください 。
© 2025 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.