mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kdeui: KAction constructors optimization
Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
558295b483
commit
3fcfdb2687
3 changed files with 16 additions and 23 deletions
|
@ -41,11 +41,12 @@
|
|||
// KActionPrivate
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
void KActionPrivate::init(KAction *q_ptr)
|
||||
KActionPrivate::KActionPrivate(KAction *q_ptr)
|
||||
: componentData(KGlobal::mainComponent()),
|
||||
globalShortcutEnabled(false),
|
||||
neverSetGlobalShortcut(true),
|
||||
q(q_ptr)
|
||||
{
|
||||
q = q_ptr;
|
||||
globalShortcutEnabled = false;
|
||||
neverSetGlobalShortcut = true;
|
||||
QObject::connect(q, SIGNAL(triggered(bool)), q, SLOT(slotTriggered()));
|
||||
q->setProperty("isShortcutConfigurable", true);
|
||||
}
|
||||
|
@ -87,24 +88,21 @@ bool KAction::event(QEvent *event)
|
|||
//---------------------------------------------------------------------
|
||||
KAction::KAction(QObject *parent)
|
||||
: QWidgetAction(parent),
|
||||
d(new KActionPrivate())
|
||||
d(new KActionPrivate(this))
|
||||
{
|
||||
d->init(this);
|
||||
}
|
||||
|
||||
KAction::KAction(const QString &text, QObject *parent)
|
||||
: QWidgetAction(parent),
|
||||
d(new KActionPrivate())
|
||||
d(new KActionPrivate(this))
|
||||
{
|
||||
d->init(this);
|
||||
setText(text);
|
||||
}
|
||||
|
||||
KAction::KAction(const KIcon &icon, const QString &text, QObject *parent)
|
||||
: QWidgetAction(parent),
|
||||
d(new KActionPrivate)
|
||||
d(new KActionPrivate(this))
|
||||
{
|
||||
d->init(this);
|
||||
setIcon(icon);
|
||||
setText(text);
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ public:
|
|||
* @param text The visible text for this action.
|
||||
* @param parent The parent for this action.
|
||||
*/
|
||||
KAction(const QString& text, QObject *parent);
|
||||
KAction(const QString &text, QObject *parent);
|
||||
|
||||
/**
|
||||
* Constructs an action with text and icon; a shortcut may be specified by
|
||||
|
@ -266,7 +266,7 @@ public:
|
|||
* @param text The text that will be displayed.
|
||||
* @param parent The parent for this action.
|
||||
*/
|
||||
KAction(const KIcon &icon, const QString& text, QObject *parent);
|
||||
KAction(const KIcon &icon, const QString &text, QObject *parent);
|
||||
|
||||
/**
|
||||
* Standard destructor
|
||||
|
|
|
@ -28,16 +28,10 @@ class KAction;
|
|||
class KActionPrivate
|
||||
{
|
||||
public:
|
||||
KActionPrivate()
|
||||
: componentData(KGlobal::mainComponent()),
|
||||
globalShortcutEnabled(false),
|
||||
q(nullptr)
|
||||
{
|
||||
}
|
||||
KActionPrivate(KAction *q_ptr);
|
||||
|
||||
void slotTriggered();
|
||||
|
||||
void init(KAction *q_ptr);
|
||||
void setActiveGlobalShortcutNoEnable(const KShortcut &cut);
|
||||
|
||||
void maybeSetComponentData(const KComponentData &kcd)
|
||||
|
@ -47,11 +41,12 @@ public:
|
|||
}
|
||||
}
|
||||
|
||||
KComponentData componentData; //this is **way** more lightweight than it looks
|
||||
KShortcut globalShortcut, defaultGlobalShortcut;
|
||||
KComponentData componentData; // this is **way** more lightweight than it looks
|
||||
KShortcut globalShortcut;
|
||||
KShortcut defaultGlobalShortcut;
|
||||
|
||||
bool globalShortcutEnabled : 1;
|
||||
bool neverSetGlobalShortcut : 1;
|
||||
bool globalShortcutEnabled;
|
||||
bool neverSetGlobalShortcut;
|
||||
KAction *q;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue