KDEUI
ktoolbar.cpp
Go to the documentation of this file.
79 nor config file that holds these settings. Hence the iconSizeSettings and toolButtonStyleSettings arrays.
83 Only if there are no settings at those levels, should the change of KDEDefault make a difference.
235 // KDE5: we can probably remove this, if people save settings then they load them too, e.g. using KMainWindow's autosave.
299 contextTop = contextOrient->addAction(i18nc("toolbar position string", "Top"), q, SLOT(slotContextTop()));
301 contextLeft = contextOrient->addAction(i18nc("toolbar position string", "Left"), q, SLOT(slotContextLeft()));
302 contextRight = contextOrient->addAction(i18nc("toolbar position string", "Right"), q, SLOT(slotContextRight()));
303 contextBottom = contextOrient->addAction(i18nc("toolbar position string", "Bottom"), q, SLOT(slotContextBottom()));
315 contextTextRight = contextMode->addAction(i18n("Text Alongside Icons"), q, SLOT(slotContextTextRight()));
316 contextTextUnder = contextMode->addAction(i18n("Text Under Icons"), q, SLOT(slotContextTextUnder()));
326 contextIconSizes.insert(contextSize->addAction(i18nc("@item:inmenu Icon size", "Default"), q, SLOT(slotContextIconSize())),
389 contextLockAction = new KToggleAction(KIcon("system-lock-screen"), i18n("Lock Toolbar Positions"), q);
526 toolButtonStyleSettings[Level_KDEDefault] = KToolBar::Private::toolButtonStyleFromString(value);
533 //kDebug() << q->objectName() << "iconSizeSettings:" << iconSizeSettings.toString() << "->" << iconSizeSettings.currentValue();
536 //kDebug() << q->objectName() << "toolButtonStyleSettings:" << toolButtonStyleSettings.toString() << "->" << toolButtonStyleSettings.currentValue();
537 q->setToolButtonStyle(static_cast<Qt::ToolButtonStyle>(toolButtonStyleSettings.currentValue()));
545 QAction *KToolBar::Private::findAction(const QString &actionName, KXMLGUIClient **clientOut) const
711 QDomElement actionElem = KXMLGUIFactory::findActionByName(elem, contextButtonAction->objectName(), true);
783 // others -> isMainToolBar = false -> ### hardcoded default for buttonStyle !!! should be configurable? -> hidden key added
833 cg.deleteEntry("Hidden"); // remove old key to avoid bugs from the compat code in applySettings. KDE5: remove.
837 //kDebug() << objectName() << currentIconSize << d->iconSizeSettings.toString() << "defaultValue=" << d->iconSizeSettings.defaultValue();
847 if (!cg.hasDefault("ToolButtonStyle") && currentToolButtonStyle == d->toolButtonStyleSettings.defaultValue()) {
897 return KToolBar::Private::toolButtonStyleFromString(group.readEntry("ToolButtonStyle", fallback));
959 d->toolButtonStyleSettings[Level_AppXML] = d->toolButtonStyleFromString(toolButtonStyleDefault);
983 d->toolButtonStyleSettings[loadingAppDefaults ? Level_AppXML : Level_UserSettings] = d->toolButtonStyleFromString(newToolButtonStyle);
1029 // Note: if this method is used by more than KXMLGUIBuilder, e.g. to save XML settings to *disk*,
1035 const Qt::ToolButtonStyle bs = static_cast<Qt::ToolButtonStyle>(d->toolButtonStyleSettings[Level_AppXML]);
1046 // a small leftover from kde3: separate bool for hidden/shown. But it's also part of saveMainWindowSettings,
1047 // it is not really useful anymore, except in the unlikely case where someone would call this by hand.
1062 d->toolButtonStyleSettings[Level_UserSettings] = d->toolButtonStyleFromString(cg.readEntry("ToolButtonStyle", QString()));
1081 return KIconLoader::global()->currentSize(d->isMainToolBar ? KIconLoader::MainToolbar : KIconLoader::Toolbar);
1226 if ((event->pos() - d->dragStartPosition).manhattanLength() < QApplication::startDragDistance()) {
1280 QCoreApplication::postEvent(this, new QContextMenuEvent(QContextMenuEvent::Mouse, me->pos(), me->globalPos()));
1300 if (event->type() == QEvent::MouseButtonPress || event->type() == QEvent::MouseButtonRelease) {
1322 if (event->type() == QEvent::Show || event->type() == QEvent::Paint || event->type() == QEvent::EnabledChange) {
1325 const QString text = KGlobal::locale()->removeAcceleratorMarker(act->iconText().isEmpty() ? act->text() : act->iconText());
QLayout * layout() const
QObject * child(const char *objName, const char *inheritsClass, bool recursiveSearch) const
QAction * toolBarMenuAction()
Returns a pointer to the mainwindows action responsible for the toolbars menu.
Definition: kxmlguiwindow.cpp:100
text
QString i18n(const char *text)
void setDown(bool)
void addToolBar(Qt::ToolBarArea area, QToolBar *toolbar)
virtual void mouseReleaseEvent(QMouseEvent *)
Definition: ktoolbar.cpp:1260
Definition: ktoolbar.cpp:85
Type type() const
virtual QLayoutItem * itemAt(int index) const =0
virtual void dropEvent(QDropEvent *event)
int currentSize(KIconLoader::Group group) const
Returns the current size of the icon group.
Definition: kiconloader.cpp:1370
bool isHidden() const
void setSettingsDirty()
Tell the main window that it should save its settings when being closed.
Definition: kmainwindow.cpp:991
int width() const
static void setToolBarsLocked(bool locked)
Allows you to lock and unlock all toolbars (i.e., disallow/allow moving of the toobars).
Definition: ktoolbar.cpp:1417
virtual KActionCollection * actionCollection() const
Retrieves the entire action collection for the GUI client.
Definition: kxmlguiclient.cpp:128
const QMimeData * mimeData() const
Qt::KeyboardModifiers keyboardModifiers()
A KXMLGUIClient can be used with KXMLGUIFactory to create a GUI from actions and an XML document...
Definition: kxmlguiclient.h:46
void setAlignment(QFlags< Qt::AlignmentFlag > alignment)
void setMimeData(QMimeData *data)
Qt::DropAction start(QFlags< Qt::DropAction > request)
static KIconLoader * global()
Returns the global icon loader initialized with the global KComponentData.
Qt::DropAction proposedAction() const
QString attribute(const QString &name, const QString &defValue) const
void saveSettings(KConfigGroup &cg)
Save the toolbar settings to group configGroup in config.
Definition: ktoolbar.cpp:828
virtual bool hasFormat(const QString &mimeType) const
bool hasDefault(const QString &key) const
iconText
Definition: ktoolbar.cpp:85
QStyle * style() const
virtual void dragLeaveEvent(QDragLeaveEvent *event)
bool isElement() const
Definition: ktoolbar.cpp:85
virtual void dragEnterEvent(QDragEnterEvent *event)
static const QList< KActionCollection * > & allCollections()
Access the list of all action collections in existence for this app.
Definition: kactioncollection.cpp:695
void setVisible(bool)
#define KDE_NO_DEPRECATED
QAction * actionAt(const QPoint &p) const
const QPoint & pos() const
bool isEmpty() const
virtual void setVisible(bool visible)
const char * name(StandardAction id)
This will return the internal name of a given standard action.
Definition: kstandardaction.cpp:223
void addToolBarBreak(Qt::ToolBarArea area)
bool isAncestorOf(const QWidget *child) const
void writeEntry(const QString &key, const QVariant &value, WriteConfigFlags pFlags=Normal)
virtual void slotMovableChanged(bool movable)
Definition: ktoolbar.cpp:1084
virtual QString xmlFile() const
This will return the name of the XML file as set by setXMLFile().
Definition: kxmlguiclient.cpp:154
virtual void dragMoveEvent(QDragMoveEvent *event)
Qt::MouseButtons buttons() const
int iconSizeDefault() const
Returns the default size for this type of toolbar.
Definition: ktoolbar.cpp:1079
static KGlobalSettings * self()
Return the KGlobalSettings singleton.
Definition: kglobalsettings.cpp:188
virtual void mouseReleaseEvent(QMouseEvent *event)
static void setToolBarsEditable(bool editable)
Enable or disable toolbar editing via drag & drop of actions.
Definition: ktoolbar.cpp:1410
int x() const
toolTip
QString i18nc(const char *ctxt, const char *text)
KSharedConfigPtr config()
QList< int > querySizes(KIconLoader::Group group) const
Query available sizes for a group.
Definition: kicontheme.cpp:330
void removeXMLGUIClient(KXMLGUIClient *client)
Removes an XML gui client that uses this toolbar.
Definition: ktoolbar.cpp:869
Qt::ToolButtonStyle toolButtonStyle() const
bool eventFilter(QObject *watched, QEvent *event)
Reimplemented to support context menu activation on disabled tool buttons.
Definition: ktoolbar.cpp:1272
int indexOf(const T &value, int from) const
QAction * action() const
int width() const
virtual int indexOf(QWidget *widget) const
QDomElement toElement() const
void deleteEntry(const QString &pKey, WriteConfigFlags pFlags=Normal)
QList< T > findChildren(const QString &name) const
QSize size() const
void insertAction(QAction *before, QAction *action)
QString number(int n, int base)
int count(const T &value) const
const QPoint & globalPos() const
virtual void contextMenuEvent(QContextMenuEvent *event)
bool isSeparator() const
void installEventFilter(QObject *filterObj)
QString text() const
virtual void mousePressEvent(QMouseEvent *event)
bool hasAttribute(const QString &name) const
virtual KComponentData componentData() const
Definition: kxmlguiclient.cpp:144
QWidget * target() const
Item next()
void setAttribute(const QString &name, const QString &value)
QWidget * widgetForAction(QAction *action) const
void setupToolbarMenuActions()
Definition: kxmlguiwindow.cpp:110
Qt::MouseButton button() const
Definition: ktoolbar.cpp:86
int toInt(bool *ok, int base) const
bool isEmpty() const
typedef ToolBarAreas
void setObjectName(const QString &name)
void setMovable(bool movable)
virtual void mouseMoveEvent(QMouseEvent *event)
bool isEmpty() const
static QString readConfigFile(const QString &filename, const KComponentData &componentData=KComponentData())
Definition: kxmlguifactory.cpp:117
QString trimmed() const
const char * constData() const
void setIconDimensions(int size)
Convenience function to set icon size.
Definition: ktoolbar.cpp:1073
void setContextMenuEnabled(bool enable=true)
This allows you to enable or disable the context menu.
Definition: ktoolbar.cpp:815
QPoint pos() const
virtual bool eventFilter(QObject *watched, QEvent *event)
T & first()
QString componentName() const
void hide()
const Key & key() const
const T & value() const
sizePolicy
Qt::KeyboardModifiers modifiers() const
QString toLower() const
QAction * insertWidget(QAction *before, QWidget *widget)
QDomNode namedItem(const QString &name) const
void applySettings(const KConfigGroup &cg, bool forceGlobal=false)
Read the toolbar settings from group configGroup in config and apply them.
Definition: ktoolbar.cpp:1041
QString name() const
void setCheckable(bool)
bool invokeMethod(QObject *obj, const char *member, Qt::ConnectionType type, QGenericReturnArgument ret, QGenericArgument val0, QGenericArgument val1, QGenericArgument val2, QGenericArgument val3, QGenericArgument val4, QGenericArgument val5, QGenericArgument val6, QGenericArgument val7, QGenericArgument val8, QGenericArgument val9)
bool hasKey(const QString &key) const
void addXMLGUIClient(KXMLGUIClient *client)
Adds an XML gui client that uses this toolbar.
Definition: ktoolbar.cpp:864
bool isNull() const
KLocale * locale()
KToolBar(QWidget *parent, bool isMainToolBar=false, bool readConfig=true)
Constructor.
Definition: ktoolbar.cpp:766
QString removeAcceleratorMarker(const QString &label) const
static Qt::ToolButtonStyle toolButtonStyleSetting()
Returns the global setting for "Icon Text" for the main toolbar.
Definition: ktoolbar.cpp:893
static void setGlobalDefaultToolBar(const char *toolBarName)
Sets the default toolbar which will be auto-selected for all KEditToolBar instances.
Definition: kedittoolbar.cpp:689
QByteArray toLatin1() const
typedef MouseButtons
char * toString(const T &value)
virtual bool event(QEvent *event)
void insertToolBarBreak(QToolBar *before)
void setActionGroup(QActionGroup *group)
QPoint mapFromGlobal(const QPoint &pos) const
void setWindowTitle(const QString &)
void removeAction(QAction *action)
QList< QWidget * > associatedWidgets() const
const KComponentData & mainComponent()
char * data()
void setText(const QString &text)
bool authorize(const QString &genericAction)
QAction * action(int index) const
Return the QAction* at position "index" in the action collection.
Definition: kactioncollection.cpp:141
static bool toolBarsEditable()
Returns whether the toolbars are currently editable (drag & drop of actions).
Definition: ktoolbar.cpp:1405
QSize iconSize() const
void removeAttribute(const QString &name)
void show()
void setData(const QString &mimeType, const QByteArray &data)
KMainWindow * mainWindow() const
Returns the main window that this toolbar is docked with.
Definition: ktoolbar.cpp:1068
const QPoint & pos() const
QString toolTip() const
void postEvent(QObject *receiver, QEvent *event)
QList< QAction * > actions() const
QObject * parent() const
Definition: ktoolbar.cpp:87
static bool saveConfigFile(const QDomDocument &doc, const QString &filename, const KComponentData &componentData=KComponentData())
Definition: kxmlguifactory.cpp:142
Definition: kicontheme.h:46
T readEntry(const QString &key, const T &aDefault) const
QAction * defaultAction() const
void revertToDefault(const QString &key)
static QDomElement actionPropertiesElement(QDomDocument &doc)
Definition: kxmlguifactory.cpp:769
bool isEnabled() const
void removeEventFilter(QObject *obj)
int height() const
static QDomElement findActionByName(QDomElement &elem, const QString &sName, bool create)
Definition: kxmlguifactory.cpp:783
static QList< KMainWindow * > memberList()
List of members of KMainWindow class.
Definition: kmainwindow.cpp:1218
bool hasNext() const
static bool toolBarsLocked()
Returns whether the toolbars are locked (i.e., moving of the toobars disallowed). ...
Definition: ktoolbar.cpp:1430
Qt::Orientation orientation() const
int startDragDistance()
virtual void contextMenuEvent(QContextMenuEvent *)
Definition: ktoolbar.cpp:874
bool setContent(const QByteArray &data, bool namespaceProcessing, QString *errorMsg, int *errorLine, int *errorColumn)
QString defaultValue(const QString &t)
typedef KeyboardModifiers
virtual void actionEvent(QActionEvent *event)
QByteArray toUtf8() const
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2020 The KDE developers.
Generated on Mon Jun 22 2020 13:24:00 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.