QChartView Class

QChartViewは、チャートを表示できるスタンドアローンのウィジェットです。詳細...

Header: #include <QChartView>
Inherits: QGraphicsView

パブリック型

(since 6.2) enum RubberBand { NoRubberBand, VerticalRubberBand, HorizontalRubberBand, RectangleRubberBand, ClickThroughRubberBand }
flags RubberBands

パブリック関数

QChartView(QWidget *parent = nullptr)
QChartView(QChart *chart, QWidget *parent = nullptr)
virtual ~QChartView()
QChart *chart() const
QChartView::RubberBands rubberBand() const
void setChart(QChart *chart)
void setRubberBand(const QChartView::RubberBands &rubberBand)

再実装された保護された関数

virtual void mouseMoveEvent(QMouseEvent *event) override
virtual void mousePressEvent(QMouseEvent *event) override
virtual void mouseReleaseEvent(QMouseEvent *event) override
virtual void resizeEvent(QResizeEvent *event) override

詳細説明

チャート・ビューはQGraphicsScene オブジェクトを必要としません。既存のQGraphicsScene にチャートを表示するには、代わりにQChart またはQPolarChart クラスを使用する必要があります。

QChart およびQPolarChartも参照してください

メンバ型ドキュメント

[since 6.2] enum QChartView::RubberBand
flags QChartView::RubberBands

この列挙型は、矩形ズーム領域に適用可能な、異なるタイプのラバーバンド効果を記述します。

定数説明
QChartView::NoRubberBand0x0ズーム領域が指定されていないので、ズームは有効になりません。
QChartView::VerticalRubberBand0x1ラバーバンドは水平方向にはチャートのサイズに固定され、垂直方向に引っ張ることでズーム領域を指定できる。
QChartView::HorizontalRubberBand0x2ラバーバンドはチャートのサイズに垂直方向に固定され、水平方向に引っ張ってズーム領域を指定できる。
QChartView::RectangleRubberBand0x3ラバーバンドはクリックされたポイントに固定され、垂直方向にも水平方向にも引っ張ることができる。
QChartView::ClickThroughRubberBand0x80上記のラバーバンドの選択肢のオプションで、左クリックがチャート・アイテムに引き継がれ、そのチャート・アイテムがクリックを受け付ける場合、左クリックをチャート・アイテムに引き継ぐことができる。これを選択するには、ラバーバンド選択モードのいずれかと OR してください。

この列挙型は Qt 6.2 で導入されました。

RubberBands 型はQFlags<RubberBand> の typedef です。RubberBandsの値のORの組み合わせを格納します。

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

[explicit] QChartView::QChartView(QWidget *parent = nullptr)

チャートビューオブジェクトを親parent と共に構築します。

[explicit] QChartView::QChartView(QChart *chart, QWidget *parent = nullptr)

チャート・ビュー・オブジェクトを親parent で構築し、チャートchart を表示する。チャートの所有権はチャート・ビューに渡される。

[virtual noexcept] QChartView::~QChartView()

チャートビューオブジェクトと関連するチャートを削除します。

QChart *QChartView::chart() const

関連するチャートへのポインタを返します。

setChart()も参照

[override virtual protected] void QChartView::mouseMoveEvent(QMouseEvent *event)

再実装:QGraphicsView::mouseMoveEvent(QMouseEvent *event)。

event で指定された押下イベントでラバーバンドの矩形が表示された場合、そのイベントデータを使用してラバーバンドのジオメトリを更新します。そうでない場合は、デフォルトのQGraphicsView::mouseMoveEvent() 実装が呼び出されます。

[override virtual protected] void QChartView::mousePressEvent(QMouseEvent *event)

再実装:QGraphicsView::mousePressEvent(QMouseEvent *event)。

マウスの左ボタンが押され、ラバーバンドが有効になっている場合、イベントevent が受け付けられ、ラバーバンドが画面に表示されます。これにより、ユーザーはズーム領域を選択することができます。

他のマウス・ボタンが押されたり、ラバー・バンドが無効になっている場合、イベントはQGraphicsView::mousePressEvent() に渡されます。

[override virtual protected] void QChartView::mouseReleaseEvent(QMouseEvent *event)

再実装:QGraphicsView::mouseReleaseEvent(QMouseEvent *event)。

マウスの左ボタンが離され、ラバーバンドが有効になっている場合、イベントevent が受け付けられ、ビューはラバーバンドで指定された矩形にズームされます。マウスの右ボタンがイベントをトリガーした場合、ビューはズームアウトされます。

[override virtual protected] void QChartView::resizeEvent(QResizeEvent *event)

再実装:QGraphicsView::resizeEvent(QResizeEvent *event)。

event で指定されたデータを使用してチャート領域のサイズを変更し、更新します。

QChartView::RubberBands QChartView::rubberBand() const

チャートビューが現在使用しているラバーバンドフラグを返します。

setRubberBand()も参照

void QChartView::setChart(QChart *chart)

現在のチャートをchart に設定する。 新しいチャートの所有権がチャート・ビューに渡され、前のチャートの所有権は解放される。

メモリ・リークを避けるため、前のチャートは削除しなければならない。

chart()も参照

void QChartView::setRubberBand(const QChartView::RubberBands &rubberBand)

ラバーバンドフラグをrubberBand に設定します。 選択されたフラグによって、ズームの方法が決まります。

注意: ラバーバンドズームは極座標図には対応していません。

rubberBand()も参照

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