4#ifndef ACTIONPROVIDER_H
5#define ACTIONPROVIDER_H
18#include <QtDesigner/extension.h>
19#include <QtCore/qpoint.h>
20#include <QtCore/qrect.h>
21#include <QtWidgets/qapplication.h>
33 virtual QAction *
actionAt(
const QPoint &pos)
const = 0;
41template <
class Widget>
42 int actionIndexAt(
const Widget *w,
const QPoint &pos, Qt::Orientation orientation)
44 const auto actions = w->actions();
45 if (actions.isEmpty())
50 const bool checkTopRight = orientation == Qt::Horizontal && w->layoutDirection() == Qt::RightToLeft;
51 const QPoint topRight = QPoint(w->rect().width(), 0);
52 for (qsizetype index = 0, actionCount = actions.size(); index < actionCount; ++index) {
53 QRect g = w->actionGeometry(actions.at(index));
55 g.setTopRight(topRight);
57 g.setTopLeft(QPoint(0, 0));
65Q_DECLARE_EXTENSION_INTERFACE(QDesignerActionProviderExtension,
"org.qt-project.Qt.Designer.ActionProvider")
int actionIndexAt(const Widget *w, const QPoint &pos, Qt::Orientation orientation)
virtual ~QDesignerActionProviderExtension()=default
virtual QRect actionGeometry(QAction *action) const =0
virtual QAction * actionAt(const QPoint &pos) const =0
virtual void adjustIndicator(const QPoint &pos)=0
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
static QRect verticalIndicatorRect(const QRect &rect)
static QRect horizontalIndicatorRect(const QRect &rect, Qt::LayoutDirection layoutDirection)