All: Reformat according to new standard
This commit is contained in:
committed by
Kacper Donat
parent
ef997f2259
commit
9fe130cd73
@@ -21,10 +21,10 @@
|
||||
***************************************************************************/
|
||||
|
||||
|
||||
# include <QApplication>
|
||||
# include <QStyle>
|
||||
# include <QToolBar>
|
||||
# include <QToolButton>
|
||||
#include <QApplication>
|
||||
#include <QStyle>
|
||||
#include <QToolBar>
|
||||
#include <QToolButton>
|
||||
|
||||
|
||||
#include "ToolBoxManager.h"
|
||||
@@ -37,12 +37,13 @@
|
||||
using namespace Gui;
|
||||
using DockWnd::ToolBox;
|
||||
|
||||
ToolBoxManager* ToolBoxManager::_instance=nullptr;
|
||||
ToolBoxManager* ToolBoxManager::_instance = nullptr;
|
||||
|
||||
ToolBoxManager* ToolBoxManager::getInstance()
|
||||
{
|
||||
if ( !_instance )
|
||||
if (!_instance) {
|
||||
_instance = new ToolBoxManager;
|
||||
}
|
||||
return _instance;
|
||||
}
|
||||
|
||||
@@ -56,19 +57,19 @@ ToolBoxManager::ToolBoxManager() = default;
|
||||
|
||||
ToolBoxManager::~ToolBoxManager() = default;
|
||||
|
||||
void ToolBoxManager::setToolBox( DockWnd::ToolBox* tb )
|
||||
void ToolBoxManager::setToolBox(DockWnd::ToolBox* tb)
|
||||
{
|
||||
_toolBox = tb;
|
||||
}
|
||||
|
||||
void ToolBoxManager::setup( ToolBarItem* toolBar ) const
|
||||
void ToolBoxManager::setup(ToolBarItem* toolBar) const
|
||||
{
|
||||
if ( !toolBar || !_toolBox )
|
||||
return; // empty tool bar
|
||||
if (!toolBar || !_toolBox) {
|
||||
return; // empty tool bar
|
||||
}
|
||||
|
||||
int ct = _toolBox->count();
|
||||
for ( int i=0; i<ct; i++ )
|
||||
{
|
||||
for (int i = 0; i < ct; i++) {
|
||||
// get always the first item widget
|
||||
QWidget* w = _toolBox->widget(0);
|
||||
_toolBox->removeItem(0);
|
||||
@@ -78,22 +79,21 @@ void ToolBoxManager::setup( ToolBarItem* toolBar ) const
|
||||
CommandManager& mgr = Application::Instance->commandManager();
|
||||
QList<ToolBarItem*> items = toolBar->getItems();
|
||||
|
||||
for ( auto item : items )
|
||||
{
|
||||
for (auto item : items) {
|
||||
auto bar = new QToolBar();
|
||||
bar->setOrientation(Qt::Vertical);
|
||||
bar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon);
|
||||
std::string toolbarName = item->command();
|
||||
bar->setObjectName(QString::fromLatin1(item->command().c_str()));
|
||||
bar->setWindowTitle(QObject::tr(toolbarName.c_str())); // i18n
|
||||
_toolBox->addItem( bar, bar->windowTitle() );
|
||||
bar->setWindowTitle(QObject::tr(toolbarName.c_str())); // i18n
|
||||
_toolBox->addItem(bar, bar->windowTitle());
|
||||
|
||||
QList<ToolBarItem*> subitems = item->getItems();
|
||||
for (auto subitem : subitems)
|
||||
{
|
||||
if ( subitem->command() == "Separator" ) {
|
||||
//bar->addSeparator();
|
||||
} else {
|
||||
for (auto subitem : subitems) {
|
||||
if (subitem->command() == "Separator") {
|
||||
// bar->addSeparator();
|
||||
}
|
||||
else {
|
||||
mgr.addTo(subitem->command().c_str(), bar);
|
||||
}
|
||||
}
|
||||
@@ -105,8 +105,7 @@ void ToolBoxManager::setup( ToolBarItem* toolBar ) const
|
||||
// When setting the horizontal size policy but no icon is set we use the following trick
|
||||
// to make the button text left aligned.
|
||||
QIcon icon = it->icon();
|
||||
if (icon.isNull())
|
||||
{
|
||||
if (icon.isNull()) {
|
||||
// Create an icon filled with the button color
|
||||
int size = QApplication::style()->pixelMetric(QStyle::PM_SmallIconSize);
|
||||
QPixmap p(size, size);
|
||||
@@ -120,7 +119,7 @@ void ToolBoxManager::setup( ToolBarItem* toolBar ) const
|
||||
void ToolBoxManager::retranslate() const
|
||||
{
|
||||
int ct = _toolBox->count();
|
||||
for (int i=0; i<ct; i++) {
|
||||
for (int i = 0; i < ct; i++) {
|
||||
// get always the first item widget
|
||||
QWidget* w = _toolBox->widget(i);
|
||||
QByteArray toolbarName = w->objectName().toUtf8();
|
||||
|
||||
Reference in New Issue
Block a user