Krita Source Code Documentation
Loading...
Searching...
No Matches
KisKEditToolBar Class Reference

A dialog used to customize or configure toolbars. More...

#include <kedittoolbar.h>

+ Inheritance diagram for KisKEditToolBar:

Signals

void newToolBarConfig ()
 
QT_MOC_COMPAT void newToolbarConfig ()
 

Public Member Functions

 KisKEditToolBar (KisKXMLGUIFactory *factory, QWidget *parent=0)
 
void setDefaultToolBar (const QString &toolBarName)
 
void setResourceFile (const QString &file, bool global=true)
 
 ~KisKEditToolBar () override
 destructor
 

Static Public Member Functions

static void setGlobalDefaultToolBar (const char *toolBarName)
 

Protected Member Functions

void hideEvent (QHideEvent *event) override
 
void showEvent (QShowEvent *event) override
 

Private Attributes

KisKEditToolBarPrivate *const d
 

Friends

class KisKEditToolBarPrivate
 

Detailed Description

A dialog used to customize or configure toolbars.

This dialog only works if your application uses the XML UI framework for creating menus and toolbars. It depends on the XML files to describe the toolbar layouts and it requires the actions to determine which buttons are active.

Typically you do not need to use it directly as KXmlGuiWindow::setupGUI takes care of it.

If you use plugListAction you need to overload saveNewToolbarConfig() to plug actions again:

void MyClass::saveNewToolbarConfig()
{
plugActionList( "list1", list1Actions );
plugActionList( "list2", list2Actions );
}
virtual void saveNewToolbarConfig()

When created, KisKEditToolBar takes a KisKXMLGUIFactory object, and uses it to find all of the action collections and XML files (there is one of each for the mainwindow, but there could be more, when adding other XMLGUI clients like KParts or plugins). The editor aims to be semi-intelligent about where it assigns any modifications. In other words, it will not write out part specific changes to your application's main XML file.

KXmlGuiWindow and KParts::MainWindow take care of creating KisKEditToolBar correctly and connecting to its newToolBarConfig slot, but if you really really want to do it yourself, see the KXmlGuiWindow::configureToolbars() and KXmlGuiWindow::saveNewToolbarConfig() code.

KDE Toolbar Editor (KWrite)
Author
Kurt Granroth granr.nosp@m.oth@.nosp@m.kde.o.nosp@m.rg @maintainer David Faure faure.nosp@m.@kde.nosp@m..org

Definition at line 57 of file kedittoolbar.h.

Constructor & Destructor Documentation

◆ KisKEditToolBar()

KisKEditToolBar::KisKEditToolBar ( KisKXMLGUIFactory * factory,
QWidget * parent = 0 )
explicit

Main constructor.

The main parameter, factory, is a pointer to the XML GUI factory object for your application. It contains a list of all of the GUI clients (along with the action collections and xml files) and the toolbar editor uses that.

Use this like so:

KisKEditToolBar edit(factory());
if (edit.exec())
...
A dialog used to customize or configure toolbars.
Parameters
factoryYour application's factory object
parentThe usual parent for the dialog.

Definition at line 596 of file kedittoolbar.cpp.

598 : QDialog(parent),
599 d(new KisKEditToolBarPrivate(this))
600{
601 d->m_widget = new KisKEditToolBarWidget(this);
602 d->init();
603 d->m_factory = factory;
604}
A widget used to customize or configure toolbars.
KisKXMLGUIFactory * m_factory
KisKEditToolBarWidget * m_widget
friend class KisKEditToolBarPrivate
KisKEditToolBarPrivate *const d

◆ ~KisKEditToolBar()

KisKEditToolBar::~KisKEditToolBar ( )
override

destructor

Definition at line 647 of file kedittoolbar.cpp.

648{
649 delete d;
650 s_defaultToolBarName()->clear();
651}

References d.

Member Function Documentation

◆ hideEvent()

