[QGIS Commit] r9534 -
branches/advanced_printing_branch2/src/app/composer
svn_qgis at osgeo.org
svn_qgis at osgeo.org
Fri Oct 24 11:54:39 EDT 2008
Author: mhugent
Date: 2008-10-24 11:54:39 -0400 (Fri, 24 Oct 2008)
New Revision: 9534
Modified:
branches/advanced_printing_branch2/src/app/composer/qgscomposer.cpp
Log:
Moved alignment and ordering tools into QToolButton
Modified: branches/advanced_printing_branch2/src/app/composer/qgscomposer.cpp
===================================================================
--- branches/advanced_printing_branch2/src/app/composer/qgscomposer.cpp 2008-10-24 14:47:38 UTC (rev 9533)
+++ branches/advanced_printing_branch2/src/app/composer/qgscomposer.cpp 2008-10-24 15:54:39 UTC (rev 9534)
@@ -58,6 +58,7 @@
#include <QSvgGenerator>
#endif
#include <QToolBar>
+#include <QToolButton>
#include <QImageWriter>
#include <QCheckBox>
#include <QSizeGrip>
@@ -92,37 +93,84 @@
QAction* ungroupItemsAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionUngroupItems.png" ) ),
tr( "&Ungroup" ), this, SLOT( ungroupItems() ) );
ungroupItemsAction->setToolTip( tr( "Ungroup items" ) );
- QAction* raiseItemsAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionRaiseItems.png" ) ),
- tr( "Raise" ), this, SLOT( raiseSelectedItems() ) );
+
+
+ QToolButton* orderingToolButton = new QToolButton(this);
+ orderingToolButton->setPopupMode(QToolButton::InstantPopup);
+ orderingToolButton->setAutoRaise(true);
+ orderingToolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
+
+ //raise
+ QAction* raiseItemsAction = new QAction(QIcon( QPixmap( myIconPath + "mActionRaiseItems.png" ) ), tr( "Raise" ), this);
+ QObject::connect(raiseItemsAction, SIGNAL(triggered()), this, SLOT( raiseSelectedItems()));
raiseItemsAction->setToolTip( tr( "Raise selected items" ) );
- QAction* lowerItemsAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionLowerItems.png" ) ),
- tr( "Lower" ), this, SLOT( lowerSelectedItems() ) );
+
+ //lower
+ QAction* lowerItemsAction = new QAction(QIcon( QPixmap( myIconPath + "mActionLowerItems.png" ) ), tr( "Lower" ), this);
+ QObject::connect(lowerItemsAction, SIGNAL(triggered()), this, SLOT(lowerSelectedItems()));
lowerItemsAction->setToolTip( tr( "Lower selected items" ) );
- QAction* moveItemsToTopAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToTop.png" ) ),
- tr( "Bring to Front" ), this, SLOT( moveSelectedItemsToTop() ) );
+
+ //move to top
+ QAction* moveItemsToTopAction = new QAction(QIcon(QPixmap( myIconPath + "mActionMoveItemsToTop.png" )), tr( "Bring to Front" ), this);
+ QObject::connect(moveItemsToTopAction, SIGNAL(triggered()), this, SLOT(moveSelectedItemsToTop()));
moveItemsToTopAction->setToolTip( tr( "Move selected items to top" ) );
- QAction* moveItemsToBottomAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionMoveItemsToBottom.png" ) ),
- tr( "Send to Back" ), this, SLOT( moveSelectedItemsToBottom() ) );
+
+ //move to bottom
+ QAction* moveItemsToBottomAction = new QAction(QIcon(QPixmap( myIconPath + "mActionMoveItemsToBottom.png")), tr( "Send to Back" ), this);
+ QObject::connect(moveItemsToBottomAction, SIGNAL(triggered()), this, SLOT(moveSelectedItemsToBottom()));
moveItemsToBottomAction->setToolTip( tr( "Move selected items to bottom" ) );
- QAction* alignLeftAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionAlignLeft.png")), tr("Align left"), this, SLOT(alignSelectedItemsLeft()));
- alignLeftAction->setToolTip( tr("Align selected items left"));
+ orderingToolButton->addAction(raiseItemsAction);
+ orderingToolButton->addAction(lowerItemsAction);
+ orderingToolButton->addAction(moveItemsToTopAction);
+ orderingToolButton->addAction(moveItemsToBottomAction);
+ orderingToolButton->setDefaultAction(raiseItemsAction);
+ toolBar->addWidget(orderingToolButton);
+
+ QToolButton* alignToolButton = new QToolButton(this);
+ alignToolButton->setPopupMode(QToolButton::InstantPopup);
+ alignToolButton->setAutoRaise(true);
+ alignToolButton->setToolButtonStyle(Qt::ToolButtonIconOnly);
- QAction* alignHCenterAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionAlignHCenter.png")), tr("Align center horizontal"), this, SLOT(alignSelectedItemsHCenter()));
+ //align left
+ QAction* alignLeftAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignLeft.png")), tr("Align left"), this);
+ QObject::connect(alignLeftAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsLeft()));
+ alignLeftAction->setToolTip(tr("Align selected items left"));
+
+ //align hcenter
+ QAction* alignHCenterAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignHCenter.png")), tr("Align center horizontal"), this);
+ QObject::connect(alignHCenterAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsHCenter()));
alignHCenterAction->setToolTip( tr("Align center horizontal"));
- QAction* alignRightAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionAlignRight.png")), tr("Align right"), this, SLOT(alignSelectedItemsRight()));
+ //align right
+ QAction* alignRightAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignRight.png")), tr("Align right"), this);
+ QObject::connect(alignRightAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsRight()));
alignRightAction->setToolTip( tr("Align selected items right"));
- QAction* alignTopAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionAlignTop.png")), tr("Align top"), this, SLOT(alignSelectedItemsTop()));
+ //align top
+ QAction* alignTopAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignTop.png")), tr("Align top"), this);
+ QObject::connect(alignTopAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsTop()));
alignTopAction->setToolTip( tr("Align selected items to top"));
+
+ //align vcenter
+ QAction* alignVCenterAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignVCenter.png")), tr("Align center vertical"), this);
+ QObject::connect(alignVCenterAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsVCenter()));
+ alignVCenterAction->setToolTip(tr("Align center vertical"));
- QAction* alignVCenterAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionAlignVCenter.png")), tr("Align center vertical"), this, SLOT(alignSelectedItemsVCenter()));
- alignVCenterAction->setToolTip( tr("Align center vertical"));
-
- QAction* alignBottomAction = toolBar->addAction( QIcon( QPixmap( myIconPath + "mActionAlignBottom.png")), tr("Align bottom"), this, SLOT(alignSelectedItemsBottom()));
+ //align bottom
+ QAction* alignBottomAction = new QAction(QIcon( QPixmap( myIconPath + "mActionAlignBottom.png")), tr("Align bottom"), this);
+ QObject::connect(alignBottomAction, SIGNAL(triggered()), this, SLOT(alignSelectedItemsBottom()));
alignBottomAction->setToolTip( tr("Align selected items bottom"));
+ alignToolButton->addAction(alignLeftAction);
+ alignToolButton->addAction(alignHCenterAction);
+ alignToolButton->addAction(alignRightAction);
+ alignToolButton->addAction(alignTopAction);
+ alignToolButton->addAction(alignVCenterAction);
+ alignToolButton->addAction(alignBottomAction);
+ alignToolButton->setDefaultAction(alignLeftAction);
+ toolBar->addWidget(alignToolButton);
+
QActionGroup* toggleActionGroup = new QActionGroup( this );
toggleActionGroup->addAction( moveItemContentAction );
toggleActionGroup->addAction( mActionAddNewMap );
More information about the QGIS-commit
mailing list