本文整理汇总了C++中QAction::addTo方法的典型用法代码示例。如果您正苦于以下问题:C++ QAction::addTo方法的具体用法?C++ QAction::addTo怎么用?C++ QAction::addTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类QAction
的用法示例。
在下文中一共展示了QAction::addTo方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setupEditActions
void TextEdit::setupEditActions()
{
QToolBar *tb = new QToolBar( this );
tb->setLabel( "Edit Actions" );
QPopupMenu *menu = new QPopupMenu( this );
menuBar()->insertItem( tr( "&Edit" ), menu );
QAction *a;
a = new QAction( QPixmap::fromMimeSource( "editundo.xpm" ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( QPixmap::fromMimeSource( "editredo.xpm" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
a->addTo( tb );
a->addTo( menu );
menu->insertSeparator();
a = new QAction( QPixmap::fromMimeSource( "editcopy.xpm" ), tr( "&Copy" ), CTRL + Key_C, this, "editCopy" );
connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( QPixmap::fromMimeSource( "editcut.xpm" ), tr( "Cu&t" ), CTRL + Key_X, this, "editCut" );
connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( QPixmap::fromMimeSource( "editpaste.xpm" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
a->addTo( tb );
a->addTo( menu );
}
示例2: setupEditActions
void TextEdit::setupEditActions()
{
QToolBar *tb = new QToolBar( this );
QPopupMenu *menu = new QPopupMenu( this );
menuBar()->insertItem( tr( "&Edit" ), menu );
QAction *a;
a = new QAction( tr( "Undo" ), QPixmap( "textdrawing/undo.png" ), tr( "&Undo" ), CTRL + Key_Z, this, "editUndo" );
connect( a, SIGNAL( activated() ), this, SLOT( editUndo() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( tr( "Redo" ), QPixmap( "textdrawing/redo.png" ), tr( "&Redo" ), CTRL + Key_Y, this, "editRedo" );
connect( a, SIGNAL( activated() ), this, SLOT( editRedo() ) );
a->addTo( tb );
a->addTo( menu );
menu->insertSeparator();
a = new QAction( tr( "Cut" ), QPixmap( "textdrawing/editcut.png" ), tr( "&Cut" ), CTRL + Key_X, this, "editCut" );
connect( a, SIGNAL( activated() ), this, SLOT( editCut() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( tr( "Copy" ), QPixmap( "textdrawing/editcopy.png" ), tr( "C&opy" ), CTRL + Key_C, this, "editCopy" );
connect( a, SIGNAL( activated() ), this, SLOT( editCopy() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( tr( "Paste" ), QPixmap( "textdrawing/editpaste.png" ), tr( "&Paste" ), CTRL + Key_V, this, "editPaste" );
connect( a, SIGNAL( activated() ), this, SLOT( editPaste() ) );
a->addTo( tb );
a->addTo( menu );
}
示例3: setupFileActions
void TextEdit::setupFileActions()
{
QToolBar *tb = new QToolBar( this );
QPopupMenu *menu = new QPopupMenu( this );
menuBar()->insertItem( tr( "&File" ), menu );
QAction *a;
a = new QAction( tr( "New" ), QPixmap( "textdrawing/filenew.png" ), tr( "&New..." ), CTRL + Key_N, this, "fileNew" );
connect( a, SIGNAL( activated() ), this, SLOT( fileNew() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( tr( "Open" ), QPixmap( "textdrawing/fileopen.png" ), tr( "&Open..." ), CTRL + Key_O, this, "fileOpen" );
connect( a, SIGNAL( activated() ), this, SLOT( fileOpen() ) );
a->addTo( tb );
a->addTo( menu );
menu->insertSeparator();
a = new QAction( tr( "Save" ), QPixmap( "textdrawing/filesave.png" ), tr( "&Save..." ), CTRL + Key_S, this, "fileSave" );
connect( a, SIGNAL( activated() ), this, SLOT( fileSave() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( tr( "Save As" ), QPixmap(), tr( "Save &As..." ), 0, this, "fileSaveAs" );
connect( a, SIGNAL( activated() ), this, SLOT( fileSaveAs() ) );
a->addTo( menu );
menu->insertSeparator();
a = new QAction( tr( "Print" ), QPixmap( "textdrawing/print.png" ), tr( "&Print..." ), CTRL + Key_P, this, "filePrint" );
connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
a->addTo( tb );
a->addTo( menu );
a = new QAction( tr( "Close" ), QPixmap(), tr( "&Close" ), 0, this, "fileClose" );
connect( a, SIGNAL( activated() ), this, SLOT( fileClose() ) );
a->addTo( menu );
}
示例4: QMainWindow
MainWindow::MainWindow(QWidget *parent, const char *name, WFlags) : QMainWindow(parent, name, WStyle_ContextHelp) {
setCaption(tr("IRC Client"));
m_tabWidget = new IRCTabWidget(this);
QWhatsThis::add(m_tabWidget, tr("Server connections, channels, queries and other things will be placed here"));
connect(m_tabWidget, SIGNAL(currentChanged(QWidget*)), this, SLOT(selected(QWidget*)));
setCentralWidget(m_tabWidget);
setToolBarsMovable(FALSE);
QMenuBar *menuBar = new QMenuBar(this);
QPopupMenu *irc = new QPopupMenu(this);
menuBar->insertItem(tr("IRC"), irc);
QAction *a = new QAction( tr("New connection"),
Opie::Core::OResource::loadPixmap( "pass", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
connect(a, SIGNAL(activated()), this, SLOT(newConnection()));
a->setWhatsThis(tr("Create a new connection to an IRC server"));
a->addTo(irc);
a = new QAction( tr("Settings"),
Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
a->setWhatsThis(tr("Configure OpieIRC's behavior and appearance"));
connect(a, SIGNAL(activated()), this, SLOT(settings()));
a->addTo(irc);
m_dccTab = 0;
loadSettings();
}
示例5: initUI
/*
* init tool bars layout and so on
*/
void MainWindow::initUI() {
setToolBarsMovable( false );
m_toolBar = new QToolBar( this );
m_toolBar->setHorizontalStretchable( TRUE );
m_itemNewAction->addTo( m_toolBar );
m_popTemplate = new QPopupMenu( this );
m_popTemplate->setCheckable( TRUE );
connect( m_popTemplate, SIGNAL(activated(int) ),
this, SLOT(slotNewFromTemplate(int) ) );
//X m_popView->insertItem(tr("New from template"), m_popTemplate, -1, 0);
m_toolBar->addSeparator();
QAction *a = new QAction( tr("Today" ), Opie::Core::OResource::loadPixmap( "datebook/to_day", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
a->addTo( m_toolBar );
connect(a, SIGNAL( activated() ), this, SLOT( slotGoToNow() ) );
m_toolBar->addSeparator();
m_viewsBar = new QToolBar( this );
m_viewsBar->setHorizontalStretchable( FALSE );
m_toolBar2 = new QToolBar( this );
m_toolBar2->setHorizontalStretchable( TRUE );
m_toolBar2->addSeparator();
a = new QAction( tr("Find"), Opie::Core::OResource::loadPixmap( "mag", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
a->addTo( m_toolBar2 );
connect(a, SIGNAL( activated() ), this, SLOT( slotFind() ) );
m_configureAction->addTo( m_toolBar2 );
if ( Ir::supported() ) {
m_itemBeamOccurrenceAction = new QAction( tr( "Beam this occurrence" ),
QString::null, 0, this, 0 );
connect( m_itemBeamOccurrenceAction, SIGNAL(activated()), this, SLOT(slotItemBeamOccurrence()) );
m_itemBeamOccurrenceAction->setWhatsThis( tr( "Transmit the specific occurrence of the selected recurring item." ) );
}
/*X
a = new QAction( tr("Configure Templates"), QString::null, 0, 0 );
a->addTo( m_popSetting );
connect(a, SIGNAL( activated() ), this, SLOT(slotConfigureTemp() ) );
*/
connect( qApp, SIGNAL(clockChanged(bool) ),
this, SLOT(slotClockChanged(bool) ) );
connect( qApp, SIGNAL(weekChanged(bool) ),
this, SLOT(slotWeekChanged(bool) ) );
m_stack = new QWidgetStack( this );
setCentralWidget( m_stack );
}
示例6: initUI
void MainWindow::initUI() {
/*
* We want to provde a File Menu with Quit as option
* and a Fire Toolbutton ( QAction )
* So we need two actions
* A toolbar and a popupMenu
*/
setToolBarsMovable( false );
/*
*We don't want the static toolbar but share it with the
* toolbar on small screens
*/
QToolBar *menuBarHolder = new QToolBar( this );
/* we allow the menubarholder to become bigger than
* the screen width and to offer a > for the additional items
*/
menuBarHolder->setHorizontalStretchable( true );
QMenuBar *mb = new QMenuBar( menuBarHolder );
QToolBar *tb = new QToolBar( this );
QPopupMenu *fileMenu = new QPopupMenu( this );
/*
* we create our first action with the Text Quit
* a IconSet, no menu name, no acceleration ( keyboard shortcut ),
* with parent this, and name "quit_action"
*/
/*
* Note if you want a picture out of the inline directory
* you musn't prefix inline/ inline means these pics are built in
* into libqpe so the name without ending and directory is enough
*/
QAction *a = new QAction( tr("Quit"), Opie::Core::OResource::loadPixmap("quit_icon", Opie::Core::OResource::SmallIcon),
QString::null, 0, this, "quit_action" );
/*
* Connect quit to the QApplication quit slot
*/
connect(a, SIGNAL(activated() ),
qApp, SLOT(quit() ) );
a->addTo( fileMenu );
a = new QAction(tr("Fire"),
Opie::Core::OResource::loadPixmap("new", Opie::Core::OResource::SmallIcon),
QString::null, 0, this, "fire_button");
/* see the power? */
a->addTo( fileMenu );
a->addTo( tb );
m_fire = a;
mb->insertItem(tr("File"), fileMenu );
}
示例7: setupFileActions
void Help::setupFileActions()
{
QPopupMenu* menu = new QPopupMenu( this );
menuBar()->insertItem( tr( "&File" ), menu );
QAction *a;
a = new QAction( tr( "Print" ), createIconSet( "print.xpm" ), tr( "&Print" ), CTRL + Key_P, this );
a->addTo( menu );
a->addTo( toolbar );
connect( a, SIGNAL( activated() ), this, SLOT( filePrint() ) );
a = new QAction( tr( "Close" ), tr( "&Close" ), 0, this );
a->addTo( menu );
connect( a, SIGNAL( activated() ), this, SLOT( close() ) );
}
示例8: pix
void
aToolBar::ReadTool( aCfgItem &obj )
{
aCfgItem aobj, apix; // action and pixmap XML data
QString aKey; // key sequence
long pid; // action id
aobj = md->firstChild( obj ); //from first child action
while ( !aobj.isNull() ) { // foreach not null
aKey = md->sText ( aobj, md_key ); //key sequence
pid = md->id( aobj ); // action id
apix = md->findChild(
md->find(
md->text( md->findChild( aobj, md_comaction, 0 ) ).toLong() ),
md_active_picture,
0
); // first action pixmap cfg object
QPixmap pix( md->binary( apix ) ); // pixmap
QAction *a = new QAction(
QIconSet(pix), // pixmap
md->attr( aobj, mda_name), // name
aKey, // key sequence
this, // owner
md->attr( aobj, mda_name) // name
); // create new action
actions.insert( pid, a ); // add action to dict
a->addTo( this ); // put action into toolbar
connect( a, SIGNAL(activated()), this, SLOT(on_Item()) ); // connect to slot
aobj = md->nextSibling( aobj ); // get next action
}
}
示例9: addToolBarSeparator
void DesignerFormWindowImpl::addToolBarSeparator( const QString &tbn )
{
if ( !::qt_cast<QMainWindow*>(formWindow->mainContainer()) )
return;
QMainWindow *mw = (QMainWindow*)formWindow->mainContainer();
QDesignerToolBar *tb = (QDesignerToolBar*)mw->child( tbn, "QDesignerToolBar" );
if ( !tb )
return;
QAction *a = new QSeparatorAction( 0 );
a->addTo( tb );
tb->addAction( a );
}
示例10: QMainWindow
FifteenMainWindow::FifteenMainWindow(QWidget *parent, const char* name, WFlags fl)
: QMainWindow( parent, name, fl )
{
// random seed
srand(time(0));
setCaption( tr("Fifteen Pieces") );
QToolBar *toolbar = new QToolBar(this);
toolbar->setHorizontalStretchable( FALSE );
QMenuBar *menubar = new QMenuBar( toolbar );
menubar->setMargin(0);
QPopupMenu *game = new QPopupMenu( this );
menubar->insertItem( tr( "Game" ), game );
QWidget *spacer = new QWidget( toolbar );
spacer->setBackgroundMode( PaletteButton );
toolbar->setStretchableWidget( spacer );
setToolBarsMovable( FALSE );
QVBox *vbox = new QVBox( this );
PiecesTable *table = new PiecesTable( vbox );
setCentralWidget(vbox);
QAction *a = new QAction( tr( "Randomize" ), Opie::Core::OResource::loadPixmap( "new", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated() ), table, SLOT( slotRandomize() ) );
a->addTo( game );
a->addTo( toolbar );
a = new QAction( tr("Configure"), Opie::Core::OResource::loadPixmap( "SettingsIcon", Opie::Core::OResource::SmallIcon ),
QString::null, 0, this, 0 );
connect( a, SIGNAL( activated()), table, SLOT( slotConfigure()) );
a->addTo( game );
}
示例11: setupGoActions
void Help::setupGoActions()
{
QPopupMenu* menu = new QPopupMenu( this );
menuBar()->insertItem( tr( "&Go" ), menu );
QAction *a;
a = new QAction( tr( "Home" ), createIconSet( "home.xpm" ), ( "&Home" ), ALT + Key_Home, this );
a->addTo( menu );
a->addTo( toolbar );
connect( a, SIGNAL( activated() ), this, SLOT( goHome() ) );
a = new QAction( tr( "Qt Reference Documentation" ), createIconSet( "customwidget.xpm" ),
( "&Qt Reference Documentation" ), ALT + SHIFT + Key_Home, this );
a->addTo( menu );
a->addTo( toolbar );
connect( a, SIGNAL( activated() ), this, SLOT( goQt() ) );
menu->insertSeparator();
a = new QAction( tr( "Backward" ), createIconSet( "left.xpm" ), ( "&Backward" ), ALT + Key_Left, this );
a->addTo( menu );
a->addTo( toolbar );
connect( a, SIGNAL( activated() ), browser, SLOT( backward() ) );
connect( browser, SIGNAL( backwardAvailable( bool ) ), a, SLOT( setEnabled( bool ) ) );
a = new QAction( tr( "Forward" ), createIconSet( "right.xpm" ), tr( "&Forward" ), ALT + Key_Right, this );
a->addTo( menu );
a->addTo( toolbar );
connect( a, SIGNAL( activated() ), browser, SLOT( forward() ) );
connect( browser, SIGNAL( forwardAvailable( bool ) ), a, SLOT( setEnabled( bool ) ) );
menu->insertSeparator();
a = new QAction( tr( "Topics/Index" ), createIconSet( "help.xpm" ), tr( "&Topics/Index..." ), CTRL + Key_T, this );
a->addTo( menu );
a->addTo( toolbar );
connect( a, SIGNAL( activated() ), this, SLOT( goTopics() ) );
}
示例12: QMainWindow
QTExamWindow::QTExamWindow( QWidget* parent, const char* name, WFlags f )
: QMainWindow( parent, name, f )
{
setCaption("QTExam");
QAction *actFileNew = new QAction( "New", "&New", CTRL+Key_N, this, "new" );
QAction *actFileQuit = new QAction( "Quit", "&Quit", CTRL+Key_Q, this, "quit" );
connect( actFileNew, SIGNAL( activated() ), this, SLOT( newDocument() ) );
connect( actFileQuit, SIGNAL( activated() ), qApp, SLOT( quit() ) );
QPopupMenu *menuFile = new QPopupMenu( this );
actFileNew->addTo( menuFile );
menuFile->insertSeparator();
actFileQuit->addTo( menuFile );
QMenuBar *menuMain = menuBar();
menuMain->insertItem( "&File", menuFile );
table = new QTable( 52, 12, this );
table->setFocus();
setCentralWidget( table );
}
示例13: reconnectActionsToPopupMenu
void MruDocuments::reconnectActionsToPopupMenu()
{
// reconnect actions, now that they have been sorted, to popup menu
QStringList list;
for (QAction* pAction = m_mruDocuments.first(); pAction; pAction = m_mruDocuments.next())
{
pAction->addTo(m_pPopup);
list.append(pAction->text());
}
// update settings
DefaultSettings::instance().setMruDocuments(list);
}
示例14: COptionsMenu
CMDIWindow::CMDIWindow(QWidget* parent)
: CMyWindow(parent, 0, true, WType_TopLevel)
{
#ifdef DEBUG
qDebug("CMDIWindow::CMDIWindow()");
#endif
setName("MainWindow");
setMinimumSize(320, 240);
setCaption(QString(APPLICATION) + " " + QString(VERSION) + QString(BRANCH));
setIcon(getPixmapIcon("applicationIcon"));
setCentralWidget( new QWidget( this, "qt_central_widget" ) );
CMDIWindowLayout = new QGridLayout( centralWidget(), 1, 1, 2, 2, "CMDIWindowLayout");
myApp()->createWorkspace(centralWidget());
myApp()->workSpace()->setScrollBarsEnabled(true);
CMDIWindowLayout->addWidget(myApp()->workSpace(), 0, 0);
consoleMenu = new QPopupMenu(this, "ConsoleMenu");
QAction * consoleExitAction = new QAction (tr("Exit"), getPixmapIcon("exitIcon"),
tr("E&xit"), 0, this, "consoleExitAction"); //Exit should not be CAction
consoleExitAction->addTo(consoleMenu);
connect(consoleExitAction, SIGNAL(activated()), this, SLOT(close()));
menuBar()->insertItem(tr("&Console"), consoleMenu);
new COptionsMenu(this, menuBar(), "OptionsMenu");
#ifndef NO_MYSQLCC_PLUGINS
new CPluginsMenu(this, menuBar(), "PluginsMenu");
#endif
new CHotKeyEditorMenu(this, menuBar(), "HotKeyEditor");
windowMenu = new QPopupMenu(this, "WindowMenu");
windowMenu->setCheckable(true);
menuBar()->insertItem(tr("&Window"), windowMenu);
new CHelpMenu(this, menuBar(), "HelpMenu");
if (!loadWindowSettings())
setGeometry((int)(myApp()->desktop()->width() - (myApp()->desktop()->width() - (myApp()->desktop()->width() / 2)) * 1.5) / 2,
(int)(myApp()->desktop()->height() - (myApp()->desktop()->height() - (myApp()->desktop()->height() / 2)) * 1.5) / 2,
(int)((myApp()->desktop()->width() - (myApp()->desktop()->width() / 2)) * 1.5),
(int)((myApp()->desktop()->height() - (myApp()->desktop()->height() / 2)) * 1.5));
consoleWindow = 0;
connect(windowMenu, SIGNAL(aboutToShow()), this, SLOT(windowMenuAboutToShow()));
}
示例15: QToolBar
/*!
* \en
* Constuct object
* \_en
* \ru
* Создает объект
* \_ru
*/
aReportBrowser::aReportBrowser( QWidget *parent, const char *name, WFlags f )
:QMainWindow( parent, name, f )
{
QAction *a;
QToolBar *t = new QToolBar( this, "ReportTool" );
a = new QAction(
QPixmap::fromMimeSource("print.png"),
tr("Print"),
QKeySequence("Ctrl+P"),
t,
tr("Print report")
);
a->addTo( t );
connect( a, SIGNAL( activated() ), this, SLOT( print() ) );
a = new QAction(
QPixmap::fromMimeSource("filesave.png"),
tr("Save As"),
QKeySequence("Ctrl+S"),
t,
tr("Save report to file")
);
a->addTo( t );
connect( a, SIGNAL( activated() ), this, SLOT( saveAs() ) );
t->show();
textBrowser = new QTextBrowser( this, "textBrowser" );
textBrowser->setTextFormat( QTextBrowser::RichText );
textBrowser->setFocus();
// textBrowser->showMaximized();
setCentralWidget( textBrowser );
// if ( layout() ) delete layout();
// QGridLayout *l = new QGridLayout( this );
// l->addWidget( textBrowser, 1, 0 );
languageChange();
}