void KisKEditToolBar::hideEvent ( QHideEvent * event)
overrideprotected

Definition at line 1734 of file kedittoolbar.cpp.

1735{
1736 // The dialog has been hidden, disable toolbar editing
1738
1739 QDialog::hideEvent(event);
1740}
static void setToolBarsEditable(bool editable)

References KisToolBar::setToolBarsEditable().

◆ newToolBarConfig

void KisKEditToolBar::newToolBarConfig ( )
signal

Signal emitted when 'apply' or 'ok' is clicked or toolbars were reset. Connect to it, to plug action lists and to call applyMainWindowSettings (see sample code in this class's documentation)

◆ newToolbarConfig

QT_MOC_COMPAT void KisKEditToolBar::newToolbarConfig ( )
signal

◆ setDefaultToolBar()

void KisKEditToolBar::setDefaultToolBar ( const QString & toolBarName)

Sets the default toolbar that will be selected when the dialog is shown. If not set, or QString() is passed in, the global default tool bar name will be used.

Parameters
toolBarNamethe name of the tool bar
See also
setGlobalDefaultToolBar

Definition at line 653 of file kedittoolbar.cpp.

654{
655 if (toolBarName.isEmpty()) {
656 d->m_defaultToolBar = *s_defaultToolBarName();
657 } else {
658 d->m_defaultToolBar = toolBarName;
659 }
660}

References d, and KisKEditToolBarPrivate::m_defaultToolBar.

◆ setGlobalDefaultToolBar()

void KisKEditToolBar::setGlobalDefaultToolBar ( const char * toolBarName)
static

Sets the default toolbar which will be auto-selected for all KisKEditToolBar instances. Can be overridden on a per-dialog basis by calling setDefaultToolBar( const QString& ) on the dialog.

Parameters
toolBarNamethe name of the tool bar

Definition at line 777 of file kedittoolbar.cpp.

778{
779 *s_defaultToolBarName() = QString::fromLatin1(toolbarName);
780}

◆ setResourceFile()

void KisKEditToolBar::setResourceFile ( const QString & file,
bool global = true )

The name (absolute or relative) of your application's UI resource file is assumed to be share/apps/appname/appnameui.xmlgui though this can be overridden by calling this method.

The global parameter controls whether or not the global resource file is used. If this is true, then you may edit all of the actions in your toolbars – global ones and local one. If it is false, then you may edit only your application's entries. The only time you should set this to false is if your application does not use the global resource file at all (very rare).

Parameters
fileThe application's local resource file.
globalIf true, then the global resource file will also be parsed.

Definition at line 640 of file kedittoolbar.cpp.

641{
642 d->m_file = file;
643 d->m_global = global;
645}
void load(const QString &resourceFile, bool global=true, const QString &defaultToolBar=QString())

References d, KDEPrivate::KisKEditToolBarWidget::load(), KisKEditToolBarPrivate::m_defaultToolBar, KisKEditToolBarPrivate::m_file, KisKEditToolBarPrivate::m_global, and KisKEditToolBarPrivate::m_widget.

◆ showEvent()

void KisKEditToolBar::showEvent ( QShowEvent * event)
overrideprotected

Definition at line 1717 of file kedittoolbar.cpp.

1718{
1719 if (!event->spontaneous()) {
1720 // The dialog has been shown, enable toolbar editing
1721 if (d->m_factory) {
1722 // call the xmlgui-factory version
1724 } else {
1725 // call the action collection version
1727 }
1728
1730 }
1731 QDialog::showEvent(event);
1732}

References KisToolBar::setToolBarsEditable().

Friends And Related Symbol Documentation

◆ KisKEditToolBarPrivate

friend class KisKEditToolBarPrivate
friend

Definition at line 136 of file kedittoolbar.h.

Member Data Documentation

◆ d

KisKEditToolBarPrivate* const KisKEditToolBar::d
private

Definition at line 137 of file kedittoolbar.h.


The documentation for this class was generated from the following files: