当前位置: 首页>>代码示例>>C++>>正文


C++ ToolBarItem::addTo方法代码示例

本文整理汇总了C++中ToolBarItem::addTo方法的典型用法代码示例。如果您正苦于以下问题:C++ ToolBarItem::addTo方法的具体用法?C++ ToolBarItem::addTo怎么用?C++ ToolBarItem::addTo使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ToolBarItem的用法示例。


在下文中一共展示了ToolBarItem::addTo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MultiLineEditorBase

MultiLineEditor::MultiLineEditor( bool call_static, bool richtextMode, QWidget *parent, QWidget *editWidget,
				  FormWindow *fw, const QString &text )
    : MultiLineEditorBase( parent, 0, WType_Dialog | WShowModal ), formwindow( fw ), doWrap( FALSE )
{
    callStatic = call_static;

    if ( callStatic )
	applyButton->hide();

    textEdit = new TextEdit( centralWidget(), "textedit" );
    Layout4->insertWidget( 0, textEdit );

    if ( richtextMode ) {
	QPopupMenu *stylesMenu = new QPopupMenu( this );
	menuBar->insertItem( tr( "&Styles" ), stylesMenu );

	basicToolBar = new QToolBar( tr( "Basics" ), this, DockTop );

	ToolBarItem *it = new ToolBarItem( this, basicToolBar, tr( "Italic" ),
					   "i", QPixmap::fromMimeSource( "designer_textitalic.png" ), CTRL+Key_I );
	it->addTo( stylesMenu );
	connect( it, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *b = new ToolBarItem( this, basicToolBar, tr( "Bold" ),
					  "b", QPixmap::fromMimeSource( "designer_textbold.png" ), CTRL+Key_B );
	b->addTo( stylesMenu );
	connect( b, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *ul = new ToolBarItem( this, basicToolBar, tr( "Underline" ),
					   "u", QPixmap::fromMimeSource( "designer_textunderline.png" ), CTRL+Key_U );
	ul->addTo( stylesMenu );
	connect( ul, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *tt = new ToolBarItem( this, basicToolBar, tr( "Typewriter" ),
					   "tt", QPixmap::fromMimeSource( "designer_textteletext.png" ) );
	tt->addTo( stylesMenu );
	connect( tt, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	basicToolBar->addSeparator();

	QPopupMenu *layoutMenu = new QPopupMenu( this );
	menuBar->insertItem( tr( "&Layout" ), layoutMenu );

	QAction *brAction = new QAction( this );
	brAction->setIconSet( QPixmap::fromMimeSource( "designer_textlinebreak.png" ) );
	brAction->setText( tr("Break" ) );
	brAction->addTo( basicToolBar );
	brAction->addTo( layoutMenu );
	connect( brAction, SIGNAL( activated() ) , this, SLOT( insertBR() ) );

	ToolBarItem *p = new ToolBarItem( this, basicToolBar, tr( "Paragraph" ),
					  "p", QPixmap::fromMimeSource( "designer_textparagraph.png" ) );
	p->addTo( layoutMenu );
	connect( p, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));
	layoutMenu->insertSeparator();
	basicToolBar->addSeparator();

	ToolBarItem *al = new ToolBarItem( this, basicToolBar, tr( "Align left" ),
					   "p align=\"left\"", QPixmap::fromMimeSource( "designer_textleft.png" ) );
	al->addTo( layoutMenu );
	connect( al, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *ac = new ToolBarItem( this, basicToolBar, tr( "Align center" ),
					   "p align=\"center\"", QPixmap::fromMimeSource( "designer_textcenter.png" ) );
	ac->addTo( layoutMenu );
	connect( ac, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *ar = new ToolBarItem( this, basicToolBar, tr( "Align right" ),
					   "p align=\"right\"", QPixmap::fromMimeSource( "designer_textright.png" ) );
	ar->addTo( layoutMenu );
	connect( ar, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));

	ToolBarItem *block = new ToolBarItem( this, basicToolBar, tr( "Blockquote" ),
					      "blockquote", QPixmap::fromMimeSource( "designer_textjustify.png" ) );
	block->addTo( layoutMenu );
	connect( block, SIGNAL( clicked( const QString& ) ),
		 this, SLOT( insertTags( const QString& )));


	QPopupMenu *fontMenu = new QPopupMenu( this );
	menuBar->insertItem( tr( "&Font" ), fontMenu );

	fontToolBar = new QToolBar( "Fonts", this, DockTop );

	QAction *fontAction = new QAction( this );
	fontAction->setIconSet( QPixmap::fromMimeSource( "designer_textfont.png" ) );
	fontAction->setText( tr("Font" ) );
	fontAction->addTo( fontToolBar );
	fontAction->addTo( fontMenu );
	connect( fontAction, SIGNAL( activated() ) , this, SLOT( showFontDialog() ) );


//.........这里部分代码省略.........
开发者ID:AliYousuf,项目名称:univ-aca-mips,代码行数:101,代码来源:multilineeditorimpl.cpp


注:本文中的ToolBarItem::addTo方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。