17#include <QtDesigner/abstractformeditor.h>
18#include <QtDesigner/abstractpropertyeditor.h>
19#include <QtDesigner/propertysheet.h>
20#include <QtDesigner/qextensionmanager.h>
21#include <QtDesigner/abstractmetadatabase.h>
22#include <QtDesigner/abstractsettings.h>
24#include <QtWidgets/qmenu.h>
25#include <QtWidgets/qtoolbar.h>
26#include <QtWidgets/qsplitter.h>
27#include <QtWidgets/qapplication.h>
28#if QT_CONFIG(clipboard)
29#include <QtGui/qclipboard.h>
31#include <QtWidgets/qitemdelegate.h>
32#include <QtWidgets/qboxlayout.h>
33#include <QtWidgets/qlineedit.h>
34#include <QtWidgets/qlabel.h>
35#include <QtWidgets/qpushbutton.h>
36#include <QtWidgets/qtoolbutton.h>
38#include <QtGui/qaction.h>
39#include <QtGui/qactiongroup.h>
40#include <QtGui/qevent.h>
41#include <QtGui/qpainter.h>
43#include <QtCore/qitemselectionmodel.h>
44#include <QtCore/qregularexpression.h>
45#include <QtCore/qdebug.h>
46#include <QtCore/qbuffer.h>
50using namespace Qt::StringLiterals;
70 void paint(
QPainter *painter,
const QStyleOptionViewItem &option,
const QModelIndex &index)
const override
72 if (option.state & QStyle::State_Selected)
73 painter->fillRect(option.rect, option.palette.highlight());
75 QItemDelegate::paint(painter, option, index);
92#if QT_CONFIG(clipboard)
126#if QT_CONFIG(clipboard)
153 "editdelete.png"_L1);
284#if QT_CONFIG(clipboard)
314#if QT_CONFIG(clipboard)
392 sheet->setChanged(sheet->indexOf(iconPropertyC), !action->icon().isNull());
427 const int index = sheet->indexOf(name);
428 Q_ASSERT(index != -1);
429 sheet->setProperty(index, value);
430 sheet->setChanged(index,
true);
469static QDesignerFormWindowCommand *
setIconPropertyCommand(
const PropertySheetIconValue &newIcon, QAction *action, QDesignerFormWindowInterface *fw)
471 const QString iconProperty = iconPropertyC;
472 if (newIcon.isEmpty()) {
473 ResetPropertyCommand *cmd =
new ResetPropertyCommand(fw);
474 cmd->init(action, iconProperty);
477 SetPropertyCommand *cmd =
new SetPropertyCommand(fw);
478 cmd->init(action, iconProperty, QVariant::fromValue(newIcon));
487 const QString shortcutProperty = shortcutPropertyC;
488 if (ks.value().isEmpty()) {
489 ResetPropertyCommand *cmd =
new ResetPropertyCommand(fw);
490 cmd->init(action, shortcutProperty);
493 SetPropertyCommand *cmd =
new SetPropertyCommand(fw);
494 cmd->init(action, shortcutProperty, QVariant::fromValue(ks));
503 QObject *o, QDesignerFormWindowInterface *fw)
505 if (value == defaultValue) {
506 ResetPropertyCommand *cmd =
new ResetPropertyCommand(fw);
510 SetPropertyCommand *cmd =
new SetPropertyCommand(fw);
511 cmd->init(o, name, QVariant(value));
518 const int index = sheet->indexOf(name);
519 Q_ASSERT(index != -1);
626 :
tr(
"Remove actions");
636#if QT_CONFIG(clipboard)
676 static const QRegularExpression nonAsciiPattern(u"[^a-zA-Z_0-9]"_s);
677 Q_ASSERT(nonAsciiPattern.isValid());
678 text.replace(nonAsciiPattern,
"_"_L1);
679 static const QRegularExpression multipleSpacePattern(u"__*"_s);
680 Q_ASSERT(multipleSpacePattern.isValid());
681 text.replace(multipleSpacePattern,
"_"_L1);
682 if (text.endsWith(u'_'))
696 const ushort uc = c.unicode();
697 return (uc >=
'a' && uc <=
'z') || (uc >=
'A' && uc <=
'Z')
706 result.reserve(text.size());
707 bool lastCharAccepted =
false;
708 for (QChar c : text) {
709 const CharacterCategory cat = category(c);
710 if (cat != NonAsciiLetter) {
711 const bool acceptable = cat == DigitOrAsciiLetter;
713 result.append(lastCharAccepted ? c : c.toUpper());
714 lastCharAccepted = acceptable;
816#if QT_CONFIG(clipboard)
876#if QT_CONFIG(clipboard)
static constexpr auto toolTipPropertyC
static constexpr auto iconPropertyC
static constexpr auto textPropertyC
static constexpr auto shortcutPropertyC
static constexpr auto menuRolePropertyC
static constexpr auto actionEditorViewModeKey
static constexpr auto objectNamePropertyC
static constexpr auto checkablePropertyC
void drawFocus(QPainter *, const QStyleOptionViewItem &, const QRect &) const override
Renders the region within the rectangle specified by rect, indicating that it has the focus,...
void paint(QPainter *painter, const QStyleOptionViewItem &option, const QModelIndex &index) const override
This pure abstract function must be reimplemented if you want to provide custom rendering.
ActionGroupDelegate(QObject *parent)
Combined button and popup list for selecting options.
Auxiliary methods to store/retrieve settings.
static QDesignerFormWindowCommand * setKeySequencePropertyCommand(const PropertySheetKeySequenceValue &ks, QAction *action, QDesignerFormWindowInterface *fw)
static CharacterCategory category(QChar c)
static QDesignerFormWindowCommand * setIconPropertyCommand(const PropertySheetIconValue &newIcon, QAction *action, QDesignerFormWindowInterface *fw)
static void setInitialProperty(QDesignerPropertySheetExtension *sheet, const QString &name, const QVariant &value)
static void refreshIconPropertyChanged(const QAction *action, QDesignerPropertySheetExtension *sheet)
static QString underscore(QString text)
static QString textPropertyValue(const QDesignerPropertySheetExtension *sheet, const QString &name)
static QString camelCase(const QString &text)
QDesignerFormWindowCommand * setPropertyCommand(const QString &name, T value, T defaultValue, QObject *o, QDesignerFormWindowInterface *fw)