• Skip to content
  • Skip to link menu
KDE API Reference
  • KDE API Reference
  • kdelibs API Reference
  • KDE Home
  • Contact Us
 

KDEUI

Signals | Public Member Functions | Protected Member Functions | Properties | List of all members
KPushButton Class Reference

#include <kpushbutton.h>

Inheritance diagram for KPushButton:
Inheritance graph
[legend]

Signals

void authorized (KAuth::Action *action)
 

Public Member Functions

 KPushButton (QWidget *parent=0)
 
 KPushButton (const QString &text, QWidget *parent=0)
 
 KPushButton (const KIcon &icon, const QString &text, QWidget *parent=0)
 
 KPushButton (const KGuiItem &item, QWidget *parent=0)
 
 ~KPushButton ()
 
KAuth::Action * authAction () const
 
QMenu * delayedMenu ()
 
KStandardGuiItem::StandardItem guiItem () const
 
bool isDragEnabled () const
 
void setAuthAction (KAuth::Action *action)
 
void setAuthAction (const QString &actionName)
 
void setDelayedMenu (QMenu *delayed_menu)
 
void setDragEnabled (bool enable)
 
void setGuiItem (const KGuiItem &item)
 
void setGuiItem (KStandardGuiItem::StandardItem item)
 
void setIcon (const KIcon &icon)
 
void setIcon (const QIcon &pix)
 
void setText (const QString &text)
 
virtual QSize sizeHint () const
 

Protected Member Functions

virtual QDrag * dragObject ()
 
virtual void mouseMoveEvent (QMouseEvent *)
 
virtual void mousePressEvent (QMouseEvent *)
 
virtual void paintEvent (QPaintEvent *)
 
virtual void startDrag ()
 

Properties

bool isDragEnabled
 

Detailed Description

A QPushButton with drag-support and KGuiItem support.

This is nothing but a QPushButton with drag-support and KGuiItem support. You must call setDragEnabled (true) and override the virtual method dragObject() to specify the QDragObject to be used.

kpushbutton.png
KDE Push Button
Author
Carsten Pfeiffer pfeif.nosp@m.fer@.nosp@m.kde.o.nosp@m.rg

Definition at line 46 of file kpushbutton.h.

Constructor & Destructor Documentation

KPushButton::KPushButton ( QWidget *  parent = 0)
explicit

Default constructor.

Definition at line 152 of file kpushbutton.cpp.

KPushButton::KPushButton ( const QString &  text,
QWidget *  parent = 0 
)
explicit

Constructor, that sets the button-text to text.

Definition at line 158 of file kpushbutton.cpp.

KPushButton::KPushButton ( const KIcon &  icon,
const QString &  text,
QWidget *  parent = 0 
)

Constructor, that sets an icon and the button-text to text.

Definition at line 164 of file kpushbutton.cpp.

KPushButton::KPushButton ( const KGuiItem &  item,
QWidget *  parent = 0 
)
explicit

Constructor that takes a KGuiItem for the text, the icon, the tooltip and the what's this help.

Definition at line 171 of file kpushbutton.cpp.

KPushButton::~KPushButton ( )

Destructs the button.

Definition at line 177 of file kpushbutton.cpp.

Member Function Documentation

KAuth::Action * KPushButton::authAction ( ) const

Returns the action object associated with this button, or 0 if it does not have one.

Returns
the KAuth::Action associated with this button.

Definition at line 317 of file kpushbutton.cpp.

void KPushButton::authorized ( KAuth::Action *  action)
signal

Signal emitted when the button is triggered and authorized.

If the button needs authorization, whenever the user triggers it, the authorization process automatically begins. If it succeeds, this signal is emitted. The KAuth::Action object is provided for convenience if you have multiple Action objects, but of course it's always the same set with setAuthAction().

WARNING: If your button needs authorization you should connect eventual slots processing stuff to this signal, and NOT clicked. Clicked will be emitted even if the user has not been authorized

Parameters
actionThe object set with setAuthAction()
QMenu * KPushButton::delayedMenu ( )

returns a delayed popup menu since menu() isn't virtual

Definition at line 312 of file kpushbutton.cpp.

QDrag * KPushButton::dragObject ( )
protectedvirtual

Reimplement this and return the QDrag object that should be used for the drag.

Remember to give it "this" as parent.

Default implementation returns 0, so that no drag is initiated.

Definition at line 295 of file kpushbutton.cpp.

KStandardGuiItem::StandardItem KPushButton::guiItem ( ) const

Reads the standard KGuiItem for this button.

Definition at line 234 of file kpushbutton.cpp.

bool KPushButton::isDragEnabled ( ) const
Returns
if drag support is enabled or not.
void KPushButton::mouseMoveEvent ( QMouseEvent *  e)
protectedvirtual

Reimplemented to add drag-support.

Definition at line 278 of file kpushbutton.cpp.

void KPushButton::mousePressEvent ( QMouseEvent *  e)
protectedvirtual

Reimplemented to add drag-support.

Definition at line 271 of file kpushbutton.cpp.

void KPushButton::paintEvent ( QPaintEvent *  )
protectedvirtual

Reimplemented to add arrow for delayed menu.

Since
4.4

Definition at line 371 of file kpushbutton.cpp.

void KPushButton::setAuthAction ( KAuth::Action *  action)

Sets the action object associated with this button.

By setting a KAuth::Action, this button will become associated with it, and whenever it gets clicked, it will trigger the authorization and execution process for the action. The signal activated will also be emitted whenever the button gets clicked and the action gets authorized. Pass 0 to this function to disassociate the button

Parameters
actionthe KAuth::Action to associate with this button.

Definition at line 331 of file kpushbutton.cpp.

void KPushButton::setAuthAction ( const QString &  actionName)

Sets the action object associated with this button.

Overloaded member to allow creating the action by name

Parameters
actionNamethe name of the action to associate

Definition at line 322 of file kpushbutton.cpp.

void KPushButton::setDelayedMenu ( QMenu *  delayed_menu)

Sets a delayed popup menu for consistency, since menu() isn't virtual.

Definition at line 307 of file kpushbutton.cpp.

void KPushButton::setDragEnabled ( bool  enable)

Enables/disables drag-support.

Default is disabled.

Definition at line 266 of file kpushbutton.cpp.

void KPushButton::setGuiItem ( const KGuiItem &  item)

Sets the KGuiItem for this button.

Definition at line 215 of file kpushbutton.cpp.

void KPushButton::setGuiItem ( KStandardGuiItem::StandardItem  item)

Sets the standard KGuiItem for this button.

Definition at line 228 of file kpushbutton.cpp.

void KPushButton::setIcon ( const KIcon &  icon)

Sets the Icon Set for this button.

It also takes into account the KGlobalSettings::showIconsOnPushButtons() setting.

Definition at line 251 of file kpushbutton.cpp.

void KPushButton::setIcon ( const QIcon &  pix)

Sets the pixmap for this button.

This one exists mostly for usage in Qt designer.

Definition at line 261 of file kpushbutton.cpp.

void KPushButton::setText ( const QString &  text)

Sets the text of the button.

Definition at line 239 of file kpushbutton.cpp.

QSize KPushButton::sizeHint ( void  ) const
virtual

Reimplemented to add arrow for delayed menu.

Since
4.4

Definition at line 360 of file kpushbutton.cpp.

void KPushButton::startDrag ( )
protectedvirtual

Starts a drag (dragCopy() by default) using dragObject()

Definition at line 300 of file kpushbutton.cpp.

Property Documentation

bool KPushButton::isDragEnabled
readwrite

Definition at line 49 of file kpushbutton.h.


The documentation for this class was generated from the following files:
  • kpushbutton.h
  • kpushbutton.cpp
This file is part of the KDE documentation.
Documentation copyright © 1996-2014 The KDE developers.
Generated on Tue Oct 14 2014 22:49:18 by doxygen 1.8.7 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDEUI

Skip menu "KDEUI"
  • Main Page
  • Namespace List
  • Namespace Members
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Modules
  • Related Pages

kdelibs API Reference

Skip menu "kdelibs API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  • kjsembed
  •   WTF
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Nepomuk-Core
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver

Search



Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal