Pages
API Documentation
On this page

KXYSelector Class

Base class for other widgets which provides the ability to choose from a two-dimensional range of values. More...

  • Header: #include <KXYSelector>
  • CMake: find_package(KF6 REQUIRED COMPONENTS WidgetsAddons)
    target_link_libraries(mytarget PRIVATE KF6::WidgetsAddons)
  • Inherits: QWidget

List of all members, including inherited members

Properties

Public Functions

Signals

Protected Functions

Detailed Description

The currently chosen value is indicated by a cross. An example is the KHSSelector which allows to choose from a range of colors, and which is used in KColorDialog.

A custom drawing routine for the widget surface has to be provided by the subclass.

Property Documentation

xValue : int

Access functions:

yValue : int

Access functions:

Member Function Documentation

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

Constructs a two-dimensional selector widget which has a value range of [0..100] in both directions.

QRect KXYSelector::contentsRect() const

Returns the rectangle on which subclasses should draw.

[virtual protected] void KXYSelector::drawContents(QPainter *)

Override this function to draw the contents of the widget. The default implementation does nothing.

Draw within contentsRect() only.

[virtual protected] void KXYSelector::drawMarker(QPainter *p, int xp, int yp)

Override this function to draw the marker which indicates the currently selected value pair.

void KXYSelector::setMarkerColor(const QColor &col)

Sets the color used to draw the marker

col the color

void KXYSelector::setRange(int minX, int minY, int maxX, int maxY)

Sets the range of possible values.

void KXYSelector::setValues(int xPos, int yPos)

Sets the current values in horizontal and vertical direction.

xPos the horizontal value

yPos the vertical value

void KXYSelector::setXValue(int xPos)

Sets the current horizontal value

xPos the horizontal value

Note: Setter function for property xValue.

See also xValue()

void KXYSelector::setYValue(int yPos)

Sets the current vertical value

yPos the vertical value

Note: Setter function for property yValue.

See also yValue()

[signal] void KXYSelector::valueChanged(int x, int y)

This signal is emitted whenever the user chooses a value, e.g. by clicking with the mouse on the widget.

[protected] void KXYSelector::valuesFromPosition(int x, int y, int &xVal, int &yVal) const

Converts a pixel position to its corresponding values.

int KXYSelector::xValue() const

Returns the current value in horizontal direction.

Note: Getter function for property xValue.

See also setXValue()

int KXYSelector::yValue() const

Returns the current value in vertical direction.

Note: Getter function for property yValue.

See also setYValue()

We use cookies to personalize content and to analyze our traffic. Please decide if you are willing to accept cookies from our website.