Add ObjectsCenter action to center objects in label both h and v. (#184)
This commit is contained in:
@@ -188,6 +188,16 @@ namespace glabels
|
||||
};
|
||||
|
||||
|
||||
class Center : public QIcon
|
||||
{
|
||||
public:
|
||||
Center()
|
||||
{
|
||||
addPixmap( QPixmap( ":icons/flat/16x16/glabels-center.svg" ) );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class CenterHoriz : public QIcon
|
||||
{
|
||||
public:
|
||||
|
||||
@@ -574,6 +574,11 @@ namespace glabels
|
||||
objectsCenterVertAction->setStatusTip( tr("Vertically center objects in label") );
|
||||
connect( objectsCenterVertAction, SIGNAL(triggered()), this, SLOT(objectsCenterVert()) );
|
||||
|
||||
objectsCenterAction = new QAction( tr("Center Both"), this );
|
||||
objectsCenterAction->setIcon( Icons::Center() );
|
||||
objectsCenterAction->setStatusTip( tr("Center objects in label") );
|
||||
connect( objectsCenterAction, SIGNAL(triggered()), this, SLOT(objectsCenter()) );
|
||||
|
||||
|
||||
/* Help actions */
|
||||
helpContentsAction = new QAction( tr("&User Manual..."), this );
|
||||
@@ -698,6 +703,7 @@ namespace glabels
|
||||
objectsCenterMenu = objectsMenu->addMenu( tr("Center") );
|
||||
objectsCenterMenu->addAction( objectsCenterHorizAction );
|
||||
objectsCenterMenu->addAction( objectsCenterVertAction );
|
||||
objectsCenterMenu->addAction( objectsCenterAction );
|
||||
|
||||
helpMenu = menuBar()->addMenu( tr("&Help") );
|
||||
helpMenu->addAction( helpContentsAction );
|
||||
@@ -724,6 +730,7 @@ namespace glabels
|
||||
contextCenterMenu = contextMenu->addMenu( tr("Center") );
|
||||
contextCenterMenu->addAction( objectsCenterHorizAction );
|
||||
contextCenterMenu->addAction( objectsCenterVertAction );
|
||||
contextCenterMenu->addAction( objectsCenterAction );
|
||||
contextMenu->addSeparator();
|
||||
contextMenu->addAction( contextCutAction );
|
||||
contextMenu->addAction( contextCopyAction );
|
||||
@@ -1005,6 +1012,7 @@ namespace glabels
|
||||
objectsCenterMenu->setEnabled( isEditorPage && hasSelection );
|
||||
objectsCenterHorizAction->setEnabled( isEditorPage && hasSelection );
|
||||
objectsCenterVertAction->setEnabled( isEditorPage && hasSelection );
|
||||
objectsCenterAction->setEnabled( isEditorPage && hasSelection );
|
||||
|
||||
// Help actions
|
||||
helpContentsAction->setEnabled( true );
|
||||
@@ -1650,6 +1658,16 @@ namespace glabels
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Objects->Center Action
|
||||
///
|
||||
void MainWindow::objectsCenter()
|
||||
{
|
||||
mUndoRedoModel->checkpoint( tr("Center") );
|
||||
mModel->centerSelection();
|
||||
}
|
||||
|
||||
|
||||
///
|
||||
/// Objects->Center->Vertically Action
|
||||
///
|
||||
|
||||
@@ -142,6 +142,7 @@ namespace glabels
|
||||
void objectsAlignTop();
|
||||
void objectsAlignVCenter();
|
||||
void objectsAlignBottom();
|
||||
void objectsCenter();
|
||||
void objectsCenterHoriz();
|
||||
void objectsCenterVert();
|
||||
|
||||
@@ -301,6 +302,7 @@ namespace glabels
|
||||
QAction* objectsAlignTopAction;
|
||||
QAction* objectsAlignVCenterAction;
|
||||
QAction* objectsAlignBottomAction;
|
||||
QAction* objectsCenterAction;
|
||||
QAction* objectsCenterHorizAction;
|
||||
QAction* objectsCenterVertAction;
|
||||
|
||||
|
||||
@@ -12,6 +12,7 @@
|
||||
<file>icons/flat/16x16/glabels-arrow.svg</file>
|
||||
<file>icons/flat/16x16/glabels-barcode.svg</file>
|
||||
<file>icons/flat/16x16/glabels-box.svg</file>
|
||||
<file>icons/flat/16x16/glabels-center.svg</file>
|
||||
<file>icons/flat/16x16/glabels-center-horiz.svg</file>
|
||||
<file>icons/flat/16x16/glabels-center-vert.svg</file>
|
||||
<file>icons/flat/16x16/glabels-edit-clear.svg</file>
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" version="1.1" width="16" height="16" >
|
||||
|
||||
<path
|
||||
style="fill:#333333;fill-opacity:1;stroke:none"
|
||||
d="M 7.5,6 5,3 10,3 Z" />
|
||||
|
||||
<path
|
||||
style="fill:#333333;fill-opacity:1;stroke:none"
|
||||
d="M 7.5,9 5,12 10,12 Z" />
|
||||
|
||||
<line
|
||||
style="fill:none;stroke:#333333;stroke-opacity:1;stroke-width:1"
|
||||
x1="7.5" y1="1" x2="7.5" y2="5" />
|
||||
|
||||
<line
|
||||
style="fill:none;stroke:#333333;stroke-opacity:1;stroke-width:1"
|
||||
x1="7.5" y1="10" x2="7.5" y2="14" />
|
||||
|
||||
|
||||
<path
|
||||
style="fill:#333333;fill-opacity:1;stroke:none"
|
||||
d="M 6,7.5 3,5 3,10 Z" />
|
||||
|
||||
<path
|
||||
style="fill:#333333;fill-opacity:1;stroke:none"
|
||||
d="M 9,7.5 12,5 12,10 Z" />
|
||||
|
||||
<line
|
||||
style="fill:none;stroke:#333333;stroke-opacity:1;stroke-width:1"
|
||||
x1="1" y1="7.5" x2="5" y2="7.5" />
|
||||
|
||||
<line
|
||||
style="fill:none;stroke:#333333;stroke-opacity:1;stroke-width:1"
|
||||
x1="10" y1="7.5" x2="14" y2="7.5" />
|
||||
|
||||
|
||||
<line
|
||||
style="fill:none;stroke:#333333;stroke-opacity:1;stroke-width:1"
|
||||
x1="7" y1="7.5" x2="8" y2="7.5" />
|
||||
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.0 KiB |
Reference in New Issue
Block a user