本文整理汇总了C++中KAction::objectName方法的典型用法代码示例。如果您正苦于以下问题:C++ KAction::objectName方法的具体用法?C++ KAction::objectName怎么用?C++ KAction::objectName使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类KAction
的用法示例。
在下文中一共展示了KAction::objectName方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: cut
KAction *create(StandardAction id, const QObject *recvr, const char *slot, QObject *parent)
{
KAction *pAction = 0;
const Info* pInfo = infoPtr(id);
if (pInfo) {
pAction = new KAction(parent);
pAction->setObjectName(pInfo->psName);
KShortcut cut(pInfo->shortcut);
if (!cut.isEmpty())
pAction->setShortcut(cut);
pAction->setText(i18n(pInfo->psText));
pAction->setToolTip(i18n(pInfo->psToolTip));
pAction->setWhatsThis(i18n(pInfo->psWhatsThis));
if (pInfo->psIconName)
pAction->setIcon(KIcon(QLatin1String(pInfo->psIconName)));
}
if (recvr && slot)
QObject::connect(pAction, SIGNAL(triggered(bool)), recvr, slot);
if (pAction) {
KActionCollection *collection = qobject_cast<KActionCollection *>(parent);
if (collection)
collection->addAction(pAction->objectName(), pAction);
}
return pAction;
}
示例2: singleRunnerModeActionTriggered
void KRunnerApp::singleRunnerModeActionTriggered()
{
KAction * action = qobject_cast<KAction*>(sender());
if (action) {
displaySingleRunner(action->objectName());
}
}
示例3: QObject
KopeteCommandGUIClient( Kopete::ChatSession *manager ) : QObject(manager), KXMLGUIClient(manager)
{
setXMLFile( QString::fromLatin1("kopetecommandui.rc") );
QDomDocument doc = domDocument();
QDomNode menu = doc.documentElement().firstChild().firstChild().firstChild();
CommandList mCommands = Kopete::CommandHandler::commandHandler()->commands(
manager->protocol()
);
CommandList::Iterator it, itEnd = mCommands.end();
for( it = mCommands.begin(); it != itEnd; ++it )
{
KAction *a = static_cast<KAction*>( it.value() );
actionCollection()->addAction( a->objectName(), a );
QDomElement newNode = doc.createElement( QString::fromLatin1("Action") );
newNode.setAttribute( QString::fromLatin1("name"), a->objectName() );
bool added = false;
for( QDomElement n = menu.firstChild().toElement();
!n.isNull(); n = n.nextSibling().toElement() )
{
if( a->objectName() < n.attribute(QString::fromLatin1("name")))
{
menu.insertBefore( newNode, n );
added = true;
break;
}
}
if( !added )
{
menu.appendChild( newNode );
}
}
setDOMDocument( doc );
}
示例4: createGUIClients
void Part::createGUIClients()//KexiMainWindow *win)
{
// d->mainWin = win;
if (!d->guiClient) {
//create part's gui client
d->guiClient = new GUIClient(this, false, "part");
//default actions for part's gui client:
KAction *act = new KAction(
KIcon(info()->createItemIcon()),
instanceCaption() + "...",
KexiMainWindowIface::global()->actionCollection()
);
act->setObjectName(KexiPart::nameForCreateAction(*info()));
QString defaultToolTip(i18n("Create new object of type \"%1\"", instanceCaption().toLower()));
act->setToolTip(internalPropertyValue("instanceToolTip", defaultToolTip).toString());
QString defaultWhatsThis(i18n("Creates new object of type \"%1\"", instanceCaption().toLower()));
act->setWhatsThis(internalPropertyValue("instanceWhatsThis", defaultWhatsThis).toString());
connect(act, SIGNAL(triggered()), this, SLOT(slotCreate()));
KexiMainWindowIface::global()->actionCollection()->addAction(act->objectName(), act);
#ifdef __GNUC__
#warning TODO KexiMainWindowIface::global()->guiFactory()->addClient(d->guiClient); //this client is added permanently
#else
#pragma WARNING( TODO KexiMainWindowIface::global()->guiFactory()->addClient(d->guiClient); )
#endif
//default actions for part instance's gui client:
//NONE
//let init specific actions for part instances
for (int mode = 1; mode <= 0x01000; mode <<= 1) {
if (d->supportedViewModes & (Kexi::ViewMode)mode) {
GUIClient *instanceGuiClient = new GUIClient(
this, true, Kexi::nameForViewMode((Kexi::ViewMode)mode).toLatin1());
d->instanceGuiClients.insert((Kexi::ViewMode)mode, instanceGuiClient);
}
}
// also add an instance common for all modes (mode==0)
GUIClient *instanceGuiClient = new GUIClient(this, true, "allViews");
d->instanceGuiClients.insert(Kexi::AllViewModes, instanceGuiClient);
//todo
initPartActions();
// initActions();
}
}
示例5: KDialog
KDirSelectDialog::KDirSelectDialog(const KUrl &startDir, bool localOnly,
QWidget *parent)
: KDialog( parent ),
d( new Private( localOnly, this ) )
{
setCaption( i18nc("@title:window","Select Folder") );
setButtons( Ok | Cancel | User1 );
setButtonGuiItem( User1, KGuiItem( i18nc("@action:button","New Folder..."), "folder-new" ) );
setDefaultButton(Ok);
button(Ok)->setFocus();
QFrame *page = new QFrame(this);
setMainWidget(page);
QHBoxLayout *hlay = new QHBoxLayout( page);
hlay->setMargin(0);
QVBoxLayout *mainLayout = new QVBoxLayout();
d->m_actions=new KActionCollection(this);
d->m_actions->addAssociatedWidget(this);
d->m_placesView = new KFilePlacesView( page );
d->m_placesView->setModel(new KFilePlacesModel(d->m_placesView));
d->m_placesView->setObjectName( QLatin1String( "speedbar" ) );
d->m_placesView->setHorizontalScrollBarPolicy( Qt::ScrollBarAlwaysOff );
d->m_placesView->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
connect( d->m_placesView, SIGNAL(urlChanged(KUrl)),
SLOT(setCurrentUrl(KUrl)) );
hlay->addWidget( d->m_placesView );
hlay->addLayout( mainLayout );
d->m_treeView = new KFileTreeView(page);
d->m_treeView->setDirOnlyMode(true);
d->m_treeView->setContextMenuPolicy(Qt::CustomContextMenu);
for (int i = 1; i < d->m_treeView->model()->columnCount(); ++i)
d->m_treeView->hideColumn(i);
d->m_urlCombo = new KHistoryComboBox( page);
d->m_urlCombo->setLayoutDirection( Qt::LeftToRight );
d->m_urlCombo->setSizeAdjustPolicy(QComboBox::AdjustToMinimumContentsLength);
d->m_urlCombo->setTrapReturnKey( true );
KUrlCompletion *comp = new KUrlCompletion();
comp->setMode( KUrlCompletion::DirCompletion );
d->m_urlCombo->setCompletionObject( comp, true );
d->m_urlCombo->setAutoDeleteCompletionObject( true );
d->m_urlCombo->setDuplicatesEnabled( false );
d->m_contextMenu = new KMenu( this );
KAction* newFolder = new KAction( i18nc("@action:inmenu","New Folder..."), this);
d->m_actions->addAction( newFolder->objectName(), newFolder );
newFolder->setIcon( KIcon( "folder-new" ) );
newFolder->setShortcut( Qt::Key_F10);
connect( newFolder, SIGNAL(triggered(bool)), this, SLOT(slotNewFolder()) );
d->m_contextMenu->addAction( newFolder );
d->moveToTrash = new KAction( i18nc( "@action:inmenu","Move to Trash" ), this );
d->m_actions->addAction( d->moveToTrash->objectName(), d->moveToTrash );
d->moveToTrash->setIcon( KIcon( "user-trash" ) );
d->moveToTrash->setShortcut(KShortcut(Qt::Key_Delete));
connect( d->moveToTrash, SIGNAL(triggered(bool)), this, SLOT(slotMoveToTrash()) );
d->m_contextMenu->addAction( d->moveToTrash );
d->deleteAction = new KAction( i18nc("@action:inmenu","Delete"), this );
d->m_actions->addAction( d->deleteAction->objectName(), d->deleteAction );
d->deleteAction->setIcon( KIcon( "edit-delete" ) );
d->deleteAction->setShortcut( KShortcut( Qt::SHIFT + Qt::Key_Delete ) );
connect( d->deleteAction, SIGNAL(triggered(bool)), this, SLOT(slotDelete()) );
d->m_contextMenu->addAction( d->deleteAction );
d->m_contextMenu->addSeparator();
d->showHiddenFoldersAction = new KToggleAction( i18nc("@option:check", "Show Hidden Folders"), this );
d->m_actions->addAction( d->showHiddenFoldersAction->objectName(), d->showHiddenFoldersAction );
d->showHiddenFoldersAction->setShortcut( Qt::Key_F8 );
connect( d->showHiddenFoldersAction, SIGNAL(triggered(bool)), d->m_treeView, SLOT(setShowHiddenFiles(bool)) );
d->m_contextMenu->addAction( d->showHiddenFoldersAction );
d->m_contextMenu->addSeparator();
KAction* propertiesAction = new KAction( i18nc("@action:inmenu","Properties"), this);
d->m_actions->addAction(propertiesAction->objectName(), propertiesAction);
propertiesAction->setIcon(KIcon("document-properties"));
propertiesAction->setShortcut(KShortcut(Qt::ALT + Qt::Key_Return));
connect( propertiesAction, SIGNAL(triggered(bool)), this, SLOT(slotProperties()) );
d->m_contextMenu->addAction( propertiesAction );
d->m_startURL = KFileDialog::getStartUrl( startDir, d->m_recentDirClass );
if ( localOnly && !d->m_startURL.isLocalFile() )
{
d->m_startURL = KUrl();
QString docPath = KGlobalSettings::documentPath();
if (QDir(docPath).exists())
d->m_startURL.setPath( docPath );
else
d->m_startURL.setPath( QDir::homePath() );
}
d->m_startDir = d->m_startURL;
d->m_rootUrl = d->m_treeView->rootUrl();
d->readConfig( KGlobal::config(), "DirSelect Dialog" );
//.........这里部分代码省略.........