void ProfileGraphicsView::addControlItems()
{
    QAction *scaleAction = new QAction(QIcon(":scale"), tr("Scale"), this);
    QAction *rulerAction = new QAction(QIcon(":ruler"), tr("Ruler"), this);
    QToolBar *toolBar = new QToolBar("", 0);
    toolBar->addAction(rulerAction);
    toolBar->addAction(scaleAction);
    //make toolbar transparent
    toolBar->setStyleSheet(QString::fromUtf8 ("background-color: rgba(255,255,255,0);"));

    connect(scaleAction, SIGNAL(triggered()), this, SLOT(on_scaleAction()));
    connect(rulerAction, SIGNAL(triggered()), this, SLOT(on_rulerAction()));
    toolBarProxy = scene()->addWidget(toolBar);
    //Put it into the lower right corner of the profile
    toolBarProxy->setPos(gc.maxx-toolBar->width(), gc.maxy-toolBar->height());
}
Exemple #2
0
MDIClass::MDIClass( QWidget* parent )
	: MDIChild( parent )
{
	setObjectName( "MDIClass" );
	setType( ctClass );
	setWindowIcon( QIcon( ":/Icons/Icons/projectshowfile.png" ) );
	//
	QVBoxLayout* vboxLayout = new QVBoxLayout( this );
	vboxLayout->setObjectName( "vboxLayout" );
	vboxLayout->setSpacing( 0 );
	vboxLayout->setMargin( 0 );
	// Toolbar
	QToolBar* tb = new QToolBar( tr( "Files" ), this );
	tb->setFixedHeight( tb->height() );
	tb->setIconSize( QSize(16, 16 ) );
	// Action Group
	aGroup = new QActionGroup( this );
	aGroup->setObjectName( "aGroup" );
	// Actions
	actionForm = new QAction( QIcon( ":/Icons/Icons/form.png" ), tr( "Form" ), this );
	actionForm->setCheckable( true );
	aGroup->addAction( actionForm );
	actionHeader = new QAction( QIcon( ":/Icons/Icons/h.png" ), tr( "Header" ), this );
	actionHeader->setCheckable( true );
	aGroup->addAction( actionHeader );
	actionSource = new QAction( QIcon( ":/Icons/Icons/cpp.png" ), tr( "Source" ), this );
	actionSource->setCheckable( true );
	aGroup->addAction( actionSource );
	tb->addActions( aGroup->actions() );
	vboxLayout->addWidget( tb );
	// Workspace
	wSpace = new QWorkspace( this );
	wSpace->setObjectName( "wSpace" );
	vboxLayout->addWidget( wSpace );
	// Form
	// Header
	teHeader = new TextEditor( this );
	teHeader->setObjectName( "teHeader" );
	teHeader->setFrameShape( QFrame::NoFrame );
	teHeader->setFrameShadow( QFrame::Plain );
	teHeader->setMidLineWidth( 1 );
	teHeader->setDefaultComponents( true );
	teHeader->setWindowIcon( actionHeader->icon() );
	setSettings( teHeader );
	connect( teHeader, SIGNAL( replaceDialogRequested() ), this, SIGNAL( replaceDialogRequested() ) );
	connect( teHeader->completion(), SIGNAL( beforeCompletionShow() ), this, SLOT( beforeCompletionShow() ) );
	connect( teHeader->document(), SIGNAL( modificationChanged( bool ) ), this, SIGNAL( modified( bool ) ) );
	connect( teHeader, SIGNAL( fileOpen( bool ) ), this, SLOT( fileOpened( bool ) ) );
	connect( teHeader, SIGNAL( completionRequested( Completion*, TextEditor* ) ), this, SLOT( completionRequested( Completion*, TextEditor* ) ) );
	wSpace->addWindow( teHeader, Qt::WindowTitleHint );
	// Source
	teSource = new TextEditor( this );
	teSource->setObjectName( "teSource" );
	teSource->setFrameShape( QFrame::NoFrame );
	teSource->setFrameShadow( QFrame::Plain );
	teSource->setMidLineWidth( 1 );
	teSource->setDefaultComponents( true );
	teSource->setWindowIcon( actionSource->icon() );
	setSettings( teSource );
	connect( teSource, SIGNAL( replaceDialogRequested() ), this, SIGNAL( replaceDialogRequested() ) );
	connect( teSource, SIGNAL( beforeCompletionShow() ), this, SLOT( beforeCompletionShow() ) );
	connect( teSource->document(), SIGNAL( modificationChanged( bool ) ), this, SIGNAL( modified( bool ) ) );
	connect( teSource, SIGNAL( fileOpen( bool ) ), this, SLOT( fileOpened( bool ) ) );
	connect( teSource, SIGNAL( completionRequested( Completion*, TextEditor* ) ), this, SLOT( completionRequested( Completion*, TextEditor* ) ) );
	wSpace->addWindow( teSource, Qt::WindowTitleHint );
	// Connections
	QMetaObject::connectSlotsByName( this );
}