Button QML Type

クリックすることでコマンドを実行したり、質問に答えたりできる押しボタン。詳細...

Import Statement: import QtQuick.Controls
Inherits:

AbstractButton

Inherited By:

RoundButton and ToolButton

プロパティ

詳細説明

ボタンは、ユーザーが押したりクリックしたりできる押しボタンコントロールを示します。ボタンは通常、アクションを実行したり、質問に答えたりするために使用されます。典型的なボタンは、OKApplyCancelCloseYesNoHelpです。

ボタンはそのAPIをAbstractButton から継承しています。例えば、text を設定し、アイコンを表示し、AbstractButton API を使ってclicks に反応することができます。

ボタンは、ユーザーによってアクティブにされると、シグナルclicked() を発します。このシグナルに接続すると、ボタンのアクションが実行されます。ボタンはまた、長押し用のシグナルcanceled ()、doubleClicked ()、pressed ()、released ()、pressAndHold ()を提供します。

ボタンのシグナルに接続する方法については、以下のスニペットを参照してください。

RowLayout {
    Button {
        text: "Ok"
        onClicked: model.submit()
    }
    Button {
        text: "Cancel"
        onClicked: model.revert()
    }
}

ボタンと ボタンコントロールのカスタマイズも参照してください

プロパティの説明

flat : bool

このプロパティは、ボタンがフラットであるかどうかを保持します。

フラットボタンは通常、押されるかチェックされない限り背景を描画しません。

デフォルト値はfalse です。


highlighted : bool

このプロパティは、ボタンがハイライトされているかどうかを保持します。

ボタンは、ユーザーの注意を引くために強調表示することができます。キーボードインタラクションには影響しません。

デフォルト値はfalse です。


© 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.