KXmlGui
ktoolbar.cpp
72 nor config file that holds these settings. Hence the iconSizeSettings and toolButtonStyleSettings arrays.
76 Only if there are no settings at those levels, should the change of KDEDefault make a difference.
245 QObject::connect(q, &QToolBar::allowedAreasChanged, q->mainWindow(), &KMainWindow::setSettingsDirty);
246 QObject::connect(q, &QToolBar::iconSizeChanged, q->mainWindow(), &KMainWindow::setSettingsDirty);
247 QObject::connect(q, &QToolBar::toolButtonStyleChanged, q->mainWindow(), &KMainWindow::setSettingsDirty);
248 QObject::connect(q, &QToolBar::movableChanged, q->mainWindow(), &KMainWindow::setSettingsDirty);
249 QObject::connect(q, &QToolBar::orientationChanged, q->mainWindow(), &KMainWindow::setSettingsDirty);
258 q->toggleViewAction()->setEnabled(KAuthorized::authorizeAction(QStringLiteral("options_show_toolbar")));
266 .connect(QString(), QStringLiteral("/KToolBar"), QStringLiteral("org.kde.KToolBar"), QStringLiteral("styleChanged"), q, SLOT(slotAppearanceChanged()));
315 contextRight = contextOrient->addAction(i18nc("toolbar position string", "Right"), q, [this]() {
318 contextBottom = contextOrient->addAction(i18nc("toolbar position string", "Bottom"), q, [this]() {
337 contextTextRight = contextMode->addAction(i18nc("@item:inmenu", "Text Alongside Icons"), q, [this]() {
340 contextTextUnder = contextMode->addAction(i18nc("@item:inmenu", "Text Under Icons"), q, [this]() {
429 contextLockAction = new KToggleAction(QIcon::fromTheme(QStringLiteral("system-lock-screen")), i18n("Lock Toolbar Positions"), q);
461 if (auto *contextToolButton = qobject_cast<QToolButton *>(q->widgetForAction(contextButtonAction))) {
462 if (contextToolButton->popupMode() == QToolButton::DelayedPopup || contextToolButton->popupMode() == QToolButton::MenuButtonPopup) {
538 } else if (style == QLatin1String("textundericon") || style == QLatin1String("icontextbottom")) {
587 const QString fallback = KToolBarPrivate::toolButtonStyleToString(Qt::ToolButtonTextBesideIcon);
588 return KToolBarPrivate::toolButtonStyleFromString(group.readEntry("ToolButtonStyle", fallback));
623 // qCDebug(DEBUG_KXMLGUI) << q->objectName() << "iconSizeSettings:" << iconSizeSettings.toString() << "->" << iconSizeSettings.currentValue();
626 // qCDebug(DEBUG_KXMLGUI) << q->objectName() << "toolButtonStyleSettings:" << toolButtonStyleSettings.toString() << "->" <<
628 q->setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(toolButtonStyleSettings.currentValue()));
658 * Another way would be to keep around the actions and plug them all into a (new each time) popupmenu.
684 const bool hasAssociatedWidgets = std::any_of(associatedObjects.cbegin(), associatedObjects.cend(), [](QObject *object) {
712 auto it = std::find_if(m_contextIconSizes.cbegin(), m_contextIconSizes.cend(), [this](const ContextIconInfo &info) {
753 const int associatedWidgetsCount = std::count_if(associatedObjects.cbegin(), associatedObjects.cend(), [](QObject *object) {
790 const QAction::Priority priority = contextShowText->isChecked() ? QAction::NormalPriority : QAction::LowPriority;
812 QDomElement actionElem = KXMLGUIFactory::findActionByName(elem, contextButtonAction->objectName(), true);
854 auto it = std::find_if(m_contextIconSizes.cbegin(), m_contextIconSizes.cend(), [action](const ContextIconInfo &info) {
895KToolBar::KToolBar(const QString &objectName, QMainWindow *parent, Qt::ToolBarArea area, bool newLine, bool isMainToolBar, bool readConfig)
923 // qCDebug(DEBUG_KXMLGUI) << objectName() << currentIconSize << d->iconSizeSettings.toString() << "defaultValue=" << d->iconSizeSettings.defaultValue();
933 if (!cg.hasDefault("ToolButtonStyle") && currentToolButtonStyle == d->toolButtonStyleSettings.defaultValue()) {
1003 const QString toolButtonStyleDefault = element.attribute(QStringLiteral("toolButtonStyleDefault"));
1005 d->toolButtonStyleSettings[Level_AppXML] = d->toolButtonStyleFromString(toolButtonStyleDefault);
1070 current.setAttribute(QStringLiteral("hidden"), isHidden() ? QStringLiteral("true") : QStringLiteral("false"));
1082 current.setAttribute(QStringLiteral("iconText"), d->toolButtonStyleToString(toolButtonStyle()));
1085 // Note: if this method is used by more than KXMLGUIBuilder, e.g. to save XML settings to *disk*,
1091 const Qt::ToolButtonStyle bs = static_cast<Qt::ToolButtonStyle>(d->toolButtonStyleSettings[Level_AppXML]);
1092 current.setAttribute(QStringLiteral("toolButtonStyleDefault"), d->toolButtonStyleToString(bs));
1124 return KIconLoader::global()->currentSize(d->isMainToolBar ? KIconLoader::MainToolbar : KIconLoader::Toolbar);
1277 if ((event->position().toPoint() - d->dragStartPosition).manhattanLength() < QApplication::startDragDistance()) {
1334 new QContextMenuEvent(QContextMenuEvent::Mouse, me->position().toPoint(), me->globalPosition().toPoint()));
1475 QDBusMessage message = QDBusMessage::createSignal(QStringLiteral("/KToolBar"), QStringLiteral("org.kde.KToolBar"), QStringLiteral("styleChanged"));
static const QList< KActionCollection * > & allCollections()
Access the list of all action collections in existence for this app.
Definition kactioncollection.cpp:816
QAction * action(int index) const
Return the QAction* at position index in the action collection.
Definition kactioncollection.cpp:203
static Q_INVOKABLE bool authorize(const QString &action)
static Q_INVOKABLE bool authorizeAction(const QString &action)
QString name() const
void revertToDefault(const char *key, WriteConfigFlags pFlag=WriteConfigFlags())
bool hasDefault(const char *key) const
bool hasKey(const char *key) const
void writeEntry(const char *key, const char *value, WriteConfigFlags pFlags=Normal)
QString readEntry(const char *key, const char *aDefault=nullptr) const
static void setGlobalDefaultToolBar(const QString &toolBarName)
Sets the default toolbar which will be auto-selected for all KEditToolBar instances.
Definition kedittoolbar.cpp:760
MainToolbar
Toolbar
int currentSize(KIconLoader::Group group) const
static KIconLoader * global()
KIconTheme * theme() const
void iconLoaderSettingsChanged()
QList< int > querySizes(KIconLoader::Group group) const
void setSettingsDirty()
Tell the main window that it should save its settings when being closed.
Definition kmainwindow.cpp:750
static void emitToolbarStyleChanged()
Emits a D-Bus signal to tell all toolbars in all applications, that the user settings have changed.
Definition ktoolbar.cpp:1472
void addXMLGUIClient(KXMLGUIClient *client)
Adds an XML gui client that uses this toolbar.
Definition ktoolbar.cpp:942
static bool toolBarsEditable()
Returns whether the toolbars are currently editable (drag & drop of actions).
Definition ktoolbar.cpp:1440
static bool toolBarsLocked()
Returns whether the toolbars are locked (i.e., moving of the toobars disallowed).
Definition ktoolbar.cpp:1467
static void setToolBarsEditable(bool editable)
Enable or disable toolbar editing via drag & drop of actions.
Definition ktoolbar.cpp:1445
void applySettings(const KConfigGroup &cg)
Read the toolbar settings from group cg and apply them.
Definition ktoolbar.cpp:1097
KMainWindow * mainWindow() const
Returns the main window that this toolbar is docked with.
Definition ktoolbar.cpp:1111
static void setToolBarsLocked(bool locked)
Allows you to lock and unlock all toolbars (i.e., disallow/allow moving of the toobars).
Definition ktoolbar.cpp:1452
bool eventFilter(QObject *watched, QEvent *event) override
Reimplemented to support context menu activation on disabled tool buttons.
Definition ktoolbar.cpp:1325
KToolBar(QWidget *parent, bool isMainToolBar=false, bool readConfig=true)
Constructor.
Definition ktoolbar.cpp:868
void removeXMLGUIClient(KXMLGUIClient *client)
Removes an XML gui client that uses this toolbar.
Definition ktoolbar.cpp:947
void saveSettings(KConfigGroup &cg)
Save the toolbar settings to group cg.
Definition ktoolbar.cpp:918
int iconSizeDefault() const
Returns the default size for this type of toolbar.
Definition ktoolbar.cpp:1122
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document,...
Definition kxmlguiclient.h:40
virtual QString xmlFile() const
This will return the name of the XML file as set by setXMLFile().
Definition kxmlguiclient.cpp:139
virtual KActionCollection * actionCollection() const
Retrieves the entire action collection for the GUI client.
Definition kxmlguiclient.cpp:115
static QString readConfigFile(const QString &filename, const QString &componentName=QString())
Definition kxmlguifactory.cpp:96
static bool saveConfigFile(const QDomDocument &doc, const QString &filename, const QString &componentName=QString())
Definition kxmlguifactory.cpp:122
static QDomElement actionPropertiesElement(QDomDocument &doc)
Definition kxmlguifactory.cpp:700
static QDomElement findActionByName(QDomElement &elem, const QString &sName, bool create)
Definition kxmlguifactory.cpp:714
KMainWindow with convenience functions and integration with XmlGui files.
Definition kxmlguiwindow.h:88
void setupToolbarMenuActions()
Definition kxmlguiwindow.cpp:205
QString i18nc(const char *context, const char *text, const TYPE &arg...)
QString i18n(const char *text, const TYPE &arg...)
QStringView level(QStringView ifopt)
QString name(StandardAction id)
ConfigureToolbars
NormalPriority
QList< QObject * > associatedObjects() const const
void setCheckable(bool)
void setChecked(bool)
void setEnabled(bool)
void setIcon(const QIcon &icon)
bool isSeparator() const const
priority
void setText(const QString &text)
void toggled(bool checked)
void triggered(bool checked)
void setVisible(bool)
startDragDistance
char * data()
applicationName
void postEvent(QObject *receiver, QEvent *event, int priority)
bool connect(const QString &service, const QString &path, const QString &interface, const QString &name, QObject *receiver, const char *slot)
bool send(const QDBusMessage &message) const const
QDBusConnection sessionBus()
QDBusMessage createSignal(const QString &path, const QString &interface, const QString &name)
ParseResult setContent(QAnyStringView text, ParseOptions options)
QString attribute(const QString &name, const QString &defValue) const const
bool hasAttribute(const QString &name) const const
void removeAttribute(const QString &name)
void setAttribute(const QString &name, const QString &value)
bool isNull() const const
Qt::DropAction exec(Qt::DropActions supportedActions)
void setMimeData(QMimeData *data)
QObject * target() const const
MouseButtonPress
Type type() const const
VLine
void setFrameShape(Shape)
void setLineWidth(int)
QIcon fromTheme(const QString &name)
Qt::KeyboardModifiers modifiers() const const
WriteOnly
virtual int indexOf(const QLayoutItem *layoutItem) const const
virtual QLayoutItem * itemAt(int index) const const=0
void setAlignment(Qt::Alignment alignment)
const_reference at(qsizetype i) const const
iterator begin()
const_iterator cbegin() const const
const_iterator cend() const const
qsizetype count() const const
iterator end()
qsizetype indexOf(const AT &value, qsizetype from) const const
QToolBar * addToolBar(const QString &title)
void addToolBarBreak(Qt::ToolBarArea area)
void insertToolBarBreak(QToolBar *before)
Qt::ToolBarArea toolBarArea(const QToolBar *toolbar) const const
void setData(const QString &mimeType, const QByteArray &data)
const QObjectList & children() const const
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
virtual bool eventFilter(QObject *watched, QEvent *event)
QList< T > findChildren(Qt::FindChildOptions options) const const
void installEventFilter(QObject *filterObj)
objectName
QObject * parent() const const
T qobject_cast(QObject *object)
void removeEventFilter(QObject *obj)
void setObjectName(QAnyStringView name)
QPoint toPoint() const const
Qt::MouseButton button() const const
Qt::MouseButtons buttons() const const
QPointF globalPosition() const const
QPointF position() const const
GrowFlag
bool isEmpty() const const
QString number(double n, char format, int precision)
int toInt(bool *ok, int base) const const
QString toLower() const const
QString trimmed() const const
AlignJustify
CopyAction
Unset
LeftButton
Vertical
ToolBarArea
ToolButtonStyle
WA_DeleteOnClose
QAction * actionAt(const QPoint &p) const const
virtual void actionEvent(QActionEvent *event) override
void allowedAreasChanged(Qt::ToolBarAreas allowedAreas)
virtual bool event(QEvent *event) override
void setIconSize(const QSize &iconSize)
void iconSizeChanged(const QSize &iconSize)
QAction * insertWidget(QAction *before, QWidget *widget)
void setMovable(bool movable)
void movableChanged(bool movable)
orientation
void orientationChanged(Qt::Orientation orientation)
QAction * toggleViewAction() const const
void setToolButtonStyle(Qt::ToolButtonStyle toolButtonStyle)
void toolButtonStyleChanged(Qt::ToolButtonStyle toolButtonStyle)
QWidget * widgetForAction(QAction *action) const const
DelayedPopup
void setAcceptDrops(bool on)
QList< QAction * > actions() const const
virtual void contextMenuEvent(QContextMenuEvent *event)
virtual void dragEnterEvent(QDragEnterEvent *event)
virtual void dragLeaveEvent(QDragLeaveEvent *event)
virtual void dragMoveEvent(QDragMoveEvent *event)
virtual void dropEvent(QDropEvent *event)
height
void insertAction(QAction *before, QAction *action)
bool isAncestorOf(const QWidget *child) const const
bool isHidden() const const
QLayout * layout() const const
QPoint mapFromGlobal(const QPoint &pos) const const
virtual void mouseMoveEvent(QMouseEvent *event)
virtual void mousePressEvent(QMouseEvent *event)
virtual void mouseReleaseEvent(QMouseEvent *event)
pos
void removeAction(QAction *action)
void setAttribute(Qt::WidgetAttribute attribute, bool on)
size
sizePolicy
virtual void setVisible(bool visible)
width
void setWindowTitle(const QString &)
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:02:25 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.