Gui: Use auto and range-based for (#7481)
* On lines where the variable type is obvious from inspection, avoid repeating the type using auto. * When possible use a ranged for loop instead of begin() and end() iterators
This commit is contained in:
@@ -65,7 +65,7 @@ Gui::GuiNativeEvent::tdx_drv_handler(io_connect_t connection,
|
||||
//printf("tdx_drv_handler\n");
|
||||
//printf("connection: %X\n", connection);
|
||||
//printf("messageType %c%c%c%c\n", messageType/0x1000000, messageType/0x10000, messageType/0x100, messageType);
|
||||
ConnexionDeviceStatePtr msg = (ConnexionDeviceStatePtr)messageArgument;
|
||||
auto msg = (ConnexionDeviceStatePtr)messageArgument;
|
||||
|
||||
switch(messageType) {
|
||||
case kConnexionMsgDeviceState:
|
||||
|
||||
+11
-11
@@ -247,7 +247,7 @@ void ActionGroup::addTo(QWidget *w)
|
||||
// and adding this action to the widget doesn't work.
|
||||
if (_dropDown) {
|
||||
if (w->inherits("QMenu")) {
|
||||
QMenu *menu = new QMenu(w);
|
||||
auto menu = new QMenu(w);
|
||||
QAction* action = qobject_cast<QMenu*>(w)->addMenu(menu);
|
||||
action->setMenuRole(_action->menuRole());
|
||||
menu->setTitle(_action->text());
|
||||
@@ -259,7 +259,7 @@ void ActionGroup::addTo(QWidget *w)
|
||||
tb->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
tb->setObjectName(QString::fromLatin1("qt_toolbutton_menubutton"));
|
||||
QList<QAction*> acts = _group->actions();
|
||||
QMenu* menu = new QMenu(tb);
|
||||
auto menu = new QMenu(tb);
|
||||
menu->addActions(acts);
|
||||
tb->setMenu(menu);
|
||||
//tb->addActions(_group->actions());
|
||||
@@ -468,7 +468,7 @@ void WorkbenchComboBox::onActivated(int i)
|
||||
{
|
||||
// Send the event to the workbench group to delay the destruction of the emitting widget.
|
||||
int index = itemData(i).toInt();
|
||||
WorkbenchActionEvent* ev = new WorkbenchActionEvent(this->actions().at(index));
|
||||
auto ev = new WorkbenchActionEvent(this->actions().at(index));
|
||||
QApplication::postEvent(this->group, ev);
|
||||
// TODO: Test if we can use this instead
|
||||
//QTimer::singleShot(20, this->actions()[i], SLOT(trigger()));
|
||||
@@ -529,7 +529,7 @@ void WorkbenchGroup::addTo(QWidget *w)
|
||||
{
|
||||
refreshWorkbenchList();
|
||||
if (w->inherits("QToolBar")) {
|
||||
QToolBar* bar = qobject_cast<QToolBar*>(w);
|
||||
auto bar = qobject_cast<QToolBar*>(w);
|
||||
QComboBox* box = new WorkbenchComboBox(this, w);
|
||||
box->setIconSize(QSize(16, 16));
|
||||
box->setToolTip(_action->toolTip());
|
||||
@@ -540,7 +540,7 @@ void WorkbenchGroup::addTo(QWidget *w)
|
||||
bar->addWidget(box);
|
||||
}
|
||||
else if (w->inherits("QMenu")) {
|
||||
QMenu* menu = qobject_cast<QMenu*>(w);
|
||||
auto menu = qobject_cast<QMenu*>(w);
|
||||
menu = menu->addMenu(_action->text());
|
||||
menu->addActions(_group->actions());
|
||||
}
|
||||
@@ -613,7 +613,7 @@ void WorkbenchGroup::refreshWorkbenchList()
|
||||
void WorkbenchGroup::customEvent( QEvent* e )
|
||||
{
|
||||
if (e->type() == QEvent::User) {
|
||||
Gui::WorkbenchActionEvent* ce = (Gui::WorkbenchActionEvent*)e;
|
||||
auto ce = (Gui::WorkbenchActionEvent*)e;
|
||||
ce->action()->trigger();
|
||||
}
|
||||
}
|
||||
@@ -826,8 +826,8 @@ void RecentFilesAction::restore()
|
||||
_group->addAction(QLatin1String(""))->setVisible(false);
|
||||
std::vector<std::string> MRU = hGrp->GetASCIIs("MRU");
|
||||
QStringList files;
|
||||
for (std::vector<std::string>::iterator it = MRU.begin(); it!=MRU.end();++it)
|
||||
files.append(QString::fromUtf8(it->c_str()));
|
||||
for(const auto& it : MRU)
|
||||
files.append(QString::fromUtf8(it.c_str()));
|
||||
setFiles(files);
|
||||
}
|
||||
|
||||
@@ -969,9 +969,9 @@ void RecentMacrosAction::activateFile(int id)
|
||||
}
|
||||
else {
|
||||
if (QApplication::keyboardModifiers() == Qt::ShiftModifier){ //open for editing on Shift+click
|
||||
PythonEditor* editor = new PythonEditor();
|
||||
auto editor = new PythonEditor();
|
||||
editor->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
|
||||
PythonEditorView* edit = new PythonEditorView(editor, getMainWindow());
|
||||
auto edit = new PythonEditorView(editor, getMainWindow());
|
||||
edit->setDisplayName(PythonEditorView::FileName);
|
||||
edit->open(filename);
|
||||
edit->resize(400, 300);
|
||||
@@ -1212,7 +1212,7 @@ WindowAction::~WindowAction()
|
||||
|
||||
void WindowAction::addTo ( QWidget * w )
|
||||
{
|
||||
QMenu* menu = qobject_cast<QMenu*>(w);
|
||||
auto menu = qobject_cast<QMenu*>(w);
|
||||
if (!menu) {
|
||||
if (!_menu) {
|
||||
_menu = new QMenu();
|
||||
|
||||
@@ -65,7 +65,7 @@ void ActionFunction::triggered()
|
||||
{
|
||||
Q_D(ActionFunction);
|
||||
|
||||
QAction* a = qobject_cast<QAction*>(sender());
|
||||
auto a = qobject_cast<QAction*>(sender());
|
||||
QMap<QAction*, std::function<void()> >::iterator it = d->triggerMap.find(a);
|
||||
if (it != d->triggerMap.end()) {
|
||||
// invoke the class function here
|
||||
@@ -85,7 +85,7 @@ void ActionFunction::toggled(bool on)
|
||||
{
|
||||
Q_D(ActionFunction);
|
||||
|
||||
QAction* a = qobject_cast<QAction*>(sender());
|
||||
auto a = qobject_cast<QAction*>(sender());
|
||||
QMap<QAction*, std::function<void(bool)> >::iterator it = d->toggleMap.find(a);
|
||||
if (it != d->toggleMap.end()) {
|
||||
// invoke the class function here
|
||||
@@ -105,7 +105,7 @@ void ActionFunction::hovered()
|
||||
{
|
||||
Q_D(ActionFunction);
|
||||
|
||||
QAction* a = qobject_cast<QAction*>(sender());
|
||||
auto a = qobject_cast<QAction*>(sender());
|
||||
QMap<QAction*, std::function<void()> >::iterator it = d->hoverMap.find(a);
|
||||
if (it != d->hoverMap.end()) {
|
||||
// invoke the class function here
|
||||
|
||||
+15
-15
@@ -208,7 +208,7 @@ FreeCADGui_subgraphFromObject(PyObject * /*self*/, PyObject *args)
|
||||
std::string vp = obj->getViewProviderName();
|
||||
SoNode* node = nullptr;
|
||||
try {
|
||||
Base::BaseClass* base = static_cast<Base::BaseClass*>(Base::Type::createInstanceByName(vp.c_str(), true));
|
||||
auto base = static_cast<Base::BaseClass*>(Base::Type::createInstanceByName(vp.c_str(), true));
|
||||
if (base && base->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) {
|
||||
std::unique_ptr<Gui::ViewProviderDocumentObject> vp(static_cast<Gui::ViewProviderDocumentObject*>(base));
|
||||
std::map<std::string, App::Property*> Map;
|
||||
@@ -221,8 +221,8 @@ FreeCADGui_subgraphFromObject(PyObject * /*self*/, PyObject *args)
|
||||
static_cast<App::PropertyPythonObject*>(pyproxy)->setValue(Py::Long(1));
|
||||
}
|
||||
|
||||
for (std::map<std::string, App::Property*>::iterator it = Map.begin(); it != Map.end(); ++it) {
|
||||
vp->updateData(it->second);
|
||||
for (const auto & it : Map){
|
||||
vp->updateData(it.second);
|
||||
}
|
||||
|
||||
std::vector<std::string> modes = vp->getDisplayModes();
|
||||
@@ -268,7 +268,7 @@ FreeCADGui_exportSubgraph(PyObject * /*self*/, PyObject *args)
|
||||
void* ptr = nullptr;
|
||||
try {
|
||||
Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoNode *", proxy, &ptr, 0);
|
||||
SoNode* node = static_cast<SoNode*>(ptr);
|
||||
auto node = static_cast<SoNode*>(ptr);
|
||||
if (node) {
|
||||
std::string formatStr(format);
|
||||
std::string buffer;
|
||||
@@ -695,7 +695,7 @@ void Application::exportTo(const char* FileName, const char* DocName, const char
|
||||
std::stringstream str;
|
||||
std::set<App::DocumentObject*> unique_objs;
|
||||
str << "__objs__=[]" << std::endl;
|
||||
for (std::vector<App::DocumentObject*>::iterator it = sel.begin(); it != sel.end(); ++it) {
|
||||
for (auto it = sel.begin(); it != sel.end(); ++it) {
|
||||
if (unique_objs.insert(*it).second) {
|
||||
str << "__objs__.append(FreeCAD.getDocument(\"" << DocName << "\").getObject(\""
|
||||
<< (*it)->getNameInDocument() << "\"))" << std::endl;
|
||||
@@ -760,7 +760,7 @@ void Application::slotNewDocument(const App::Document& Doc, bool isMainDoc)
|
||||
std::map<const App::Document*, Gui::Document*>::const_iterator it = d->documents.find(&Doc);
|
||||
assert(it==d->documents.end());
|
||||
#endif
|
||||
Gui::Document* pDoc = new Gui::Document(const_cast<App::Document*>(&Doc),this);
|
||||
auto pDoc = new Gui::Document(const_cast<App::Document*>(&Doc),this);
|
||||
d->documents[&Doc] = pDoc;
|
||||
|
||||
// connect the signals to the application for the new document
|
||||
@@ -1552,9 +1552,9 @@ QStringList Application::workbenches() const
|
||||
{
|
||||
// If neither 'HiddenWorkbench' nor 'ExtraWorkbench' is set then all workbenches are returned.
|
||||
const std::map<std::string,std::string>& config = App::Application::Config();
|
||||
std::map<std::string, std::string>::const_iterator ht = config.find("HiddenWorkbench");
|
||||
std::map<std::string, std::string>::const_iterator et = config.find("ExtraWorkbench");
|
||||
std::map<std::string, std::string>::const_iterator st = config.find("StartWorkbench");
|
||||
auto ht = config.find("HiddenWorkbench");
|
||||
auto et = config.find("ExtraWorkbench");
|
||||
auto st = config.find("StartWorkbench");
|
||||
const char* start = (st != config.end() ? st->second.c_str() : "<none>");
|
||||
QStringList hidden, extra;
|
||||
if (ht != config.end()) {
|
||||
@@ -1914,8 +1914,8 @@ void Application::runApplication()
|
||||
// opens them
|
||||
QDir cwd = QDir::current();
|
||||
std::list<std::string> files = App::Application::getCmdLineFiles();
|
||||
for (std::list<std::string>::iterator jt = files.begin(); jt != files.end(); ++jt) {
|
||||
QString fn = QString::fromUtf8(jt->c_str(), static_cast<int>(jt->size()));
|
||||
for (const auto & file : files) {
|
||||
QString fn = QString::fromUtf8(file.c_str(), static_cast<int>(file.size()));
|
||||
QFileInfo fi(fn);
|
||||
// if path name is relative make it absolute because the running instance
|
||||
// cannot determine the full path when trying to load the file
|
||||
@@ -2041,13 +2041,13 @@ void Application::runApplication()
|
||||
|
||||
// filter wheel events for combo boxes
|
||||
if (hGrp->GetBool("ComboBoxWheelEventFilter", false)) {
|
||||
WheelEventFilter* filter = new WheelEventFilter(&mainApp);
|
||||
auto filter = new WheelEventFilter(&mainApp);
|
||||
mainApp.installEventFilter(filter);
|
||||
}
|
||||
|
||||
//filter keyboard events to substitute decimal separator
|
||||
if (hGrp->GetBool("SubstituteDecimalSeparator", false)) {
|
||||
KeyboardFilter* filter = new KeyboardFilter(&mainApp);
|
||||
auto filter = new KeyboardFilter(&mainApp);
|
||||
mainApp.installEventFilter(filter);
|
||||
}
|
||||
|
||||
@@ -2112,7 +2112,7 @@ void Application::runApplication()
|
||||
}
|
||||
QPixmap px(path);
|
||||
if (!px.isNull()) {
|
||||
QLabel* logo = new QLabel();
|
||||
auto logo = new QLabel();
|
||||
logo->setPixmap(px.scaledToHeight(32));
|
||||
mw.statusBar()->addPermanentWidget(logo, 0);
|
||||
logo->setFrameShape(QFrame::NoFrame);
|
||||
@@ -2290,7 +2290,7 @@ void Application::runApplication()
|
||||
void Application::setStyleSheet(const QString& qssFile, bool tiledBackground)
|
||||
{
|
||||
Gui::MainWindow* mw = getMainWindow();
|
||||
QMdiArea* mdi = mw->findChild<QMdiArea*>();
|
||||
auto mdi = mw->findChild<QMdiArea*>();
|
||||
mdi->setProperty("showImage", tiledBackground);
|
||||
|
||||
// Qt's style sheet doesn't support it to define the link color of a QLabel
|
||||
|
||||
@@ -645,9 +645,9 @@ PyObject* Application::sOpen(PyObject * /*self*/, PyObject *args)
|
||||
else if (ext == QLatin1String("py") ||
|
||||
ext == QLatin1String("fcmacro") ||
|
||||
ext == QLatin1String("fcscript")) {
|
||||
PythonEditor* editor = new PythonEditor();
|
||||
auto editor = new PythonEditor();
|
||||
editor->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
|
||||
PythonEditorView* edit = new PythonEditorView(editor, getMainWindow());
|
||||
auto edit = new PythonEditorView(editor, getMainWindow());
|
||||
edit->open(fileName);
|
||||
edit->resize(400, 300);
|
||||
getMainWindow()->addWindow( edit );
|
||||
@@ -719,9 +719,9 @@ PyObject* Application::sInsert(PyObject * /*self*/, PyObject *args)
|
||||
else if (ext == QLatin1String("py") ||
|
||||
ext == QLatin1String("fcmacro") ||
|
||||
ext == QLatin1String("fcscript")) {
|
||||
PythonEditor* editor = new PythonEditor();
|
||||
auto editor = new PythonEditor();
|
||||
editor->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
|
||||
PythonEditorView* edit = new PythonEditorView(editor, getMainWindow());
|
||||
auto edit = new PythonEditorView(editor, getMainWindow());
|
||||
edit->open(fileName);
|
||||
edit->resize(400, 300);
|
||||
getMainWindow()->addWindow( edit );
|
||||
@@ -769,7 +769,7 @@ PyObject* Application::sExport(PyObject * /*self*/, PyObject *args)
|
||||
ext == QLatin1String("xhtml")) {
|
||||
|
||||
// build up the graph
|
||||
SoSeparator* sep = new SoSeparator();
|
||||
auto sep = new SoSeparator();
|
||||
sep->ref();
|
||||
|
||||
for (Py::Sequence::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
@@ -804,7 +804,7 @@ PyObject* Application::sExport(PyObject * /*self*/, PyObject *args)
|
||||
if (gui_doc) {
|
||||
Gui::MDIView* view = gui_doc->getActiveView();
|
||||
if (view) {
|
||||
View3DInventor* view3d = qobject_cast<View3DInventor*>(view);
|
||||
auto view3d = qobject_cast<View3DInventor*>(view);
|
||||
if (view3d)
|
||||
view3d->viewAll();
|
||||
QPrinter printer(QPrinter::ScreenResolution);
|
||||
@@ -1495,14 +1495,14 @@ PyObject* Application::sCreateViewer(PyObject * /*self*/, PyObject *args)
|
||||
return nullptr;
|
||||
}
|
||||
else if (num_of_views == 1) {
|
||||
View3DInventor* viewer = new View3DInventor(nullptr, nullptr);
|
||||
auto viewer = new View3DInventor(nullptr, nullptr);
|
||||
if (title)
|
||||
viewer->setWindowTitle(QString::fromUtf8(title));
|
||||
Gui::getMainWindow()->addWindow(viewer);
|
||||
return viewer->getPyObject();
|
||||
}
|
||||
else {
|
||||
SplitView3DInventor* viewer = new SplitView3DInventor(num_of_views, nullptr, nullptr);
|
||||
auto viewer = new SplitView3DInventor(num_of_views, nullptr, nullptr);
|
||||
if (title)
|
||||
viewer->setWindowTitle(QString::fromUtf8(title));
|
||||
Gui::getMainWindow()->addWindow(viewer);
|
||||
|
||||
@@ -260,8 +260,8 @@ void AutoSaveProperty::slotNewObject(const App::DocumentObject& obj)
|
||||
|
||||
// if an object was deleted and then restored by an undo then add all properties
|
||||
// because this might be the data files which we may want to re-write
|
||||
for (std::vector<App::Property*>::iterator it = props.begin(); it != props.end(); ++it) {
|
||||
slotChangePropertyData(*(*it));
|
||||
for (const auto & prop : props) {
|
||||
slotChangePropertyData(*prop);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ bool RecoveryWriter::shouldWrite(const std::string& name, const Base::Persistenc
|
||||
// Property files of a view provider can always be written because
|
||||
// these are rather small files.
|
||||
if (object->isDerivedFrom(App::Property::getClassTypeId())) {
|
||||
const App::Property* prop = static_cast<const App::Property*>(object);
|
||||
const auto* prop = static_cast<const App::Property*>(object);
|
||||
const App::PropertyContainer* parent = prop->getContainer();
|
||||
if (parent && parent->isDerivedFrom(Gui::ViewProvider::getClassTypeId()))
|
||||
return true;
|
||||
@@ -381,7 +381,7 @@ void RecoveryWriter::writeFiles()
|
||||
|
||||
// For properties a copy can be created and then this can be written to disk in a thread
|
||||
if (entry.Object->isDerivedFrom(App::Property::getClassTypeId())) {
|
||||
const App::Property* prop = static_cast<const App::Property*>(entry.Object);
|
||||
const auto* prop = static_cast<const App::Property*>(entry.Object);
|
||||
QThreadPool::globalInstance()->start(new RecoveryRunnable(getModes(), DirName.c_str(), entry.FileName.c_str(), prop));
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -87,14 +87,14 @@ SoGroup *AxisOrigin::getNode() {
|
||||
pCoords->point.setNum(3);
|
||||
pCoords->point.setValues(0, 13, verts);
|
||||
|
||||
SoAutoZoomTranslation *zoom = new SoAutoZoomTranslation;
|
||||
auto zoom = new SoAutoZoomTranslation;
|
||||
zoom->scaleFactor = scale;
|
||||
|
||||
SoDrawStyle* style = new SoDrawStyle();
|
||||
auto style = new SoDrawStyle();
|
||||
style->lineWidth = lineSize;
|
||||
style->pointSize = pointSize;
|
||||
|
||||
SoMaterialBinding* matBinding = new SoMaterialBinding;
|
||||
auto matBinding = new SoMaterialBinding;
|
||||
matBinding->value = SoMaterialBinding::PER_FACE_INDEXED;
|
||||
|
||||
node->addChild(zoom);
|
||||
|
||||
@@ -63,7 +63,7 @@ PyObject* AxisOriginPy::getElementPicked(PyObject* args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SoPickedPoint *pp = static_cast<SoPickedPoint*>(ptr);
|
||||
auto pp = static_cast<SoPickedPoint*>(ptr);
|
||||
std::string name;
|
||||
if (!getAxisOriginPtr()->getElementPicked(pp,name))
|
||||
Py_Return;
|
||||
@@ -85,7 +85,7 @@ PyObject* AxisOriginPy::getDetailPath(PyObject* args)
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
SoPath *pPath = static_cast<SoPath*>(ptr);
|
||||
auto pPath = static_cast<SoPath*>(ptr);
|
||||
SoDetail *det = nullptr;
|
||||
if (!getAxisOriginPtr()->getDetailPath(sub, static_cast<SoFullPath*>(pPath), det)) {
|
||||
delete det;
|
||||
|
||||
@@ -136,8 +136,8 @@ void BitmapFactoryInst::restoreCustomPaths()
|
||||
Base::Reference<ParameterGrp> group = App::GetApplication().GetParameterGroupByPath
|
||||
("User parameter:BaseApp/Preferences/Bitmaps");
|
||||
std::vector<std::string> paths = group->GetASCIIs("CustomPath");
|
||||
for (std::vector<std::string>::iterator it = paths.begin(); it != paths.end(); ++it) {
|
||||
addPath(QString::fromUtf8(it->c_str()));
|
||||
for (auto & path : paths) {
|
||||
addPath(QString::fromUtf8(path.c_str()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -469,12 +469,12 @@ QPixmap BitmapFactoryInst::merge(const QPixmap& p1, const QPixmap& p2, bool vert
|
||||
QBitmap mask2 = p2.mask();
|
||||
mask.fill( Qt::color0 );
|
||||
|
||||
QPainter* pt1 = new QPainter(&res);
|
||||
auto* pt1 = new QPainter(&res);
|
||||
pt1->drawPixmap(0, 0, p1);
|
||||
pt1->drawPixmap(x, y, p2);
|
||||
delete pt1;
|
||||
|
||||
QPainter* pt2 = new QPainter(&mask);
|
||||
auto* pt2 = new QPainter(&mask);
|
||||
pt2->drawPixmap(0, 0, mask1);
|
||||
pt2->drawPixmap(x, y, mask2);
|
||||
delete pt2;
|
||||
|
||||
@@ -106,13 +106,13 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Keyboard handling
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
const SoKeyboardEvent * const event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
const auto event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
processed = processKeyboardEvent(event);
|
||||
}
|
||||
|
||||
// Mouse Button / Spaceball Button handling
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
const auto * const event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
@@ -197,7 +197,7 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
// Mouse Movement handling
|
||||
if (type.isDerivedFrom(SoLocation2Event::getClassTypeId())) {
|
||||
this->lockrecenter = true;
|
||||
const SoLocation2Event * const event = (const SoLocation2Event *) ev;
|
||||
const auto * const event = (const SoLocation2Event *) ev;
|
||||
if (this->currentmode == NavigationStyle::ZOOMING) {
|
||||
this->zoomByCursor(posn, prevnormalized);
|
||||
newmode = NavigationStyle::SELECTION;
|
||||
@@ -219,7 +219,7 @@ SbBool BlenderNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Spaceball & Joystick handling
|
||||
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
|
||||
const SoMotion3Event * const event = static_cast<const SoMotion3Event *>(ev);
|
||||
const auto * const event = static_cast<const SoMotion3Event *>(ev);
|
||||
if (event)
|
||||
this->processMotionEvent(event);
|
||||
processed = true;
|
||||
|
||||
@@ -100,13 +100,13 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Keyboard handling
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
const SoKeyboardEvent * const event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
const auto * const event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
processed = processKeyboardEvent(event);
|
||||
}
|
||||
|
||||
// Mouse Button / Spaceball Button handling
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
const auto * const event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
@@ -207,7 +207,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
// Mouse Movement handling
|
||||
if (type.isDerivedFrom(SoLocation2Event::getClassTypeId())) {
|
||||
this->lockrecenter = true;
|
||||
const SoLocation2Event * const event = (const SoLocation2Event *) ev;
|
||||
const auto * const event = (const SoLocation2Event *) ev;
|
||||
if (this->currentmode == NavigationStyle::ZOOMING) {
|
||||
this->zoomByCursor(posn, prevnormalized);
|
||||
processed = true;
|
||||
@@ -227,7 +227,7 @@ SbBool CADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Spaceball & Joystick handling
|
||||
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
|
||||
const SoMotion3Event * const event = static_cast<const SoMotion3Event *>(ev);
|
||||
const auto * const event = static_cast<const SoMotion3Event *>(ev);
|
||||
if (event)
|
||||
this->processMotionEvent(event);
|
||||
processed = true;
|
||||
|
||||
+18
-18
@@ -277,7 +277,7 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
|
||||
|
||||
// If we have an instance of PyObjectBase then determine whether it's valid or not
|
||||
if (PyObject_IsInstance(inst.ptr(), typeobj) == 1) {
|
||||
Base::PyObjectBase* baseobj = static_cast<Base::PyObjectBase*>(inst.ptr());
|
||||
auto baseobj = static_cast<Base::PyObjectBase*>(inst.ptr());
|
||||
validObject = baseobj->isValid();
|
||||
}
|
||||
else {
|
||||
@@ -300,14 +300,14 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
|
||||
// names. So, we add these names to the list, too.
|
||||
PyObject* appdoctypeobj = Base::getTypeAsObject(&App::DocumentPy::Type);
|
||||
if (PyObject_IsSubclass(type.ptr(), appdoctypeobj) == 1) {
|
||||
App::DocumentPy* docpy = (App::DocumentPy*)(inst.ptr());
|
||||
App::Document* document = docpy->getDocumentPtr();
|
||||
auto docpy = (App::DocumentPy*)(inst.ptr());
|
||||
auto document = docpy->getDocumentPtr();
|
||||
// Make sure that the C++ object is alive
|
||||
if (document) {
|
||||
std::vector<App::DocumentObject*> objects = document->getObjects();
|
||||
Py::List list;
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objects.begin(); it != objects.end(); ++it)
|
||||
list.append(Py::String((*it)->getNameInDocument()));
|
||||
for (const auto & object : objects)
|
||||
list.append(Py::String(object->getNameInDocument()));
|
||||
extractTipsFromObject(inst, list, tips);
|
||||
}
|
||||
}
|
||||
@@ -316,15 +316,15 @@ QMap<QString, CallTip> CallTipsList::extractTips(const QString& context) const
|
||||
// names. So, we add these names to the list, too.
|
||||
PyObject* guidoctypeobj = Base::getTypeAsObject(&Gui::DocumentPy::Type);
|
||||
if (PyObject_IsSubclass(type.ptr(), guidoctypeobj) == 1) {
|
||||
Gui::DocumentPy* docpy = (Gui::DocumentPy*)(inst.ptr());
|
||||
auto docpy = (Gui::DocumentPy*)(inst.ptr());
|
||||
if (docpy->getDocumentPtr()) {
|
||||
App::Document* document = docpy->getDocumentPtr()->getDocument();
|
||||
// Make sure that the C++ object is alive
|
||||
if (document) {
|
||||
std::vector<App::DocumentObject*> objects = document->getObjects();
|
||||
Py::List list;
|
||||
for (std::vector<App::DocumentObject*>::iterator it = objects.begin(); it != objects.end(); ++it)
|
||||
list.append(Py::String((*it)->getNameInDocument()));
|
||||
for (const auto & object : objects)
|
||||
list.append(Py::String(object->getNameInDocument()));
|
||||
extractTipsFromObject(inst, list, tips);
|
||||
}
|
||||
}
|
||||
@@ -426,7 +426,7 @@ void CallTipsList::extractTipsFromObject(Py::Object& obj, Py::List& list, QMap<Q
|
||||
|
||||
void CallTipsList::extractTipsFromProperties(Py::Object& obj, QMap<QString, CallTip>& tips) const
|
||||
{
|
||||
App::PropertyContainerPy* cont = (App::PropertyContainerPy*)(obj.ptr());
|
||||
auto cont = (App::PropertyContainerPy*)(obj.ptr());
|
||||
App::PropertyContainer* container = cont->getPropertyContainerPtr();
|
||||
// Make sure that the C++ object is alive
|
||||
if (!container)
|
||||
@@ -434,15 +434,15 @@ void CallTipsList::extractTipsFromProperties(Py::Object& obj, QMap<QString, Call
|
||||
std::map<std::string,App::Property*> Map;
|
||||
container->getPropertyMap(Map);
|
||||
|
||||
for (std::map<std::string,App::Property*>::const_iterator It=Map.begin();It!=Map.end();++It) {
|
||||
for (const auto & It : Map) {
|
||||
CallTip tip;
|
||||
QString str = QString::fromLatin1(It->first.c_str());
|
||||
QString str = QString::fromLatin1(It.first.c_str());
|
||||
tip.name = str;
|
||||
tip.type = CallTip::Property;
|
||||
QString longdoc = QString::fromUtf8(container->getPropertyDocumentation(It->second));
|
||||
QString longdoc = QString::fromUtf8(container->getPropertyDocumentation(It.second));
|
||||
// a point, mesh or shape property
|
||||
if (It->second->isDerivedFrom(Base::Type::fromName("App::PropertyComplexGeoData"))) {
|
||||
Py::Object data(It->second->getPyObject(), true);
|
||||
if (It.second->isDerivedFrom(Base::Type::fromName("App::PropertyComplexGeoData"))) {
|
||||
Py::Object data(It.second->getPyObject(), true);
|
||||
if (data.hasAttr("__doc__")) {
|
||||
Py::Object help = data.getAttr("__doc__");
|
||||
if (help.isString()) {
|
||||
@@ -594,7 +594,7 @@ bool CallTipsList::eventFilter(QObject * watched, QEvent * event)
|
||||
// This is a trick to avoid to hide the tooltip window after the defined time span
|
||||
// of 10 seconds. We just filter out all timer events to keep the label visible.
|
||||
if (watched->inherits("QLabel")) {
|
||||
QLabel* label = qobject_cast<QLabel*>(watched);
|
||||
auto label = qobject_cast<QLabel*>(watched);
|
||||
// Ignore the timer events to prevent from being closed
|
||||
if (label->windowFlags() & Qt::ToolTip && event->type() == QEvent::Timer)
|
||||
return true;
|
||||
@@ -605,7 +605,7 @@ bool CallTipsList::eventFilter(QObject * watched, QEvent * event)
|
||||
}
|
||||
else if (isVisible() && watched == textEdit) {
|
||||
if (event->type() == QEvent::KeyPress) {
|
||||
QKeyEvent* ke = (QKeyEvent*)event;
|
||||
auto ke = (QKeyEvent*)event;
|
||||
if (ke->key() == Qt::Key_Up || ke->key() == Qt::Key_Down) {
|
||||
keyPressEvent(ke);
|
||||
return true;
|
||||
@@ -648,7 +648,7 @@ bool CallTipsList::eventFilter(QObject * watched, QEvent * event)
|
||||
}
|
||||
}
|
||||
else if (event->type() == QEvent::KeyRelease) {
|
||||
QKeyEvent* ke = (QKeyEvent*)event;
|
||||
auto* ke = (QKeyEvent*)event;
|
||||
if (ke->key() == Qt::Key_Up || ke->key() == Qt::Key_Down ||
|
||||
ke->key() == Qt::Key_PageUp || ke->key() == Qt::Key_PageDown) {
|
||||
QList<QListWidgetItem *> items = selectedItems();
|
||||
@@ -694,7 +694,7 @@ void CallTipsList::callTipItemActivated(QListWidgetItem *item)
|
||||
cursor.insertText( text );
|
||||
|
||||
// get CallTip from item's UserRole-data
|
||||
CallTip callTip = item->data(Qt::UserRole).value<CallTip>();
|
||||
auto callTip = item->data(Qt::UserRole).value<CallTip>();
|
||||
|
||||
// if call completion enabled and we've something callable (method or class constructor) ...
|
||||
if (this->doCallCompletion
|
||||
|
||||
@@ -88,7 +88,7 @@ public:
|
||||
static void moveCallback(void * data, SoSensor * sensor)
|
||||
{
|
||||
Q_UNUSED(sensor);
|
||||
Private* self = static_cast<Private*>(data);
|
||||
auto self = static_cast<Private*>(data);
|
||||
if (self->view) {
|
||||
Gui::View3DInventorViewer* view = self->view->getViewer();
|
||||
SoClipPlane* clip = self->clipView;
|
||||
@@ -187,7 +187,7 @@ Clipping::Clipping(Gui::View3DInventor* view, QWidget* parent)
|
||||
Clipping* Clipping::makeDockWidget(Gui::View3DInventor* view)
|
||||
{
|
||||
// embed this dialog into a QDockWidget
|
||||
Clipping* clipping = new Clipping(view);
|
||||
auto clipping = new Clipping(view);
|
||||
Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance();
|
||||
QDockWidget* dw = pDockMgr->addDockWindow("Clipping", clipping, Qt::LeftDockWidgetArea);
|
||||
dw->setFeatures(QDockWidget::DockWidgetMovable|QDockWidget::DockWidgetFloatable);
|
||||
@@ -210,7 +210,7 @@ Clipping::~Clipping()
|
||||
void Clipping::reject()
|
||||
{
|
||||
QDialog::reject();
|
||||
QDockWidget* dw = qobject_cast<QDockWidget*>(parent());
|
||||
auto dw = qobject_cast<QDockWidget*>(parent());
|
||||
if (dw) {
|
||||
dw->deleteLater();
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ ComboView::ComboView(bool showModel, Gui::Document* pcDocument, QWidget *parent)
|
||||
{
|
||||
setWindowTitle(tr("Combo View"));
|
||||
|
||||
QGridLayout* pLayout = new QGridLayout(this);
|
||||
auto pLayout = new QGridLayout(this);
|
||||
pLayout->setSpacing( 0 );
|
||||
pLayout->setMargin ( 0 );
|
||||
|
||||
@@ -61,7 +61,7 @@ ComboView::ComboView(bool showModel, Gui::Document* pcDocument, QWidget *parent)
|
||||
connect(tabs, SIGNAL(currentChanged(int)), this, SLOT(onCurrentTabChanged(int)));
|
||||
if (showModel) {
|
||||
// splitter between tree and property view
|
||||
QSplitter *splitter = new QSplitter();
|
||||
auto splitter = new QSplitter();
|
||||
splitter->setOrientation(Qt::Vertical);
|
||||
|
||||
tree = new TreePanel("ComboView", this);
|
||||
|
||||
+35
-35
@@ -331,7 +331,7 @@ private:
|
||||
|
||||
void Command::setupCheckable(int iMsg) {
|
||||
QAction *action = nullptr;
|
||||
Gui::ActionGroup* pcActionGroup = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
auto pcActionGroup = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
if(pcActionGroup) {
|
||||
QList<QAction*> a = pcActionGroup->actions();
|
||||
assert(iMsg < a.size());
|
||||
@@ -495,7 +495,7 @@ void Command::testActive()
|
||||
}
|
||||
}
|
||||
|
||||
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
if(pcAction) {
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
const auto actions = pcAction->actions();
|
||||
@@ -802,9 +802,9 @@ void Command::_copyVisual(const char *file, int line, const App::DocumentObject
|
||||
std::string Command::getPythonTuple(const std::string& name, const std::vector<std::string>& subnames)
|
||||
{
|
||||
std::stringstream str;
|
||||
std::vector<std::string>::const_iterator last = --subnames.end();
|
||||
auto last = --subnames.end();
|
||||
str << "(App.ActiveDocument." << name << ",[";
|
||||
for (std::vector<std::string>::const_iterator it = subnames.begin();it!=subnames.end();++it){
|
||||
for (auto it = subnames.cbegin(); it!=subnames.cend(); ++it){
|
||||
str << "\"" << *it << "\"";
|
||||
if (it != last)
|
||||
str << ",";
|
||||
@@ -839,8 +839,8 @@ bool Command::isActiveObjectValid()
|
||||
void Command::updateAll(std::list<Gui::Document*> cList)
|
||||
{
|
||||
if (!cList.empty()) {
|
||||
for (std::list<Gui::Document*>::iterator It= cList.begin();It!=cList.end();++It)
|
||||
(*It)->onUpdate();
|
||||
for (auto & it : cList)
|
||||
it->onUpdate();
|
||||
}
|
||||
else {
|
||||
Gui::Application::Instance->onUpdate();
|
||||
@@ -922,12 +922,12 @@ const char* Command::keySequenceToAccel(int sk) const
|
||||
/* Local class to ensure free()'ing the strings allocated below */
|
||||
using StringMap = std::map<int, std::string>;
|
||||
static StringMap strings;
|
||||
StringMap::iterator i = strings.find(sk);
|
||||
auto i = strings.find(sk);
|
||||
|
||||
if (i != strings.end())
|
||||
return i->second.c_str();
|
||||
|
||||
QKeySequence::StandardKey type = (QKeySequence::StandardKey)sk;
|
||||
auto type = (QKeySequence::StandardKey)sk;
|
||||
QKeySequence ks(type);
|
||||
QString qs = ks.toString();
|
||||
QByteArray data = qs.toLatin1();
|
||||
@@ -939,7 +939,7 @@ void Command::adjustCameraPosition()
|
||||
{
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
if (doc) {
|
||||
Gui::View3DInventor* view = static_cast<Gui::View3DInventor*>(doc->getActiveView());
|
||||
auto view = static_cast<Gui::View3DInventor*>(doc->getActiveView());
|
||||
Gui::View3DInventorViewer* viewer = view->getViewer();
|
||||
SoCamera* camera = viewer->getSoRenderManager()->getCamera();
|
||||
if (!camera || !camera->isOfType(SoOrthographicCamera::getClassTypeId()))
|
||||
@@ -1031,7 +1031,7 @@ Command *GroupCommand::addCommand(const char *name) {
|
||||
}
|
||||
|
||||
Action * GroupCommand::createAction() {
|
||||
ActionGroup* pcAction = new ActionGroup(this, getMainWindow());
|
||||
auto pcAction = new ActionGroup(this, getMainWindow());
|
||||
pcAction->setMenuRole(QAction::NoRole);
|
||||
pcAction->setDropDownMenu(true);
|
||||
pcAction->setExclusive(false);
|
||||
@@ -1190,17 +1190,17 @@ void MacroCommand::load()
|
||||
if (hGrp->HasGroup("Macros")) {
|
||||
hGrp = hGrp->GetGroup("Macros");
|
||||
std::vector<Base::Reference<ParameterGrp> > macros = hGrp->GetGroups();
|
||||
for (std::vector<Base::Reference<ParameterGrp> >::iterator it = macros.begin(); it!=macros.end(); ++it ) {
|
||||
MacroCommand* macro = new MacroCommand((*it)->GetGroupName());
|
||||
macro->setScriptName ( (*it)->GetASCII( "Script" ).c_str() );
|
||||
macro->setMenuText ( (*it)->GetASCII( "Menu" ).c_str() );
|
||||
macro->setToolTipText ( (*it)->GetASCII( "Tooltip" ).c_str() );
|
||||
macro->setWhatsThis ( (*it)->GetASCII( "WhatsThis" ).c_str() );
|
||||
macro->setStatusTip ( (*it)->GetASCII( "Statustip" ).c_str() );
|
||||
if ((*it)->GetASCII("Pixmap", "nix") != "nix")
|
||||
macro->setPixmap ( (*it)->GetASCII( "Pixmap" ).c_str() );
|
||||
macro->setAccel ( (*it)->GetASCII( "Accel",nullptr ).c_str() );
|
||||
macro->systemMacro = (*it)->GetBool("System", false);
|
||||
for (const auto & it : macros) {
|
||||
auto macro = new MacroCommand(it->GetGroupName());
|
||||
macro->setScriptName ( it->GetASCII( "Script" ).c_str() );
|
||||
macro->setMenuText ( it->GetASCII( "Menu" ).c_str() );
|
||||
macro->setToolTipText ( it->GetASCII( "Tooltip" ).c_str() );
|
||||
macro->setWhatsThis ( it->GetASCII( "WhatsThis" ).c_str() );
|
||||
macro->setStatusTip ( it->GetASCII( "Statustip" ).c_str() );
|
||||
if (it->GetASCII("Pixmap", "nix") != "nix")
|
||||
macro->setPixmap ( it->GetASCII( "Pixmap" ).c_str() );
|
||||
macro->setAccel ( it->GetASCII( "Accel",nullptr ).c_str() );
|
||||
macro->systemMacro = it->GetBool("System", false);
|
||||
Application::Instance->commandManager().addCommand( macro );
|
||||
}
|
||||
}
|
||||
@@ -1213,8 +1213,8 @@ void MacroCommand::save()
|
||||
|
||||
std::vector<Command*> macros = Application::Instance->commandManager().getGroupCommands("Macros");
|
||||
if ( !macros.empty() ) {
|
||||
for (std::vector<Command*>::iterator it = macros.begin(); it!=macros.end(); ++it ) {
|
||||
MacroCommand* macro = (MacroCommand*)(*it);
|
||||
for (const auto & it : macros) {
|
||||
auto macro = (MacroCommand*)it;
|
||||
ParameterGrp::handle hMacro = hGrp->GetGroup(macro->getName());
|
||||
hMacro->SetASCII( "Script", macro->getScriptName () );
|
||||
hMacro->SetASCII( "Menu", macro->getMenuText () );
|
||||
@@ -1358,7 +1358,7 @@ const char* PythonCommand::getHelpUrl() const
|
||||
|
||||
Action * PythonCommand::createAction()
|
||||
{
|
||||
QAction* qtAction = new QAction(nullptr);
|
||||
auto qtAction = new QAction(nullptr);
|
||||
Action *pcAction;
|
||||
|
||||
pcAction = new Action(this, qtAction, getMainWindow());
|
||||
@@ -1489,7 +1489,7 @@ PythonGroupCommand::~PythonGroupCommand()
|
||||
void PythonGroupCommand::activated(int iMsg)
|
||||
{
|
||||
try {
|
||||
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
QList<QAction*> a = pcAction->actions();
|
||||
assert(iMsg < a.size());
|
||||
QAction* act = a[iMsg];
|
||||
@@ -1549,7 +1549,7 @@ bool PythonGroupCommand::isActive()
|
||||
|
||||
Action * PythonGroupCommand::createAction()
|
||||
{
|
||||
Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||
auto pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||
pcAction->setDropDownMenu(hasDropDownMenu());
|
||||
pcAction->setExclusive(isExclusive());
|
||||
|
||||
@@ -1636,10 +1636,10 @@ void PythonGroupCommand::languageChange()
|
||||
applyCommandData(this->getName(), _pcAction);
|
||||
|
||||
Gui::CommandManager &rcCmdMgr = Gui::Application::Instance->commandManager();
|
||||
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
auto* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
QList<QAction*> a = pcAction->actions();
|
||||
for (QList<QAction*>::iterator it = a.begin(); it != a.end(); ++it) {
|
||||
Gui::Command* cmd = rcCmdMgr.getCommandByName((*it)->property("CommandName").toByteArray());
|
||||
for (const auto & it : a) {
|
||||
Gui::Command* cmd = rcCmdMgr.getCommandByName(it->property("CommandName").toByteArray());
|
||||
if (cmd) {
|
||||
// Python command use getName as context
|
||||
const char *context = dynamic_cast<PythonCommand*>(cmd) ? cmd->getName() : cmd->className();
|
||||
@@ -1649,10 +1649,10 @@ void PythonGroupCommand::languageChange()
|
||||
statustip = tooltip;
|
||||
}
|
||||
|
||||
(*it)->setIcon(Gui::BitmapFactory().iconFromTheme(cmd->getPixmap()));
|
||||
(*it)->setText(QApplication::translate(context, cmd->getMenuText()));
|
||||
(*it)->setToolTip(QApplication::translate(context, tooltip));
|
||||
(*it)->setStatusTip(QApplication::translate(context, statustip));
|
||||
it->setIcon(Gui::BitmapFactory().iconFromTheme(cmd->getPixmap()));
|
||||
it->setText(QApplication::translate(context, cmd->getMenuText()));
|
||||
it->setToolTip(QApplication::translate(context, tooltip));
|
||||
it->setStatusTip(QApplication::translate(context, statustip));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1887,8 +1887,8 @@ void CommandManager::updateCommands(const char* sContext, int mode)
|
||||
{
|
||||
std::map<std::string, std::list<std::string> >::iterator it = _sCommandModes.find(sContext);
|
||||
if (it != _sCommandModes.end()) {
|
||||
for (std::list<std::string>::iterator jt = it->second.begin(); jt != it->second.end(); ++jt) {
|
||||
Command* cmd = getCommandByName(jt->c_str());
|
||||
for (const auto & jt : it->second) {
|
||||
Command* cmd = getCommandByName(jt.c_str());
|
||||
if (cmd) {
|
||||
cmd->updateAction(mode);
|
||||
}
|
||||
|
||||
@@ -235,8 +235,8 @@ void StdCmdImport::activated(int iMsg)
|
||||
if (emptyDoc) {
|
||||
// only do a view fit if the document was empty before. See also parameter 'AutoFitToView' in importFrom()
|
||||
std::list<Gui::MDIView*> views = getActiveGuiDocument()->getMDIViewsOfType(Gui::View3DInventor::getClassTypeId());
|
||||
for (std::list<MDIView*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
(*it)->viewAll();
|
||||
for (const auto & view : views) {
|
||||
view->viewAll();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -571,7 +571,7 @@ void StdCmdDependencyGraph::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
Gui::GraphvizView* view = new Gui::GraphvizView(*doc);
|
||||
auto view = new Gui::GraphvizView(*doc);
|
||||
view->setWindowTitle(qApp->translate("Std_DependencyGraph","Dependency graph"));
|
||||
getMainWindow()->addWindow(view);
|
||||
}
|
||||
@@ -1495,7 +1495,7 @@ void StdCmdPlacement::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
std::vector<App::DocumentObject*> sel = Gui::Selection().getObjectsOfType(App::GeoFeature::getClassTypeId());
|
||||
Gui::Dialog::TaskPlacement* plm = new Gui::Dialog::TaskPlacement();
|
||||
auto plm = new Gui::Dialog::TaskPlacement();
|
||||
if (!sel.empty()) {
|
||||
App::Property* prop = sel.front()->getPropertyByName("Placement");
|
||||
if (prop && prop->getTypeId() == App::PropertyPlacement::getClassTypeId())
|
||||
@@ -1585,7 +1585,7 @@ void StdCmdAlignment::activated(int iMsg)
|
||||
Base::Vector3d upDir(0,1,0), viewDir(0,0,-1);
|
||||
Gui::Document* doc = Application::Instance->activeDocument();
|
||||
if (doc) {
|
||||
View3DInventor* mdi = qobject_cast<View3DInventor*>(doc->getActiveView());
|
||||
auto mdi = qobject_cast<View3DInventor*>(doc->getActiveView());
|
||||
if (mdi) {
|
||||
View3DInventorViewer* viewer = mdi->getViewer();
|
||||
SoCamera* camera = viewer->getSoRenderManager()->getCamera();
|
||||
@@ -1706,7 +1706,7 @@ protected:
|
||||
}
|
||||
|
||||
Gui::Action * createAction() override {
|
||||
ActionGroup* pcAction = new ActionGroup(this, getMainWindow());
|
||||
auto pcAction = new ActionGroup(this, getMainWindow());
|
||||
pcAction->setDropDownMenu(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
|
||||
|
||||
+14
-14
@@ -88,24 +88,24 @@ void StdCmdRandomColor::activated(int iMsg)
|
||||
|
||||
// get the complete selection
|
||||
std::vector<SelectionSingleton::SelObj> sel = Selection().getCompleteSelection();
|
||||
for (std::vector<SelectionSingleton::SelObj>::iterator it = sel.begin(); it != sel.end(); ++it) {
|
||||
float fMax = (float)RAND_MAX;
|
||||
float fRed = (float)rand()/fMax;
|
||||
float fGrn = (float)rand()/fMax;
|
||||
float fBlu = (float)rand()/fMax;
|
||||
for (const auto & it : sel) {
|
||||
auto fMax = (float)RAND_MAX;
|
||||
auto fRed = (float)rand()/fMax;
|
||||
auto fGrn = (float)rand()/fMax;
|
||||
auto fBlu = (float)rand()/fMax;
|
||||
|
||||
ViewProvider* view = Application::Instance->getDocument(it->pDoc)->getViewProvider(it->pObject);
|
||||
ViewProvider* view = Application::Instance->getDocument(it.pDoc)->getViewProvider(it.pObject);
|
||||
auto vpLink = dynamic_cast<ViewProviderLink*>(view);
|
||||
if(vpLink) {
|
||||
if(!vpLink->OverrideMaterial.getValue())
|
||||
cmdGuiObjectArgs(it->pObject, "OverrideMaterial = True");
|
||||
cmdGuiObjectArgs(it->pObject, "ShapeMaterial.DiffuseColor=(%.2f,%.2f,%.2f)", fRed, fGrn, fBlu);
|
||||
cmdGuiObjectArgs(it.pObject, "OverrideMaterial = True");
|
||||
cmdGuiObjectArgs(it.pObject, "ShapeMaterial.DiffuseColor=(%.2f,%.2f,%.2f)", fRed, fGrn, fBlu);
|
||||
continue;
|
||||
}
|
||||
auto color = dynamic_cast<App::PropertyColor*>(view->getPropertyByName("ShapeColor"));
|
||||
if (color) {
|
||||
// get the view provider of the selected object and set the shape color
|
||||
cmdGuiObjectArgs(it->pObject, "ShapeColor=(%.2f,%.2f,%.2f)", fRed, fGrn, fBlu);
|
||||
cmdGuiObjectArgs(it.pObject, "ShapeColor=(%.2f,%.2f,%.2f)", fRed, fGrn, fBlu);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,14 +165,14 @@ void StdCmdSendToPythonConsole::activated(int iMsg)
|
||||
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
|
||||
cmd = QString::fromLatin1("obj = lnk.getLinkedObject()");
|
||||
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
|
||||
const App::Link* link = static_cast<const App::Link*>(obj);
|
||||
const auto link = static_cast<const App::Link*>(obj);
|
||||
obj = link->getLinkedObject();
|
||||
} else {
|
||||
cmd = QString::fromLatin1("obj = doc.getObject(\"%1\")").arg(objname);
|
||||
Gui::Command::runCommand(Gui::Command::Gui,cmd.toLatin1());
|
||||
}
|
||||
if (obj->getTypeId().isDerivedFrom(App::GeoFeature::getClassTypeId())) {
|
||||
const App::GeoFeature* geoObj = static_cast<const App::GeoFeature*>(obj);
|
||||
const auto geoObj = static_cast<const App::GeoFeature*>(obj);
|
||||
const App::PropertyGeometry* geo = geoObj->getPropertyOfGeometry();
|
||||
if (geo){
|
||||
cmd = QString::fromLatin1("shp = obj.") + QLatin1String(geo->getName()); //"Shape", "Mesh", "Points", etc.
|
||||
@@ -185,8 +185,8 @@ void StdCmdSendToPythonConsole::activated(int iMsg)
|
||||
if (subnames.size() > 1) {
|
||||
std::ostringstream strm;
|
||||
strm << "subs = [";
|
||||
for (std::vector<std::string>::iterator it = subnames.begin(); it != subnames.end(); ++it) {
|
||||
strm << "obj.getSubObject(\"" << *it << "\"),";
|
||||
for (const auto & subname : subnames) {
|
||||
strm << "obj.getSubObject(\"" << subname << "\"),";
|
||||
}
|
||||
strm << "]";
|
||||
Gui::Command::runCommand(Gui::Command::Gui, strm.str().c_str());
|
||||
@@ -196,7 +196,7 @@ void StdCmdSendToPythonConsole::activated(int iMsg)
|
||||
}
|
||||
//show the python console if it's not already visible, and set the keyboard focus to it
|
||||
QWidget* pc = DockWindowManager::instance()->getDockWindow("Python console");
|
||||
PythonConsole *pcPython = qobject_cast<PythonConsole*>(pc);
|
||||
auto pcPython = qobject_cast<PythonConsole*>(pc);
|
||||
if (pcPython) {
|
||||
DockWindowManager::instance()->activate(pcPython);
|
||||
pcPython->setFocus();
|
||||
|
||||
@@ -88,7 +88,7 @@ bool StdCmdLinkMakeGroup::isActive() {
|
||||
|
||||
Action * StdCmdLinkMakeGroup::createAction()
|
||||
{
|
||||
ActionGroup* pcAction = new ActionGroup(this, getMainWindow());
|
||||
auto pcAction = new ActionGroup(this, getMainWindow());
|
||||
pcAction->setDropDownMenu(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
|
||||
@@ -109,7 +109,7 @@ void StdCmdLinkMakeGroup::languageChange()
|
||||
|
||||
if (!_pcAction)
|
||||
return;
|
||||
ActionGroup* pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
QList<QAction*> acts = pcAction->actions();
|
||||
acts[0]->setText(QObject::tr("Simple group"));
|
||||
acts[1]->setText(QObject::tr("Group with links"));
|
||||
|
||||
@@ -52,7 +52,7 @@ PyObject* CommandPy::get(PyObject *args)
|
||||
|
||||
Command* cmd = Application::Instance->commandManager().getCommandByName(pName);
|
||||
if (cmd) {
|
||||
CommandPy* cmdPy = new CommandPy(cmd);
|
||||
auto cmdPy = new CommandPy(cmd);
|
||||
return cmdPy;
|
||||
}
|
||||
|
||||
@@ -76,8 +76,8 @@ PyObject* CommandPy::listAll(PyObject *args)
|
||||
std::vector <Command*> cmds = Application::Instance->commandManager().getAllCommands();
|
||||
PyObject* pyList = PyList_New(cmds.size());
|
||||
int i=0;
|
||||
for ( std::vector<Command*>::iterator it = cmds.begin(); it != cmds.end(); ++it ) {
|
||||
PyObject* str = PyUnicode_FromString((*it)->getName());
|
||||
for (const auto & cmd : cmds) {
|
||||
PyObject* str = PyUnicode_FromString(cmd->getName());
|
||||
PyList_SetItem(pyList, i++, str);
|
||||
}
|
||||
return pyList;
|
||||
@@ -302,7 +302,7 @@ PyObject* CommandPy::getAction(PyObject *args)
|
||||
Command* cmd = this->getCommandPtr();
|
||||
if (cmd) {
|
||||
Action* action = cmd->getAction();
|
||||
ActionGroup* group = qobject_cast<ActionGroup*>(action);
|
||||
auto* group = qobject_cast<ActionGroup*>(action);
|
||||
|
||||
PythonWrapper wrap;
|
||||
wrap.loadWidgetsModule();
|
||||
@@ -342,7 +342,7 @@ PyObject* CommandPy::createCustomCommand(PyObject* args, PyObject* kw)
|
||||
|
||||
auto name = Application::Instance->commandManager().newMacroName();
|
||||
CommandManager& commandManager = Application::Instance->commandManager();
|
||||
MacroCommand* macro = new MacroCommand(name.c_str(), false);
|
||||
auto macro = new MacroCommand(name.c_str(), false);
|
||||
commandManager.addCommand(macro);
|
||||
|
||||
macro->setScriptName(macroFile);
|
||||
|
||||
@@ -145,7 +145,7 @@ StdCmdRecentFiles::StdCmdRecentFiles()
|
||||
*/
|
||||
void StdCmdRecentFiles::activated(int iMsg)
|
||||
{
|
||||
RecentFilesAction* act = qobject_cast<RecentFilesAction*>(_pcAction);
|
||||
auto act = qobject_cast<RecentFilesAction*>(_pcAction);
|
||||
if (act) act->activateFile( iMsg );
|
||||
}
|
||||
|
||||
@@ -154,7 +154,7 @@ void StdCmdRecentFiles::activated(int iMsg)
|
||||
*/
|
||||
Action * StdCmdRecentFiles::createAction()
|
||||
{
|
||||
RecentFilesAction* pcAction = new RecentFilesAction(this, getMainWindow());
|
||||
auto pcAction = new RecentFilesAction(this, getMainWindow());
|
||||
pcAction->setObjectName(QLatin1String("recentFiles"));
|
||||
pcAction->setDropDownMenu(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
@@ -185,7 +185,7 @@ StdCmdRecentMacros::StdCmdRecentMacros()
|
||||
*/
|
||||
void StdCmdRecentMacros::activated(int iMsg)
|
||||
{
|
||||
RecentMacrosAction* act = qobject_cast<RecentMacrosAction*>(_pcAction);
|
||||
auto act = qobject_cast<RecentMacrosAction*>(_pcAction);
|
||||
if (act) act->activateFile( iMsg );
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ void StdCmdRecentMacros::activated(int iMsg)
|
||||
*/
|
||||
Action * StdCmdRecentMacros::createAction()
|
||||
{
|
||||
RecentMacrosAction* pcAction = new RecentMacrosAction(this, getMainWindow());
|
||||
auto pcAction = new RecentMacrosAction(this, getMainWindow());
|
||||
pcAction->setObjectName(QLatin1String("recentMacros"));
|
||||
pcAction->setDropDownMenu(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
@@ -828,7 +828,7 @@ StdCmdUnitsCalculator::StdCmdUnitsCalculator()
|
||||
void StdCmdUnitsCalculator::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::Dialog::DlgUnitsCalculator *dlg = new Gui::Dialog::DlgUnitsCalculator( getMainWindow() );
|
||||
auto dlg = new Gui::Dialog::DlgUnitsCalculator( getMainWindow() );
|
||||
dlg->show();
|
||||
}
|
||||
|
||||
@@ -865,7 +865,7 @@ StdCmdUserEditMode::StdCmdUserEditMode()
|
||||
|
||||
Gui::Action * StdCmdUserEditMode::createAction()
|
||||
{
|
||||
Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||
auto pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||
pcAction->setDropDownMenu(true);
|
||||
pcAction->setIsMode(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
@@ -900,7 +900,7 @@ void StdCmdUserEditMode::languageChange()
|
||||
|
||||
if (!_pcAction)
|
||||
return;
|
||||
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
QList<QAction*> a = pcAction->actions();
|
||||
|
||||
for (int i = 0 ; i < a.count() ; i++) {
|
||||
@@ -914,7 +914,7 @@ void StdCmdUserEditMode::languageChange()
|
||||
|
||||
void StdCmdUserEditMode::updateIcon(int mode)
|
||||
{
|
||||
Gui::ActionGroup *actionGroup = dynamic_cast<Gui::ActionGroup *>(_pcAction);
|
||||
auto actionGroup = dynamic_cast<Gui::ActionGroup *>(_pcAction);
|
||||
if (!actionGroup)
|
||||
return;
|
||||
|
||||
|
||||
@@ -78,7 +78,7 @@ void Std_TestQM::activated(int iMsg)
|
||||
for (QList<QTranslator*>::Iterator it = i18n.begin(); it != i18n.end(); ++it)
|
||||
qApp->removeTranslator(*it);
|
||||
for (QStringList::Iterator it = files.begin(); it != files.end(); ++it) {
|
||||
QTranslator* translator = new QTranslator(qApp);
|
||||
auto translator = new QTranslator(qApp);
|
||||
if (translator->load(*it)) {
|
||||
qApp->installTranslator(translator);
|
||||
}
|
||||
@@ -515,7 +515,7 @@ void CmdTestProgress4::activated(int iMsg)
|
||||
try
|
||||
{
|
||||
unsigned long steps = 50;
|
||||
Base::SequencerLauncher* seq = new Base::SequencerLauncher("Starting progress bar", steps);
|
||||
auto seq = new Base::SequencerLauncher("Starting progress bar", steps);
|
||||
|
||||
for (unsigned long i=0; i<steps;i++)
|
||||
{
|
||||
@@ -602,12 +602,12 @@ void CmdTestProgress5::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
QEventLoop loop;
|
||||
|
||||
BarThread* thr1 = new BarThread(2000);
|
||||
auto thr1 = new BarThread(2000);
|
||||
QObject::connect(thr1, SIGNAL(finished()), &loop, SLOT(quit()));
|
||||
thr1->start();
|
||||
loop.exec();
|
||||
|
||||
BarThread* thr2 = new BarThread(1500);
|
||||
auto thr2 = new BarThread(1500);
|
||||
|
||||
QTimer timer;
|
||||
timer.setSingleShot(true);
|
||||
@@ -616,7 +616,7 @@ void CmdTestProgress5::activated(int iMsg)
|
||||
timer.start(2000); // 2s timeout
|
||||
loop.exec();
|
||||
|
||||
BarThread* thr3 = new BarThread(1000);
|
||||
auto thr3 = new BarThread(1000);
|
||||
thr3->start();
|
||||
}
|
||||
|
||||
|
||||
+59
-60
@@ -106,7 +106,7 @@ StdOrthographicCamera::StdOrthographicCamera()
|
||||
void StdOrthographicCamera::activated(int iMsg)
|
||||
{
|
||||
if (iMsg == 1) {
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
SoCamera* cam = view->getViewer()->getSoRenderManager()->getCamera();
|
||||
if (!cam || cam->getTypeId() != SoOrthographicCamera::getClassTypeId())
|
||||
|
||||
@@ -116,7 +116,7 @@ void StdOrthographicCamera::activated(int iMsg)
|
||||
|
||||
bool StdOrthographicCamera::isActive()
|
||||
{
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
// update the action group if needed
|
||||
bool check = _pcAction->isChecked();
|
||||
@@ -156,7 +156,7 @@ StdPerspectiveCamera::StdPerspectiveCamera()
|
||||
void StdPerspectiveCamera::activated(int iMsg)
|
||||
{
|
||||
if (iMsg == 1) {
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
SoCamera* cam = view->getViewer()->getSoRenderManager()->getCamera();
|
||||
if (!cam || cam->getTypeId() != SoPerspectiveCamera::getClassTypeId())
|
||||
|
||||
@@ -166,7 +166,7 @@ void StdPerspectiveCamera::activated(int iMsg)
|
||||
|
||||
bool StdPerspectiveCamera::isActive()
|
||||
{
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
// update the action group if needed
|
||||
bool check = _pcAction->isChecked();
|
||||
@@ -215,7 +215,7 @@ void StdCmdViewSaveCamera::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::View3DInventor* view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
view->getViewer()->saveHomePosition();
|
||||
}
|
||||
@@ -241,7 +241,7 @@ void StdCmdViewRestoreCamera::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
|
||||
Gui::View3DInventor* view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<Gui::View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
view->getViewer()->resetToHomePosition();
|
||||
}
|
||||
@@ -299,7 +299,7 @@ StdCmdFreezeViews::StdCmdFreezeViews()
|
||||
|
||||
Action * StdCmdFreezeViews::createAction()
|
||||
{
|
||||
ActionGroup* pcAction = new ActionGroup(this, getMainWindow());
|
||||
auto pcAction = new ActionGroup(this, getMainWindow());
|
||||
pcAction->setDropDownMenu(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
|
||||
@@ -327,7 +327,7 @@ Action * StdCmdFreezeViews::createAction()
|
||||
|
||||
void StdCmdFreezeViews::activated(int iMsg)
|
||||
{
|
||||
ActionGroup* pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
|
||||
if (iMsg == 0) {
|
||||
onSaveViews();
|
||||
@@ -382,7 +382,7 @@ void StdCmdFreezeViews::onSaveViews()
|
||||
if (file.open(QFile::WriteOnly))
|
||||
{
|
||||
QTextStream str(&file);
|
||||
ActionGroup* pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
QList<QAction*> acts = pcAction->actions();
|
||||
str << "<?xml version='1.0' encoding='utf-8'?>\n"
|
||||
<< "<FrozenViews SchemaVersion=\"1\">\n";
|
||||
@@ -474,7 +474,7 @@ void StdCmdFreezeViews::onRestoreViews()
|
||||
// use this rather than the attribute 'Count' because it could be
|
||||
// changed from outside
|
||||
int ct = cameras.count();
|
||||
ActionGroup* pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
QList<QAction*> acts = pcAction->actions();
|
||||
|
||||
int numRestoredViews = std::min<int>(ct, acts.size()-offset);
|
||||
@@ -501,7 +501,7 @@ void StdCmdFreezeViews::onRestoreViews()
|
||||
|
||||
bool StdCmdFreezeViews::isActive()
|
||||
{
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
saveView->setEnabled(savedViews > 0);
|
||||
freezeView->setEnabled(savedViews < maxViews);
|
||||
@@ -522,7 +522,7 @@ void StdCmdFreezeViews::languageChange()
|
||||
|
||||
if (!_pcAction)
|
||||
return;
|
||||
ActionGroup* pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<ActionGroup*>(_pcAction);
|
||||
QList<QAction*> acts = pcAction->actions();
|
||||
acts[0]->setText(QObject::tr("Save views..."));
|
||||
acts[1]->setText(QObject::tr("Load views..."));
|
||||
@@ -558,7 +558,7 @@ StdCmdToggleClipPlane::StdCmdToggleClipPlane()
|
||||
|
||||
Action * StdCmdToggleClipPlane::createAction()
|
||||
{
|
||||
Action *pcAction = (Action*)Command::createAction();
|
||||
auto pcAction = (Action*)Command::createAction();
|
||||
return pcAction;
|
||||
}
|
||||
|
||||
@@ -567,7 +567,7 @@ void StdCmdToggleClipPlane::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
static QPointer<Gui::Dialog::Clipping> clipping = nullptr;
|
||||
if (!clipping) {
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
clipping = Gui::Dialog::Clipping::makeDockWidget(view);
|
||||
}
|
||||
@@ -576,7 +576,7 @@ void StdCmdToggleClipPlane::activated(int iMsg)
|
||||
|
||||
bool StdCmdToggleClipPlane::isActive()
|
||||
{
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
return view ? true : false;
|
||||
}
|
||||
|
||||
@@ -613,7 +613,7 @@ StdCmdDrawStyle::StdCmdDrawStyle()
|
||||
|
||||
Gui::Action * StdCmdDrawStyle::createAction()
|
||||
{
|
||||
Gui::ActionGroup* pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||
auto pcAction = new Gui::ActionGroup(this, Gui::getMainWindow());
|
||||
pcAction->setDropDownMenu(true);
|
||||
pcAction->setIsMode(true);
|
||||
applyCommandData(this->className(), pcAction);
|
||||
@@ -675,7 +675,7 @@ void StdCmdDrawStyle::languageChange()
|
||||
|
||||
if (!_pcAction)
|
||||
return;
|
||||
Gui::ActionGroup* pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
auto pcAction = qobject_cast<Gui::ActionGroup*>(_pcAction);
|
||||
QList<QAction*> a = pcAction->actions();
|
||||
|
||||
a[0]->setText(QCoreApplication::translate(
|
||||
@@ -716,14 +716,14 @@ void StdCmdDrawStyle::languageChange()
|
||||
|
||||
void StdCmdDrawStyle::updateIcon(const MDIView *view)
|
||||
{
|
||||
const Gui::View3DInventor *view3d = dynamic_cast<const Gui::View3DInventor *>(view);
|
||||
const auto view3d = dynamic_cast<const Gui::View3DInventor *>(view);
|
||||
if (!view3d)
|
||||
return;
|
||||
Gui::View3DInventorViewer *viewer = view3d->getViewer();
|
||||
if (!viewer)
|
||||
return;
|
||||
std::string mode(viewer->getOverrideMode());
|
||||
Gui::ActionGroup *actionGroup = dynamic_cast<Gui::ActionGroup *>(_pcAction);
|
||||
auto actionGroup = dynamic_cast<Gui::ActionGroup *>(_pcAction);
|
||||
if (!actionGroup)
|
||||
return;
|
||||
|
||||
@@ -768,7 +768,7 @@ void StdCmdDrawStyle::activated(int iMsg)
|
||||
bool oneChangedSignal(false);
|
||||
for (viewIt = views.begin(); viewIt != views.end(); ++viewIt)
|
||||
{
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(*viewIt);
|
||||
auto view = qobject_cast<View3DInventor*>(*viewIt);
|
||||
if (view)
|
||||
{
|
||||
View3DInventorViewer* viewer;
|
||||
@@ -862,21 +862,20 @@ void StdCmdToggleSelectability::activated(int iMsg)
|
||||
Q_UNUSED(iMsg);
|
||||
// go through all documents
|
||||
const std::vector<App::Document*> docs = App::GetApplication().getDocuments();
|
||||
for (std::vector<App::Document*>::const_iterator it = docs.begin(); it != docs.end(); ++it) {
|
||||
Document *pcDoc = Application::Instance->getDocument(*it);
|
||||
for (const auto & doc : docs) {
|
||||
Document *pcDoc = Application::Instance->getDocument(doc);
|
||||
std::vector<App::DocumentObject*> sel = Selection().getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId(), (*it)->getName());
|
||||
(App::DocumentObject::getClassTypeId(), doc->getName());
|
||||
|
||||
|
||||
for (std::vector<App::DocumentObject*>::const_iterator ft=sel.begin();ft!=sel.end();++ft) {
|
||||
ViewProvider *pr = pcDoc->getViewProviderByName((*ft)->getNameInDocument());
|
||||
for (const auto & ft : sel) {
|
||||
ViewProvider *pr = pcDoc->getViewProviderByName(ft->getNameInDocument());
|
||||
if (pr && pr->isDerivedFrom(ViewProviderGeometryObject::getClassTypeId())){
|
||||
if (static_cast<ViewProviderGeometryObject*>(pr)->Selectable.getValue())
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Selectable=False"
|
||||
, (*it)->getName(), (*ft)->getNameInDocument());
|
||||
, doc->getName(), ft->getNameInDocument());
|
||||
else
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Selectable=True"
|
||||
, (*it)->getName(), (*ft)->getNameInDocument());
|
||||
, doc->getName(), ft->getNameInDocument());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -971,9 +970,9 @@ void StdCmdSelectVisibleObjects::activated(int iMsg)
|
||||
|
||||
std::vector<App::DocumentObject*> visible;
|
||||
visible.reserve(obj.size());
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it=obj.begin();it!=obj.end();++it) {
|
||||
if (doc->isShow((*it)->getNameInDocument()))
|
||||
visible.push_back(*it);
|
||||
for (const auto & it : obj) {
|
||||
if (doc->isShow(it->getNameInDocument()))
|
||||
visible.push_back(it);
|
||||
}
|
||||
|
||||
SelectionSingleton& rSel = Selection();
|
||||
@@ -1011,13 +1010,13 @@ void StdCmdToggleObjects::activated(int iMsg)
|
||||
const std::vector<App::DocumentObject*> obj = app->getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId());
|
||||
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it=obj.begin();it!=obj.end();++it) {
|
||||
if (doc->isShow((*it)->getNameInDocument()))
|
||||
for (const auto & it : obj) {
|
||||
if (doc->isShow(it->getNameInDocument()))
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=False"
|
||||
, app->getName(), (*it)->getNameInDocument());
|
||||
, app->getName(), it->getNameInDocument());
|
||||
else
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=True"
|
||||
, app->getName(), (*it)->getNameInDocument());
|
||||
, app->getName(), it->getNameInDocument());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1052,9 +1051,9 @@ void StdCmdShowObjects::activated(int iMsg)
|
||||
const std::vector<App::DocumentObject*> obj = app->getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId());
|
||||
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it=obj.begin();it!=obj.end();++it) {
|
||||
for (const auto & it : obj) {
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=True"
|
||||
, app->getName(), (*it)->getNameInDocument());
|
||||
, app->getName(), it->getNameInDocument());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1089,9 +1088,9 @@ void StdCmdHideObjects::activated(int iMsg)
|
||||
const std::vector<App::DocumentObject*> obj = app->getObjectsOfType
|
||||
(App::DocumentObject::getClassTypeId());
|
||||
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it=obj.begin();it!=obj.end();++it) {
|
||||
for (const auto & it : obj) {
|
||||
doCommand(Gui,"Gui.getDocument(\"%s\").getObject(\"%s\").Visibility=False"
|
||||
, app->getName(), (*it)->getNameInDocument());
|
||||
, app->getName(), it->getNameInDocument());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1625,7 +1624,7 @@ StdViewDockUndockFullscreen::StdViewDockUndockFullscreen()
|
||||
|
||||
Action * StdViewDockUndockFullscreen::createAction()
|
||||
{
|
||||
ActionGroup* pcAction = new ActionGroup(this, getMainWindow());
|
||||
auto pcAction = new ActionGroup(this, getMainWindow());
|
||||
pcAction->setDropDownMenu(true);
|
||||
pcAction->setText(QCoreApplication::translate(
|
||||
this->className(), getMenuText()));
|
||||
@@ -1698,7 +1697,7 @@ bool StdViewDockUndockFullscreen::isActive()
|
||||
MDIView* view = getMainWindow()->activeWindow();
|
||||
if (qobject_cast<View3DInventor*>(view)) {
|
||||
// update the action group if needed
|
||||
ActionGroup* pActGrp = qobject_cast<ActionGroup*>(_pcAction);
|
||||
auto pActGrp = qobject_cast<ActionGroup*>(_pcAction);
|
||||
if (pActGrp) {
|
||||
int index = pActGrp->checkedAction();
|
||||
int mode = (int)(view->currentViewMode());
|
||||
@@ -1764,7 +1763,7 @@ StdViewScreenShot::StdViewScreenShot()
|
||||
void StdViewScreenShot::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
QStringList formats;
|
||||
SbViewportRegion vp(view->getViewer()->getSoRenderManager()->getViewportRegion());
|
||||
@@ -1800,7 +1799,7 @@ void StdViewScreenShot::activated(int iMsg)
|
||||
fd.selectNameFilter(selFilter);
|
||||
|
||||
// create the image options widget
|
||||
DlgSettingsImageImp* opt = new DlgSettingsImageImp(&fd);
|
||||
auto opt = new DlgSettingsImageImp(&fd);
|
||||
SbVec2s sz = vp.getWindowSize();
|
||||
opt->setImageSize((int)sz[0], (int)sz[1]);
|
||||
opt->setBackgroundType(backtype);
|
||||
@@ -2014,7 +2013,7 @@ StdCmdAxisCross::StdCmdAxisCross()
|
||||
void StdCmdAxisCross::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::View3DInventor* view = qobject_cast<View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
if (!view->getViewer()->hasAxisCross())
|
||||
doCommand(Command::Gui,"Gui.ActiveDocument.ActiveView.setAxisCross(True)");
|
||||
@@ -2025,7 +2024,7 @@ void StdCmdAxisCross::activated(int iMsg)
|
||||
|
||||
bool StdCmdAxisCross::isActive()
|
||||
{
|
||||
Gui::View3DInventor* view = qobject_cast<View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(Gui::getMainWindow()->activeWindow());
|
||||
if (view && view->getViewer()->hasAxisCross()) {
|
||||
if (!_pcAction->isChecked())
|
||||
_pcAction->setChecked(true);
|
||||
@@ -2338,7 +2337,7 @@ StdViewZoomIn::StdViewZoomIn()
|
||||
void StdViewZoomIn::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if ( view ) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
viewer->navigationStyle()->zoomIn();
|
||||
@@ -2371,7 +2370,7 @@ StdViewZoomOut::StdViewZoomOut()
|
||||
void StdViewZoomOut::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
viewer->navigationStyle()->zoomOut();
|
||||
@@ -2431,15 +2430,15 @@ public:
|
||||
// Also supports aborting the selection mode by pressing (releasing) the Escape key.
|
||||
static void selectionCallback(void * ud, SoEventCallback * n)
|
||||
{
|
||||
SelectionCallbackHandler* selectionHandler = static_cast<SelectionCallbackHandler*>(ud);
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
auto selectionHandler = static_cast<SelectionCallbackHandler*>(ud);
|
||||
auto view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
const SoEvent* ev = n->getEvent();
|
||||
if (ev->isOfType(SoKeyboardEvent::getClassTypeId())) {
|
||||
|
||||
n->setHandled();
|
||||
n->getAction()->setHandled();
|
||||
|
||||
const SoKeyboardEvent * ke = static_cast<const SoKeyboardEvent*>(ev);
|
||||
const auto ke = static_cast<const SoKeyboardEvent*>(ev);
|
||||
const SbBool press = ke->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
if (ke->getKey() == SoKeyboardEvent::ESCAPE) {
|
||||
|
||||
@@ -2450,7 +2449,7 @@ public:
|
||||
}
|
||||
}
|
||||
else if (ev->isOfType(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent*>(ev);
|
||||
const auto mbe = static_cast<const SoMouseButtonEvent*>(ev);
|
||||
|
||||
// Mark all incoming mouse button events as handled, especially, to deactivate the selection node
|
||||
n->getAction()->setHandled();
|
||||
@@ -2541,7 +2540,7 @@ StdViewBoxZoom::StdViewBoxZoom()
|
||||
void StdViewBoxZoom::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if ( view ) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
if (!viewer->isSelecting()) {
|
||||
@@ -2736,7 +2735,7 @@ static std::vector<std::string> getBoxSelection(
|
||||
static void doSelect(void* ud, SoEventCallback * cb)
|
||||
{
|
||||
bool selectElement = ud ? true : false;
|
||||
Gui::View3DInventorViewer* viewer = static_cast<Gui::View3DInventorViewer*>(cb->getUserData());
|
||||
auto viewer = static_cast<Gui::View3DInventorViewer*>(cb->getUserData());
|
||||
|
||||
SoNode* root = viewer->getSceneGraph();
|
||||
static_cast<Gui::SoFCUnifiedSelection*>(root)->selectionRole.setValue(true);
|
||||
@@ -2762,8 +2761,8 @@ static void doSelect(void* ud, SoEventCallback * cb)
|
||||
selectionMode = INTERSECT;
|
||||
}
|
||||
else {
|
||||
for (std::vector<SbVec2f>::const_iterator it = picked.begin(); it != picked.end(); ++it)
|
||||
polygon.Add(Base::Vector2d((*it)[0],(*it)[1]));
|
||||
for (const auto & it : picked)
|
||||
polygon.Add(Base::Vector2d(it[0],it[1]));
|
||||
}
|
||||
|
||||
App::Document* doc = App::GetApplication().getActiveDocument();
|
||||
@@ -2793,7 +2792,7 @@ static void doSelect(void* ud, SoEventCallback * cb)
|
||||
void StdBoxSelection::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
if (!viewer->isSelecting()) {
|
||||
@@ -2874,7 +2873,7 @@ StdBoxElementSelection::StdBoxElementSelection()
|
||||
void StdBoxElementSelection::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto view = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (view) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
if (!viewer->isSelecting()) {
|
||||
@@ -3080,7 +3079,7 @@ void StdCmdMeasureDistance::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::Document* doc = Gui::Application::Instance->activeDocument();
|
||||
Gui::View3DInventor* view = static_cast<Gui::View3DInventor*>(doc->getActiveView());
|
||||
auto view = static_cast<Gui::View3DInventor*>(doc->getActiveView());
|
||||
if (view) {
|
||||
Gui::View3DInventorViewer* viewer = view->getViewer();
|
||||
viewer->setEditing(true);
|
||||
@@ -3088,7 +3087,7 @@ void StdCmdMeasureDistance::activated(int iMsg)
|
||||
|
||||
// Derives from QObject and we have a parent object, so we don't
|
||||
// require a delete.
|
||||
PointMarker* marker = new PointMarker(viewer);
|
||||
auto marker = new PointMarker(viewer);
|
||||
viewer->addEventCallback(SoEvent::getClassTypeId(),
|
||||
ViewProviderMeasureDistance::measureDistanceCallback, marker);
|
||||
}
|
||||
@@ -3218,7 +3217,7 @@ CmdViewMeasureClearAll::CmdViewMeasureClearAll()
|
||||
void CmdViewMeasureClearAll::activated(int iMsg)
|
||||
{
|
||||
Q_UNUSED(iMsg);
|
||||
Gui::View3DInventor *view = dynamic_cast<Gui::View3DInventor*>(Gui::Application::Instance->
|
||||
auto view = dynamic_cast<Gui::View3DInventor*>(Gui::Application::Instance->
|
||||
activeDocument()->getActiveView());
|
||||
if (!view)
|
||||
return;
|
||||
|
||||
@@ -401,7 +401,7 @@ Action * StdCmdStatusBar::createAction()
|
||||
Action *pcAction = Command::createAction();
|
||||
pcAction->setCheckable(true);
|
||||
pcAction->setChecked(false, true);
|
||||
FilterStatusBar *fsb = new FilterStatusBar(pcAction);
|
||||
auto fsb = new FilterStatusBar(pcAction);
|
||||
getMainWindow()->statusBar()->installEventFilter(fsb);
|
||||
|
||||
return pcAction;
|
||||
|
||||
+10
-10
@@ -61,7 +61,7 @@ ControlSingleton::~ControlSingleton()
|
||||
|
||||
Gui::TaskView::TaskView* ControlSingleton::taskPanel() const
|
||||
{
|
||||
Gui::DockWnd::ComboView* pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
auto pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
(Gui::DockWindowManager::instance()->getDockWindow("Combo View"));
|
||||
// should return the pointer to combo view
|
||||
if (pcComboView)
|
||||
@@ -76,7 +76,7 @@ Gui::TaskView::TaskView* ControlSingleton::taskPanel() const
|
||||
|
||||
void ControlSingleton::showTaskView()
|
||||
{
|
||||
Gui::DockWnd::ComboView* pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
auto pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
(Gui::DockWindowManager::instance()->getDockWindow("Combo View"));
|
||||
if (pcComboView)
|
||||
pcComboView->showTaskView();
|
||||
@@ -86,7 +86,7 @@ void ControlSingleton::showTaskView()
|
||||
|
||||
void ControlSingleton::showModelView()
|
||||
{
|
||||
Gui::DockWnd::ComboView* pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
auto pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
(Gui::DockWindowManager::instance()->getDockWindow("Combo View"));
|
||||
if (pcComboView)
|
||||
pcComboView->showTreeView();
|
||||
@@ -116,13 +116,13 @@ void ControlSingleton::showDialog(Gui::TaskView::TaskDialog *dlg)
|
||||
// which may open a transaction but fails when auto transaction is still active.
|
||||
App::AutoTransaction::setEnable(false);
|
||||
|
||||
Gui::DockWnd::ComboView* pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
auto pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
(Gui::DockWindowManager::instance()->getDockWindow("Combo View"));
|
||||
// should return the pointer to combo view
|
||||
if (pcComboView) {
|
||||
pcComboView->showDialog(dlg);
|
||||
// make sure that the combo view is shown
|
||||
QDockWidget* dw = qobject_cast<QDockWidget*>(pcComboView->parentWidget());
|
||||
auto dw = qobject_cast<QDockWidget*>(pcComboView->parentWidget());
|
||||
if (dw) {
|
||||
dw->setVisible(true);
|
||||
dw->toggleViewAction()->setVisible(true);
|
||||
@@ -136,7 +136,7 @@ void ControlSingleton::showDialog(Gui::TaskView::TaskDialog *dlg)
|
||||
}
|
||||
// not all workbenches have the combo view enabled
|
||||
else if (!_taskPanel) {
|
||||
QDockWidget* dw = new QDockWidget();
|
||||
auto dw = new QDockWidget();
|
||||
dw->setWindowTitle(tr("Task panel"));
|
||||
dw->setFeatures(QDockWidget::DockWidgetMovable);
|
||||
_taskPanel = new Gui::TaskView::TaskView(dw);
|
||||
@@ -175,7 +175,7 @@ Gui::TaskView::TaskDialog* ControlSingleton::activeDialog() const
|
||||
Gui::TaskView::TaskView* ControlSingleton::getTaskPanel()
|
||||
{
|
||||
// should return the pointer to combo view
|
||||
Gui::DockWnd::ComboView* pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
auto pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
(Gui::DockWindowManager::instance()->getDockWindow("Combo View"));
|
||||
if (pcComboView)
|
||||
return pcComboView->getTaskPanel();
|
||||
@@ -205,7 +205,7 @@ void ControlSingleton::reject()
|
||||
|
||||
void ControlSingleton::closeDialog()
|
||||
{
|
||||
Gui::DockWnd::ComboView* pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
auto pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
(Gui::DockWindowManager::instance()->getDockWindow("Combo View"));
|
||||
// should return the pointer to combo view
|
||||
if (pcComboView)
|
||||
@@ -217,13 +217,13 @@ void ControlSingleton::closeDialog()
|
||||
void ControlSingleton::closedDialog()
|
||||
{
|
||||
ActiveDialog = nullptr;
|
||||
Gui::DockWnd::ComboView* pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
auto pcComboView = qobject_cast<Gui::DockWnd::ComboView*>
|
||||
(Gui::DockWindowManager::instance()->getDockWindow("Combo View"));
|
||||
// should return the pointer to combo view
|
||||
assert(pcComboView);
|
||||
pcComboView->closedDialog();
|
||||
// make sure that the combo view is shown
|
||||
QDockWidget* dw = qobject_cast<QDockWidget*>(pcComboView->parentWidget());
|
||||
auto dw = qobject_cast<QDockWidget*>(pcComboView->parentWidget());
|
||||
if (dw)
|
||||
dw->setFeatures(QDockWidget::DockWidgetClosable
|
||||
| QDockWidget::DockWidgetMovable
|
||||
|
||||
@@ -241,7 +241,7 @@ void Model::slotNewObject(const ViewProviderDocumentObject &VPDObjectIn)
|
||||
graphLink->insert(virginRecord);
|
||||
|
||||
//setup rectangle.
|
||||
auto *rectangle = (*theGraph)[virginVertex].rectangle.get();
|
||||
auto rectangle = (*theGraph)[virginVertex].rectangle.get();
|
||||
rectangle->setEditingBrush(QBrush(Qt::yellow));
|
||||
|
||||
auto icon = (*theGraph)[virginVertex].icon;
|
||||
@@ -305,7 +305,7 @@ void Model::slotChangeObject(const ViewProviderDocumentObject &VPDObjectIn, cons
|
||||
if (std::string("Label") == name)
|
||||
{
|
||||
const GraphLinkRecord &record = findRecord(&VPDObjectIn, *graphLink);
|
||||
auto *text = (*theGraph)[record.vertex].text.get();
|
||||
auto text = (*theGraph)[record.vertex].text.get();
|
||||
text->setPlainText(QString::fromUtf8(record.DObject->Label.getValue()));
|
||||
}
|
||||
else if (propertyIn.isDerivedFrom(App::PropertyLinkBase::getClassTypeId()))
|
||||
@@ -635,12 +635,12 @@ void Model::updateSlot()
|
||||
maxColumn = std::max(currentColumn, maxColumn);
|
||||
QBrush currentBrush(forgroundBrushes.at(currentColumn % forgroundBrushes.size()));
|
||||
|
||||
auto *rectangle = (*theGraph)[currentVertex].rectangle.get();
|
||||
auto rectangle = (*theGraph)[currentVertex].rectangle.get();
|
||||
rectangle->setRect(-rowPadding, 0.0, rowPadding, rowHeight); //calculate actual length later.
|
||||
rectangle->setTransform(QTransform::fromTranslate(0, rowHeight * currentRow));
|
||||
rectangle->setBackgroundBrush(backgroundBrushes[currentRow % backgroundBrushes.size()]);
|
||||
|
||||
auto *point = (*theGraph)[currentVertex].point.get();
|
||||
auto point = (*theGraph)[currentVertex].point.get();
|
||||
point->setRect(0.0, 0.0, pointSize, pointSize);
|
||||
point->setTransform(QTransform::fromTranslate(pointSpacing * currentColumn,
|
||||
rowHeight * currentRow + rowHeight / 2.0 - pointSize / 2.0));
|
||||
@@ -650,16 +650,16 @@ void Model::updateSlot()
|
||||
if (direction == -1)
|
||||
cheat = rowHeight;
|
||||
|
||||
auto *visiblePixmap = (*theGraph)[currentVertex].visibleIcon.get();
|
||||
auto visiblePixmap = (*theGraph)[currentVertex].visibleIcon.get();
|
||||
visiblePixmap->setTransform(QTransform::fromTranslate(0.0, rowHeight * currentRow + cheat)); //calculate x location later.
|
||||
|
||||
auto *statePixmap = (*theGraph)[currentVertex].stateIcon.get();
|
||||
auto statePixmap = (*theGraph)[currentVertex].stateIcon.get();
|
||||
statePixmap->setTransform(QTransform::fromTranslate(0.0, rowHeight * currentRow + cheat)); //calculate x location later.
|
||||
|
||||
auto *pixmap = (*theGraph)[currentVertex].icon.get();
|
||||
auto pixmap = (*theGraph)[currentVertex].icon.get();
|
||||
pixmap->setTransform(QTransform::fromTranslate(0.0, rowHeight * currentRow + cheat)); //calculate x location later.
|
||||
|
||||
auto *text = (*theGraph)[currentVertex].text.get();
|
||||
auto text = (*theGraph)[currentVertex].text.get();
|
||||
text->setPlainText(QString::fromUtf8(findRecord(currentVertex, *graphLink).DObject->Label.getValue()));
|
||||
text->setDefaultTextColor(currentBrush.color());
|
||||
maxTextLength = std::max(maxTextLength, static_cast<float>(text->boundingRect().width()));
|
||||
@@ -730,26 +730,26 @@ void Model::updateSlot()
|
||||
{
|
||||
float localCurrentX = columnSpacing;
|
||||
localCurrentX += pointToIcon;
|
||||
auto *visiblePixmap = (*theGraph)[currentVertex].visibleIcon.get();
|
||||
auto visiblePixmap = (*theGraph)[currentVertex].visibleIcon.get();
|
||||
QTransform visibleIconTransform = QTransform::fromTranslate(localCurrentX, 0.0);
|
||||
visiblePixmap->setTransform(visiblePixmap->transform() * visibleIconTransform);
|
||||
|
||||
localCurrentX += iconSize + iconToIcon;
|
||||
auto *statePixmap = (*theGraph)[currentVertex].stateIcon.get();
|
||||
auto statePixmap = (*theGraph)[currentVertex].stateIcon.get();
|
||||
QTransform stateIconTransform = QTransform::fromTranslate(localCurrentX, 0.0);
|
||||
statePixmap->setTransform(statePixmap->transform() * stateIconTransform);
|
||||
|
||||
localCurrentX += iconSize + iconToIcon;
|
||||
auto *pixmap = (*theGraph)[currentVertex].icon.get();
|
||||
auto pixmap = (*theGraph)[currentVertex].icon.get();
|
||||
QTransform iconTransform = QTransform::fromTranslate(localCurrentX, 0.0);
|
||||
pixmap->setTransform(pixmap->transform() * iconTransform);
|
||||
|
||||
localCurrentX += iconSize + iconToText;
|
||||
auto *text = (*theGraph)[currentVertex].text.get();
|
||||
auto text = (*theGraph)[currentVertex].text.get();
|
||||
QTransform textTransform = QTransform::fromTranslate(localCurrentX, 0.0);
|
||||
text->setTransform(text->transform() * textTransform);
|
||||
|
||||
auto *rectangle = (*theGraph)[currentVertex].rectangle.get();
|
||||
auto rectangle = (*theGraph)[currentVertex].rectangle.get();
|
||||
QRectF rect = rectangle->rect();
|
||||
rect.setWidth(localCurrentX + maxTextLength + 2.0 * rowPadding);
|
||||
rectangle->setRect(rect);
|
||||
@@ -835,7 +835,7 @@ void Model::updateStates()
|
||||
{
|
||||
const GraphLinkRecord &record = findRecord(currentVertex, *graphLink);
|
||||
|
||||
auto *visiblePixmap = (*theGraph)[currentVertex].visibleIcon.get();
|
||||
auto visiblePixmap = (*theGraph)[currentVertex].visibleIcon.get();
|
||||
VisibilityState currentVisibilityState = (record.VPDObject->isShow()) ? (VisibilityState::On) : (VisibilityState::Off);
|
||||
if
|
||||
(
|
||||
@@ -884,7 +884,7 @@ RectItem* Model::getRectFromPosition(const QPointF& position)
|
||||
{
|
||||
RectItem *rect = nullptr;
|
||||
auto theItems = this->items(position, Qt::IntersectsItemBoundingRect, Qt::DescendingOrder);
|
||||
for (auto *currentItem : theItems)
|
||||
for (auto currentItem : theItems)
|
||||
{
|
||||
rect = dynamic_cast<RectItem *>(currentItem);
|
||||
if (rect) break;
|
||||
@@ -931,7 +931,7 @@ void Model::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||
QList<QGraphicsItem *>selection = collidingItems(&intersectionLine);
|
||||
for (auto currentItem = selection.begin(); currentItem != selection.end(); ++currentItem)
|
||||
{
|
||||
RectItem *rect = dynamic_cast<RectItem *>(*currentItem);
|
||||
auto rect = dynamic_cast<RectItem *>(*currentItem);
|
||||
if (!rect) continue;
|
||||
const GraphLinkRecord &selectionRecord = findRecord(rect, *graphLink);
|
||||
Gui::Selection().addSelection(selectionRecord.DObject->getDocument()->getName(),
|
||||
@@ -959,7 +959,7 @@ void Model::mousePressEvent(QGraphicsSceneMouseEvent* event)
|
||||
|
||||
//don't like that I am doing this again here after getRectFromPosition call.
|
||||
QGraphicsItem *item = itemAt(event->scenePos(), QTransform());
|
||||
QGraphicsPixmapItem *pixmapItem = dynamic_cast<QGraphicsPixmapItem *>(item);
|
||||
auto pixmapItem = dynamic_cast<QGraphicsPixmapItem *>(item);
|
||||
if (pixmapItem && (pixmapItem == (*theGraph)[record.vertex].visibleIcon.get()))
|
||||
{
|
||||
//get all selections, but for now just the current pick.
|
||||
@@ -1053,7 +1053,7 @@ void Model::contextMenuEvent(QGraphicsSceneContextMenuEvent* event)
|
||||
|
||||
//don't like that I am doing this again here after getRectFromPosition call.
|
||||
QGraphicsItem *item = itemAt(event->scenePos(), QTransform());
|
||||
QGraphicsPixmapItem *pixmapItem = dynamic_cast<QGraphicsPixmapItem *>(item);
|
||||
auto pixmapItem = dynamic_cast<QGraphicsPixmapItem *>(item);
|
||||
if (pixmapItem && (pixmapItem == (*theGraph)[record.vertex].visibleIcon.get()))
|
||||
{
|
||||
visiblyIsolate(record.vertex);
|
||||
@@ -1099,8 +1099,8 @@ void Model::onRenameSlot()
|
||||
std::vector<Gui::DAG::Vertex> selections = getAllSelected();
|
||||
assert(selections.size() == 1);
|
||||
|
||||
LineEdit *lineEdit = new LineEdit();
|
||||
auto *text = (*theGraph)[selections.front()].text.get();
|
||||
auto lineEdit = new LineEdit();
|
||||
auto text = (*theGraph)[selections.front()].text.get();
|
||||
lineEdit->setText(text->toPlainText());
|
||||
connect(lineEdit, SIGNAL(acceptedSignal()), this, SLOT(renameAcceptedSlot()));
|
||||
connect(lineEdit, SIGNAL(rejectedSignal()), this, SLOT(renameRejectedSlot()));
|
||||
@@ -1120,7 +1120,7 @@ void Model::renameAcceptedSlot()
|
||||
assert(selections.size() == 1);
|
||||
const GraphLinkRecord &record = findRecord(selections.front(), *graphLink);
|
||||
|
||||
LineEdit *lineEdit = dynamic_cast<LineEdit*>(proxy->widget());
|
||||
auto lineEdit = dynamic_cast<LineEdit*>(proxy->widget());
|
||||
assert(lineEdit);
|
||||
const_cast<App::DocumentObject*>(record.DObject)->Label.setValue(lineEdit->text().toUtf8().constData()); //const hack
|
||||
|
||||
@@ -1143,7 +1143,7 @@ void Model::finishRename()
|
||||
|
||||
void Model::editingStartSlot()
|
||||
{
|
||||
QAction* action = qobject_cast<QAction*>(sender());
|
||||
auto action = qobject_cast<QAction*>(sender());
|
||||
if (action)
|
||||
{
|
||||
int edit = action->data().toInt();
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace bp = boost::placeholders;
|
||||
DAG::DockWindow::DockWindow(Gui::Document* gDocumentIn, QWidget* parent): Gui::DockWindow(gDocumentIn, parent)
|
||||
{
|
||||
dagView = new View(this);
|
||||
QVBoxLayout *layout = new QVBoxLayout();
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->addWidget(dagView);
|
||||
this->setLayout(layout);
|
||||
}
|
||||
@@ -80,7 +80,7 @@ void View::slotActiveDocument(const Document &documentIn)
|
||||
|
||||
void View::slotDeleteDocument(const Document &documentIn)
|
||||
{
|
||||
ModelMap::iterator it = modelMap.find(&documentIn);
|
||||
ModelMap::const_iterator it = modelMap.find(&documentIn);
|
||||
if (it != modelMap.end())
|
||||
modelMap.erase(it);
|
||||
}
|
||||
|
||||
@@ -140,7 +140,7 @@ float DemoMode::getSpeed(int v) const
|
||||
SbVec3f DemoMode::getDirection(Gui::View3DInventor* view) const
|
||||
{
|
||||
SoCamera* cam = view->getViewer()->getSoRenderManager()->getCamera();
|
||||
if (!cam)
|
||||
if (!cam)
|
||||
return this->viewAxis;
|
||||
SbRotation rot = cam->orientation.getValue();
|
||||
SbRotation inv = rot.inverse();
|
||||
@@ -157,9 +157,9 @@ void DemoMode::on_angleSlider_valueChanged(int v)
|
||||
Gui::View3DInventor* view = activeView();
|
||||
if (view) {
|
||||
SoCamera* cam = view->getViewer()->getSoRenderManager()->getCamera();
|
||||
if (!cam)
|
||||
if (!cam)
|
||||
return;
|
||||
float angle = Base::toRadians<float>(/*90-v*/v - this->oldvalue);
|
||||
auto angle = Base::toRadians<float>(/*90-v*/v - this->oldvalue);
|
||||
SbRotation rot(SbVec3f(-1, 0, 0), angle);
|
||||
reorientCamera(cam ,rot);
|
||||
this->oldvalue = v;
|
||||
|
||||
+52
-53
@@ -143,15 +143,15 @@ void DlgCustomActionsImp::showActions()
|
||||
{
|
||||
CommandManager& rclMan = Application::Instance->commandManager();
|
||||
std::vector<Command*> aclCurMacros = rclMan.getGroupCommands("Macros");
|
||||
for (std::vector<Command*>::iterator it = aclCurMacros.begin(); it != aclCurMacros.end(); ++it)
|
||||
for (const auto & aclCurMacro : aclCurMacros)
|
||||
{
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->actionListWidget);
|
||||
QByteArray actionName = (*it)->getName();
|
||||
auto item = new QTreeWidgetItem(ui->actionListWidget);
|
||||
QByteArray actionName = aclCurMacro->getName();
|
||||
item->setData(1, Qt::UserRole, actionName);
|
||||
item->setText(1, QString::fromUtf8((*it)->getMenuText()));
|
||||
item->setText(1, QString::fromUtf8(aclCurMacro->getMenuText()));
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
if ( (*it)->getPixmap() )
|
||||
item->setIcon(0, BitmapFactory().pixmap((*it)->getPixmap()));
|
||||
if ( aclCurMacro->getPixmap() )
|
||||
item->setIcon(0, BitmapFactory().pixmap(aclCurMacro->getPixmap()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ void DlgCustomActionsImp::on_actionListWidget_itemActivated(QTreeWidgetItem *ite
|
||||
QByteArray actionName = item->data(1, Qt::UserRole).toByteArray();
|
||||
CommandManager& rclMan = Application::Instance->commandManager();
|
||||
Command* pCmd = rclMan.getCommandByName(actionName.constData());
|
||||
MacroCommand* pScript = dynamic_cast<MacroCommand*>(pCmd);
|
||||
auto pScript = dynamic_cast<MacroCommand*>(pCmd);
|
||||
|
||||
// if valid command
|
||||
if ( pScript )
|
||||
@@ -222,11 +222,11 @@ void DlgCustomActionsImp::on_buttonAddAction_clicked()
|
||||
// search for the command in the manager
|
||||
CommandManager& rclMan = Application::Instance->commandManager();
|
||||
QByteArray actionName = QString::fromStdString(rclMan.newMacroName()).toLatin1();
|
||||
MacroCommand* macro = new MacroCommand(actionName, ui->actionMacros->itemData(ui->actionMacros->currentIndex()).toBool());
|
||||
auto macro = new MacroCommand(actionName, ui->actionMacros->itemData(ui->actionMacros->currentIndex()).toBool());
|
||||
rclMan.addCommand( macro );
|
||||
|
||||
// add new action
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->actionListWidget);
|
||||
auto item = new QTreeWidgetItem(ui->actionListWidget);
|
||||
item->setData(1, Qt::UserRole, actionName);
|
||||
item->setText(1, ui->actionMenu->text());
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
@@ -291,7 +291,7 @@ void DlgCustomActionsImp::on_buttonReplaceAction_clicked()
|
||||
item->setText(1, ui->actionMenu->text());
|
||||
CommandManager& rclMan = Application::Instance->commandManager();
|
||||
Command* pCmd = rclMan.getCommandByName(actionName.constData());
|
||||
MacroCommand* macro = dynamic_cast<MacroCommand*>(pCmd);
|
||||
auto macro = dynamic_cast<MacroCommand*>(pCmd);
|
||||
if (!macro)
|
||||
return;
|
||||
|
||||
@@ -373,14 +373,14 @@ void DlgCustomActionsImp::on_buttonRemoveAction_clicked()
|
||||
// if the command is registered in the manager just remove it
|
||||
CommandManager& rclMan = Application::Instance->commandManager();
|
||||
std::vector<Command*> aclCurMacros = rclMan.getGroupCommands("Macros");
|
||||
for (std::vector<Command*>::iterator it2 = aclCurMacros.begin(); it2!= aclCurMacros.end(); ++it2)
|
||||
for (auto & aclCurMacro : aclCurMacros)
|
||||
{
|
||||
if (actionName == (*it2)->getName())
|
||||
if (actionName == aclCurMacro->getName())
|
||||
{
|
||||
// emit signal to notify the container widget
|
||||
Q_EMIT removeMacroAction(actionName);
|
||||
// remove from manager and delete it immediately
|
||||
rclMan.removeCommand(*it2);
|
||||
rclMan.removeCommand(aclCurMacro);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -399,12 +399,12 @@ IconDialog::IconDialog(QWidget* parent)
|
||||
|
||||
QListWidgetItem* item;
|
||||
QStringList names = BitmapFactory().findIconFiles();
|
||||
for (QStringList::Iterator it = names.begin(); it != names.end(); ++it) {
|
||||
for (const auto & name : names) {
|
||||
item = new QListWidgetItem(ui->listWidget);
|
||||
//item->setIcon(QIcon(*it));
|
||||
item->setIcon(QIcon(BitmapFactory().pixmap((const char*)it->toUtf8())));
|
||||
item->setText(QFileInfo(*it).baseName());
|
||||
item->setToolTip(*it);
|
||||
item->setIcon(QIcon(BitmapFactory().pixmap((const char*)name.toUtf8())));
|
||||
item->setText(QFileInfo(name).baseName());
|
||||
item->setToolTip(name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -430,8 +430,8 @@ void IconDialog::onAddIconPath()
|
||||
("User parameter:BaseApp/Preferences/Bitmaps");
|
||||
std::vector<std::string> paths = group->GetASCIIs("CustomPath");
|
||||
QStringList pathList;
|
||||
for (std::vector<std::string>::iterator it = paths.begin(); it != paths.end(); ++it)
|
||||
pathList << QString::fromUtf8(it->c_str());
|
||||
for (const auto & path : paths)
|
||||
pathList << QString::fromUtf8(path.c_str());
|
||||
|
||||
IconFolders dlg(pathList, this);
|
||||
dlg.setWindowTitle(tr("Icon folders"));
|
||||
@@ -448,28 +448,27 @@ void IconDialog::onAddIconPath()
|
||||
}
|
||||
|
||||
QStringList search = BitmapFactory().getPaths();
|
||||
for (QStringList::iterator it = search.begin(); it != search.end(); ++it) {
|
||||
*it = QDir::toNativeSeparators(*it);
|
||||
for (auto & it : search) {
|
||||
it = QDir::toNativeSeparators(it);
|
||||
}
|
||||
for (QStringList::iterator it = paths.begin(); it != paths.end(); ++it) {
|
||||
if (search.indexOf(*it) < 0) {
|
||||
for (const auto & path : paths) {
|
||||
if (search.indexOf(path) < 0) {
|
||||
QStringList filters;
|
||||
QList<QByteArray> formats = QImageReader::supportedImageFormats();
|
||||
for (QList<QByteArray>::iterator jt = formats.begin(); jt != formats.end(); ++jt)
|
||||
filters << QString::fromLatin1("*.%1").arg(QString::fromLatin1(*jt).toLower());
|
||||
QDir d(*it);
|
||||
for (const auto & format : formats)
|
||||
filters << QString::fromLatin1("*.%1").arg(QString::fromLatin1(format).toLower());
|
||||
QDir d(path);
|
||||
d.setNameFilters(filters);
|
||||
QFileInfoList fi = d.entryInfoList();
|
||||
for (QFileInfoList::iterator jt = fi.begin(); jt != fi.end(); ++jt) {
|
||||
QListWidgetItem* item;
|
||||
QString file = jt->absoluteFilePath();
|
||||
item = new QListWidgetItem(ui->listWidget);
|
||||
for (const auto & jt : fi) {
|
||||
QString file = jt.absoluteFilePath();
|
||||
auto item = new QListWidgetItem(ui->listWidget);
|
||||
item->setIcon(QIcon(file));
|
||||
item->setText(jt->baseName());
|
||||
item->setText(jt.baseName());
|
||||
item->setToolTip(file);
|
||||
}
|
||||
|
||||
BitmapFactory().addPath(*it);
|
||||
BitmapFactory().addPath(path);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -508,7 +507,7 @@ IconFolders::IconFolders(const QStringList& paths, QWidget* parent)
|
||||
: QDialog(parent), restart(false), maxLines(10)
|
||||
{
|
||||
resize(600,400);
|
||||
QDialogButtonBox* buttonBox = new QDialogButtonBox(this);
|
||||
auto buttonBox = new QDialogButtonBox(this);
|
||||
buttonBox->setStandardButtons(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
|
||||
connect(buttonBox, SIGNAL(accepted()),
|
||||
this, SLOT(accept()));
|
||||
@@ -516,10 +515,10 @@ IconFolders::IconFolders(const QStringList& paths, QWidget* parent)
|
||||
this, SLOT(reject()));
|
||||
|
||||
gridLayout = new QGridLayout();
|
||||
QGridLayout* mainLayout = new QGridLayout(this);
|
||||
auto mainLayout = new QGridLayout(this);
|
||||
mainLayout->addLayout(gridLayout, 0, 0, 1, 1);
|
||||
|
||||
QSpacerItem* verticalSpacer = new QSpacerItem(20, 108, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
auto verticalSpacer = new QSpacerItem(20, 108, QSizePolicy::Minimum, QSizePolicy::Expanding);
|
||||
mainLayout->addItem(verticalSpacer, 1, 0, 1, 1);
|
||||
mainLayout->addWidget(buttonBox, 2, 0, 1, 1);
|
||||
|
||||
@@ -527,10 +526,10 @@ IconFolders::IconFolders(const QStringList& paths, QWidget* parent)
|
||||
int numPaths = static_cast<int>(paths.size());
|
||||
int maxRow = this->maxLines;
|
||||
for (int row=0; row<maxRow; row++) {
|
||||
QLineEdit* edit = new QLineEdit(this);
|
||||
auto edit = new QLineEdit(this);
|
||||
edit->setReadOnly(true);
|
||||
gridLayout->addWidget(edit, row, 0, 1, 1);
|
||||
QPushButton* removeButton = new QPushButton(this);
|
||||
auto removeButton = new QPushButton(this);
|
||||
removeButton->setIcon(BitmapFactory().iconFromTheme("list-remove"));
|
||||
gridLayout->addWidget(removeButton, row, 1, 1, 1);
|
||||
|
||||
@@ -567,22 +566,22 @@ void IconFolders::addFolder()
|
||||
{
|
||||
int countHidden = -1;
|
||||
QStringList paths;
|
||||
for (QList< QPair<QLineEdit*, QPushButton*> >::iterator it = buttonMap.begin(); it != buttonMap.end(); ++it) {
|
||||
if (it->first->isHidden()) {
|
||||
for (const auto & it : buttonMap) {
|
||||
if (it.first->isHidden()) {
|
||||
countHidden++;
|
||||
if (countHidden == 0) {
|
||||
QString dir = QFileDialog::getExistingDirectory(this, IconDialog::tr("Add icon folder"), QString());
|
||||
if (!dir.isEmpty() && paths.indexOf(dir) < 0) {
|
||||
QLineEdit* edit = it->first;
|
||||
QLineEdit* edit = it.first;
|
||||
edit->setVisible(true);
|
||||
edit->setText(dir);
|
||||
QPushButton* removeButton = it->second;
|
||||
QPushButton* removeButton = it.second;
|
||||
removeButton->setVisible(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
paths << QDir::toNativeSeparators(it->first->text());
|
||||
paths << QDir::toNativeSeparators(it.first->text());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -600,19 +599,19 @@ void IconFolders::removeFolder()
|
||||
}
|
||||
|
||||
addButton->setEnabled(true);
|
||||
QPushButton* remove = static_cast<QPushButton*>(sender());
|
||||
auto remove = static_cast<QPushButton*>(sender());
|
||||
QLineEdit* edit = nullptr;
|
||||
for (QList< QPair<QLineEdit*, QPushButton*> >::iterator it = buttonMap.begin(); it != buttonMap.end(); ++it) {
|
||||
if (it->second == remove) {
|
||||
edit = it->first;
|
||||
for (const auto & it : buttonMap) {
|
||||
if (it.second == remove) {
|
||||
edit = it.first;
|
||||
}
|
||||
else if (edit) {
|
||||
// move up the text of the line edits
|
||||
edit->setText(it->first->text());
|
||||
edit->setText(it.first->text());
|
||||
|
||||
if (it->first->isVisible()) {
|
||||
edit = it->first;
|
||||
remove = it->second;
|
||||
if (it.first->isVisible()) {
|
||||
edit = it.first;
|
||||
remove = it.second;
|
||||
}
|
||||
else {
|
||||
edit->hide();
|
||||
@@ -626,9 +625,9 @@ void IconFolders::removeFolder()
|
||||
QStringList IconFolders::getPaths() const
|
||||
{
|
||||
QStringList paths;
|
||||
for (QList< QPair<QLineEdit*, QPushButton*> >::const_iterator it = buttonMap.begin(); it != buttonMap.end(); ++it) {
|
||||
if (!it->first->isHidden()) {
|
||||
paths << QDir::toNativeSeparators(it->first->text());
|
||||
for (const auto & it : buttonMap) {
|
||||
if (!it.first->isHidden()) {
|
||||
paths << QDir::toNativeSeparators(it.first->text());
|
||||
}
|
||||
else {
|
||||
break;
|
||||
|
||||
@@ -64,7 +64,7 @@ DlgActivateWindowImp::DlgActivateWindowImp(QWidget* parent, Qt::WindowFlags fl)
|
||||
QWidget* activeWnd = getMainWindow()->activeWindow();
|
||||
|
||||
for (QList<QWidget*>::Iterator it = windows.begin(); it != windows.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeWidget);
|
||||
auto item = new QTreeWidgetItem(ui->treeWidget);
|
||||
QString title = (*it)->windowTitle();
|
||||
title.replace(QLatin1String("[*]"), QLatin1String(""));
|
||||
if ((*it)->isWindowModified())
|
||||
|
||||
@@ -53,7 +53,7 @@ void DlgCheckableMessageBox::showMessage(const QString& header, const QString& m
|
||||
bool checked = App::GetApplication().GetParameterGroupByPath(QByteArray("User parameter:BaseApp/CheckMessages"))->GetBool(toParamEntry(header));
|
||||
|
||||
if (!checked) {
|
||||
DlgCheckableMessageBox *mb = new DlgCheckableMessageBox(Gui::getMainWindow());
|
||||
auto mb = new DlgCheckableMessageBox(Gui::getMainWindow());
|
||||
mb->setWindowTitle(header);
|
||||
mb->setIconPixmap(QMessageBox::standardIcon(QMessageBox::Warning));
|
||||
mb->setText(message);
|
||||
@@ -200,7 +200,7 @@ void DlgCheckableMessageBox::setStandardButtons(QDialogButtonBox::StandardButton
|
||||
QDialogButtonBox::StandardButton DlgCheckableMessageBox::defaultButton() const
|
||||
{
|
||||
Q_FOREACH (QAbstractButton *b, m_d->ui.buttonBox->buttons())
|
||||
if (QPushButton *pb = qobject_cast<QPushButton *>(b))
|
||||
if (auto pb = qobject_cast<QPushButton *>(b))
|
||||
if (pb->isDefault())
|
||||
return m_d->ui.buttonBox->standardButton(pb);
|
||||
return QDialogButtonBox::NoButton;
|
||||
|
||||
+22
-22
@@ -91,9 +91,9 @@ DlgCustomCommandsImp::DlgCustomCommandsImp( QWidget* parent )
|
||||
groupMap.push_back(std::make_pair(QLatin1String("Help"), QString()));
|
||||
groupMap.push_back(std::make_pair(QLatin1String("Macros"), qApp->translate("Gui::MacroCommand", "Macros")));
|
||||
|
||||
for (std::map<std::string,Command*>::iterator it = sCommands.begin(); it != sCommands.end(); ++it) {
|
||||
QLatin1String group(it->second->getGroupName());
|
||||
QString text = it->second->translatedGroupName();
|
||||
for (const auto & sCommand : sCommands) {
|
||||
QLatin1String group(sCommand.second->getGroupName());
|
||||
QString text = sCommand.second->translatedGroupName();
|
||||
GroupMap::iterator jt;
|
||||
jt = std::find_if(groupMap.begin(), groupMap.end(), GroupMap_find(group));
|
||||
if (jt != groupMap.end()) {
|
||||
@@ -107,10 +107,10 @@ DlgCustomCommandsImp::DlgCustomCommandsImp( QWidget* parent )
|
||||
|
||||
QStringList labels; labels << tr("Category");
|
||||
ui->categoryTreeWidget->setHeaderLabels(labels);
|
||||
for (GroupMap::iterator it = groupMap.begin(); it != groupMap.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->categoryTreeWidget);
|
||||
item->setText(0, it->second);
|
||||
item->setData(0, Qt::UserRole, QVariant(it->first));
|
||||
for (const auto & it : groupMap) {
|
||||
auto item = new QTreeWidgetItem(ui->categoryTreeWidget);
|
||||
item->setText(0, it.second);
|
||||
item->setData(0, Qt::UserRole, QVariant(it.first));
|
||||
}
|
||||
|
||||
labels.clear();
|
||||
@@ -150,25 +150,25 @@ void DlgCustomCommandsImp::onGroupActivated(QTreeWidgetItem* groupItem)
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands(group.toLatin1());
|
||||
if (group == QLatin1String("Macros")) {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8((*it)->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8((*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
for (const auto & aCmd : aCmds) {
|
||||
auto item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8(aCmd->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8(aCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray(aCmd->getName()));
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
if ((*it)->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme((*it)->getPixmap()));
|
||||
if (aCmd->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme(aCmd->getPixmap()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, qApp->translate((*it)->className(), (*it)->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate((*it)->className(), (*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
for (const auto & aCmd : aCmds) {
|
||||
auto item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, qApp->translate(aCmd->className(), aCmd->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate(aCmd->className(), aCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray(aCmd->getName()));
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
if ((*it)->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme((*it)->getPixmap()));
|
||||
if (aCmd->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme(aCmd->getPixmap()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -188,7 +188,7 @@ void DlgCustomCommandsImp::onAddMacroAction(const QByteArray& macro)
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
Command* pCmd = cCmdMgr.getCommandByName(macro);
|
||||
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
auto item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8(pCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, macro);
|
||||
|
||||
@@ -69,7 +69,7 @@ DlgCustomizeImp::DlgCustomizeImp(QWidget* parent, Qt::WindowFlags fl)
|
||||
buttonHelp->setText(tr("&Help"));
|
||||
layout->addWidget( buttonHelp );
|
||||
|
||||
QSpacerItem* spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
||||
auto spacer = new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum );
|
||||
layout->addItem(spacer);
|
||||
|
||||
buttonClose = new QPushButton( this );
|
||||
|
||||
@@ -35,7 +35,7 @@ DlgCustomizeSpNavSettings::DlgCustomizeSpNavSettings(QWidget *parent) :
|
||||
, ui(new Ui_DlgCustomizeSpNavSettings)
|
||||
, init(false)
|
||||
{
|
||||
GUIApplicationNativeEventAware *app = qobject_cast<GUIApplicationNativeEventAware *>(QApplication::instance());
|
||||
auto app = qobject_cast<GUIApplicationNativeEventAware *>(QApplication::instance());
|
||||
|
||||
if (!app)
|
||||
return;
|
||||
@@ -56,9 +56,9 @@ DlgCustomizeSpNavSettings::~DlgCustomizeSpNavSettings()
|
||||
|
||||
void DlgCustomizeSpNavSettings::setMessage(const QString& message)
|
||||
{
|
||||
QLabel *messageLabel = new QLabel(message,this);
|
||||
QVBoxLayout *layout = new QVBoxLayout();
|
||||
QHBoxLayout *layout2 = new QHBoxLayout();
|
||||
auto messageLabel = new QLabel(message,this);
|
||||
auto layout = new QVBoxLayout();
|
||||
auto layout2 = new QHBoxLayout();
|
||||
layout2->addStretch();
|
||||
layout2->addWidget(messageLabel);
|
||||
layout2->addStretch();
|
||||
|
||||
@@ -73,7 +73,7 @@ void ButtonView::goSelectionChanged(const QItemSelection &selected, const QItemS
|
||||
void ButtonView::goChangedCommand(const QString& commandName)
|
||||
{
|
||||
QModelIndex index(this->currentIndex());
|
||||
ButtonModel *model = dynamic_cast<ButtonModel*>(this->model());
|
||||
auto model = dynamic_cast<ButtonModel*>(this->model());
|
||||
if (model && index.isValid())
|
||||
model->setCommand(index.row(), commandName);
|
||||
}
|
||||
@@ -252,9 +252,9 @@ void ButtonModel::goButtonPress(int number)
|
||||
void ButtonModel::goMacroRemoved(const QByteArray& macroName)
|
||||
{
|
||||
GroupVector groupVector = spaceballButtonGroup()->GetGroups();
|
||||
for (GroupVector::iterator it = groupVector.begin(); it != groupVector.end(); ++it)
|
||||
if (std::string(macroName.data()) == (*it)->GetASCII("Command"))
|
||||
(*it)->SetASCII("Command", "");
|
||||
for (auto & it : groupVector)
|
||||
if (std::string(macroName.data()) == it->GetASCII("Command"))
|
||||
it->SetASCII("Command", "");
|
||||
}
|
||||
|
||||
void ButtonModel::goClear()
|
||||
@@ -500,7 +500,7 @@ void CommandModel::goAddMacro(const QByteArray ¯oName)
|
||||
location = groups.size();
|
||||
//add row
|
||||
this->beginInsertRows(QModelIndex(), location, location);
|
||||
CommandNode *macroNode = new CommandNode(CommandNode::GroupType);
|
||||
auto macroNode = new CommandNode(CommandNode::GroupType);
|
||||
macroNode->parent = rootNode;
|
||||
rootNode->children.insert(location, macroNode);
|
||||
this->endInsertRows();
|
||||
@@ -519,7 +519,7 @@ void CommandModel::goAddMacro(const QByteArray ¯oName)
|
||||
return;
|
||||
|
||||
this->beginInsertRows(macrosIndex, parentNode->children.size(), parentNode->children.size());
|
||||
CommandNode *childNode = new CommandNode(CommandNode::CommandType);
|
||||
auto childNode = new CommandNode(CommandNode::CommandType);
|
||||
childNode->parent = parentNode;
|
||||
parentNode->children.push_back(childNode);
|
||||
childNode->aCommand = command;
|
||||
@@ -559,22 +559,22 @@ void CommandModel::initialize()
|
||||
{
|
||||
rootNode = new CommandNode(CommandNode::RootType);
|
||||
QStringList groups(orderedGroups());
|
||||
for (QStringList::iterator it = groups.begin(); it != groups.end(); ++it)
|
||||
groupCommands(*it);
|
||||
for (const auto & group : groups)
|
||||
groupCommands(group);
|
||||
}
|
||||
|
||||
void CommandModel::groupCommands(const QString& groupName)
|
||||
{
|
||||
CommandNode *parentNode = new CommandNode(CommandNode::GroupType);
|
||||
auto parentNode = new CommandNode(CommandNode::GroupType);
|
||||
parentNode->parent = rootNode;
|
||||
rootNode->children.push_back(parentNode);
|
||||
std::vector <Command*> commands = Application::Instance->commandManager().getGroupCommands(groupName.toLatin1());
|
||||
for (std::vector <Command*>::iterator it = commands.begin(); it != commands.end(); ++it)
|
||||
for (const auto & command : commands)
|
||||
{
|
||||
CommandNode *childNode = new CommandNode(CommandNode::CommandType);
|
||||
auto childNode = new CommandNode(CommandNode::CommandType);
|
||||
childNode->parent = parentNode;
|
||||
parentNode->children.push_back(childNode);
|
||||
childNode->aCommand = *it;
|
||||
childNode->aCommand = command;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -582,9 +582,9 @@ QStringList CommandModel::orderedGroups()
|
||||
{
|
||||
QStringList groups;
|
||||
std::vector <Command*> commands = Application::Instance->commandManager().getAllCommands();
|
||||
for (std::vector <Command*>::iterator it = commands.begin(); it != commands.end(); ++it)
|
||||
for (const auto & command : commands)
|
||||
{
|
||||
QString groupName(QString::fromLatin1((*it)->getGroupName()));
|
||||
QString groupName(QString::fromLatin1(command->getGroupName()));
|
||||
if (!groups.contains(groupName))
|
||||
groups << groupName;
|
||||
}
|
||||
@@ -663,7 +663,7 @@ DlgCustomizeSpaceball::DlgCustomizeSpaceball(QWidget *parent)
|
||||
, devModel(nullptr)
|
||||
{
|
||||
this->setWindowTitle(tr("Spaceball Buttons"));
|
||||
GUIApplicationNativeEventAware *app = qobject_cast<GUIApplicationNativeEventAware *>(QApplication::instance());
|
||||
auto app = qobject_cast<GUIApplicationNativeEventAware *>(QApplication::instance());
|
||||
if (!app)
|
||||
return;
|
||||
if (!app->isSpaceballPresent())
|
||||
@@ -690,9 +690,9 @@ DlgCustomizeSpaceball::~DlgCustomizeSpaceball()
|
||||
|
||||
void DlgCustomizeSpaceball::setMessage(const QString& message)
|
||||
{
|
||||
QLabel *messageLabel = new QLabel(message,this);
|
||||
QVBoxLayout *layout = new QVBoxLayout();
|
||||
QHBoxLayout *layout2 = new QHBoxLayout();
|
||||
auto messageLabel = new QLabel(message,this);
|
||||
auto layout = new QVBoxLayout();
|
||||
auto layout2 = new QHBoxLayout();
|
||||
layout2->addStretch();
|
||||
layout2->addWidget(messageLabel);
|
||||
layout2->addStretch();
|
||||
@@ -720,7 +720,7 @@ void DlgCustomizeSpaceball::setupCommandModelView()
|
||||
|
||||
void DlgCustomizeSpaceball::setupLayout()
|
||||
{
|
||||
QLabel *buttonLabel = new QLabel(tr("Buttons"), this);
|
||||
auto buttonLabel = new QLabel(tr("Buttons"), this);
|
||||
clearButton = new QPushButton(tr("Reset"), this);
|
||||
devModel = new QComboBox(this);
|
||||
|
||||
@@ -736,27 +736,27 @@ void DlgCustomizeSpaceball::setupLayout()
|
||||
devModel->setCurrentIndex(0);
|
||||
}
|
||||
|
||||
QVBoxLayout *buttonGroup = new QVBoxLayout();
|
||||
auto buttonGroup = new QVBoxLayout();
|
||||
buttonGroup->addWidget(buttonLabel);
|
||||
buttonGroup->addWidget(buttonView);
|
||||
QHBoxLayout *clearLayout = new QHBoxLayout();
|
||||
auto clearLayout = new QHBoxLayout();
|
||||
clearLayout->addWidget(devModel);
|
||||
clearLayout->addWidget(clearButton);
|
||||
clearLayout->addStretch();
|
||||
buttonGroup->addLayout(clearLayout);
|
||||
|
||||
QSplitter *splitter = new QSplitter(this);
|
||||
QWidget *leftPane = new QWidget(this);
|
||||
auto splitter = new QSplitter(this);
|
||||
auto leftPane = new QWidget(this);
|
||||
leftPane->setLayout(buttonGroup);
|
||||
splitter->addWidget(leftPane);
|
||||
splitter->addWidget(commandView);
|
||||
|
||||
printReference = new QPushButton(tr("Print Reference"), this);
|
||||
QHBoxLayout *printLayout = new QHBoxLayout();
|
||||
auto printLayout = new QHBoxLayout();
|
||||
printLayout->addStretch();
|
||||
printLayout->addWidget(printReference);
|
||||
|
||||
QVBoxLayout *layout = new QVBoxLayout();
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->addWidget(splitter);
|
||||
layout->addLayout(printLayout);
|
||||
|
||||
@@ -783,8 +783,8 @@ void DlgCustomizeSpaceball::goClear()
|
||||
|
||||
void DlgCustomizeSpaceball::goPrint()
|
||||
{
|
||||
QTableView *view = new QTableView(this);
|
||||
PrintModel *model = new PrintModel(this, buttonModel, commandModel);
|
||||
auto view = new QTableView(this);
|
||||
auto model = new PrintModel(this, buttonModel, commandModel);
|
||||
view->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed);
|
||||
view->setModel(model);
|
||||
view->horizontalHeader()->resizeSection(0, 150);
|
||||
@@ -804,7 +804,7 @@ bool DlgCustomizeSpaceball::event(QEvent *event)
|
||||
{
|
||||
if (event->type() != Spaceball::ButtonEvent::ButtonEventType)
|
||||
return CustomizeActionPage::event(event);
|
||||
Spaceball::ButtonEvent *buttonEvent = dynamic_cast<Spaceball::ButtonEvent *>(event);
|
||||
auto buttonEvent = dynamic_cast<Spaceball::ButtonEvent *>(event);
|
||||
if (!buttonEvent)
|
||||
return true;
|
||||
buttonEvent->setHandled(true);
|
||||
|
||||
@@ -158,8 +158,9 @@ void DlgDisplayPropertiesImp::slotChangedObject(const Gui::ViewProvider& obj,
|
||||
// This method gets called if a property of any view provider is changed.
|
||||
// We pick out all the properties for which we need to update this dialog.
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
std::vector<Gui::ViewProvider*>::const_iterator vp = std::find_if
|
||||
(Provider.begin(), Provider.end(), [&obj](Gui::ViewProvider* v) { return v == &obj; });
|
||||
auto vp = std::find_if(Provider.begin(),
|
||||
Provider.end(),
|
||||
[&obj](Gui::ViewProvider* v) { return v == &obj; });
|
||||
|
||||
if (vp != Provider.end()) {
|
||||
const char* name = obj.getPropertyName(&prop);
|
||||
@@ -273,10 +274,10 @@ void DlgDisplayPropertiesImp::on_changeMaterial_activated(int index)
|
||||
(int)(diffuseColor.g*255.0f),
|
||||
(int)(diffuseColor.b*255.0f)));
|
||||
|
||||
for (std::vector<Gui::ViewProvider*>::iterator It= Provider.begin();It!=Provider.end();++It) {
|
||||
for (auto It= Provider.begin(); It != Provider.end(); ++It) {
|
||||
App::Property* prop = (*It)->getPropertyByName("ShapeMaterial");
|
||||
if (prop && prop->getTypeId() == App::PropertyMaterial::getClassTypeId()) {
|
||||
App::PropertyMaterial* ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
auto ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
ShapeMaterial->setValue(mat);
|
||||
}
|
||||
}
|
||||
@@ -289,10 +290,10 @@ void DlgDisplayPropertiesImp::on_changeMode_activated(const QString& s)
|
||||
{
|
||||
Gui::WaitCursor wc;
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
for (std::vector<Gui::ViewProvider*>::iterator It= Provider.begin();It!=Provider.end();++It) {
|
||||
for (auto It= Provider.begin();It!=Provider.end();++It) {
|
||||
App::Property* prop = (*It)->getPropertyByName("DisplayMode");
|
||||
if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) {
|
||||
App::PropertyEnumeration* Display = (App::PropertyEnumeration*)prop;
|
||||
auto Display = (App::PropertyEnumeration*)prop;
|
||||
Display->setValue((const char*)s.toLatin1());
|
||||
}
|
||||
}
|
||||
@@ -311,10 +312,10 @@ void DlgDisplayPropertiesImp::on_buttonColor_changed()
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
QColor s = d->ui.buttonColor->color();
|
||||
App::Color c(s.red()/255.0,s.green()/255.0,s.blue()/255.0);
|
||||
for (std::vector<Gui::ViewProvider*>::iterator It= Provider.begin();It!=Provider.end();++It) {
|
||||
for (auto It= Provider.begin();It!=Provider.end();++It) {
|
||||
App::Property* prop = (*It)->getPropertyByName("ShapeColor");
|
||||
if (prop && prop->getTypeId() == App::PropertyColor::getClassTypeId()) {
|
||||
App::PropertyColor* ShapeColor = (App::PropertyColor*)prop;
|
||||
auto ShapeColor = (App::PropertyColor*)prop;
|
||||
ShapeColor->setValue(c);
|
||||
}
|
||||
}
|
||||
@@ -326,10 +327,10 @@ void DlgDisplayPropertiesImp::on_buttonColor_changed()
|
||||
void DlgDisplayPropertiesImp::on_spinTransparency_valueChanged(int transparency)
|
||||
{
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
for (std::vector<Gui::ViewProvider*>::iterator It= Provider.begin();It!=Provider.end();++It) {
|
||||
for (auto It= Provider.begin();It!=Provider.end();++It) {
|
||||
App::Property* prop = (*It)->getPropertyByName("Transparency");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
|
||||
App::PropertyInteger* Transparency = (App::PropertyInteger*)prop;
|
||||
auto Transparency = (App::PropertyInteger*)prop;
|
||||
Transparency->setValue(transparency);
|
||||
}
|
||||
}
|
||||
@@ -341,10 +342,10 @@ void DlgDisplayPropertiesImp::on_spinTransparency_valueChanged(int transparency)
|
||||
void DlgDisplayPropertiesImp::on_spinPointSize_valueChanged(int pointsize)
|
||||
{
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
for (std::vector<Gui::ViewProvider*>::iterator It= Provider.begin();It!=Provider.end();++It) {
|
||||
App::Property* prop = (*It)->getPropertyByName("PointSize");
|
||||
for (const auto & It : Provider) {
|
||||
App::Property* prop = It->getPropertyByName("PointSize");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||
App::PropertyFloat* PointSize = (App::PropertyFloat*)prop;
|
||||
auto PointSize = (App::PropertyFloat*)prop;
|
||||
PointSize->setValue((double)pointsize);
|
||||
}
|
||||
}
|
||||
@@ -356,10 +357,10 @@ void DlgDisplayPropertiesImp::on_spinPointSize_valueChanged(int pointsize)
|
||||
void DlgDisplayPropertiesImp::on_spinLineWidth_valueChanged(int linewidth)
|
||||
{
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
for (std::vector<Gui::ViewProvider*>::iterator It= Provider.begin();It!=Provider.end();++It) {
|
||||
App::Property* prop = (*It)->getPropertyByName("LineWidth");
|
||||
for (const auto & It : Provider) {
|
||||
App::Property* prop = It->getPropertyByName("LineWidth");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||
App::PropertyFloat* LineWidth = (App::PropertyFloat*)prop;
|
||||
auto LineWidth = (App::PropertyFloat*)prop;
|
||||
LineWidth->setValue((double)linewidth);
|
||||
}
|
||||
}
|
||||
@@ -370,10 +371,10 @@ void DlgDisplayPropertiesImp::on_buttonLineColor_changed()
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
QColor s = d->ui.buttonLineColor->color();
|
||||
App::Color c(s.red()/255.0,s.green()/255.0,s.blue()/255.0);
|
||||
for (std::vector<Gui::ViewProvider*>::iterator It= Provider.begin();It!=Provider.end();++It) {
|
||||
App::Property* prop = (*It)->getPropertyByName("LineColor");
|
||||
for (const auto & It : Provider) {
|
||||
App::Property* prop = It->getPropertyByName("LineColor");
|
||||
if (prop && prop->getTypeId() == App::PropertyColor::getClassTypeId()) {
|
||||
App::PropertyColor* ShapeColor = (App::PropertyColor*)prop;
|
||||
auto ShapeColor = (App::PropertyColor*)prop;
|
||||
ShapeColor->setValue(c);
|
||||
}
|
||||
}
|
||||
@@ -382,10 +383,10 @@ void DlgDisplayPropertiesImp::on_buttonLineColor_changed()
|
||||
void DlgDisplayPropertiesImp::on_spinLineTransparency_valueChanged(int transparency)
|
||||
{
|
||||
std::vector<Gui::ViewProvider*> Provider = getSelection();
|
||||
for (std::vector<Gui::ViewProvider*>::iterator It= Provider.begin();It!=Provider.end();++It) {
|
||||
App::Property* prop = (*It)->getPropertyByName("LineTransparency");
|
||||
for (const auto & It : Provider) {
|
||||
App::Property* prop = It->getPropertyByName("LineTransparency");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
|
||||
App::PropertyInteger* Transparency = (App::PropertyInteger*)prop;
|
||||
auto Transparency = (App::PropertyInteger*)prop;
|
||||
Transparency->setValue(transparency);
|
||||
}
|
||||
}
|
||||
@@ -394,21 +395,21 @@ void DlgDisplayPropertiesImp::on_spinLineTransparency_valueChanged(int transpare
|
||||
void DlgDisplayPropertiesImp::setDisplayModes(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
QStringList commonModes, modes;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
for (auto it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("DisplayMode");
|
||||
if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) {
|
||||
App::PropertyEnumeration* display = static_cast<App::PropertyEnumeration*>(prop);
|
||||
auto display = static_cast<App::PropertyEnumeration*>(prop);
|
||||
if (!display->hasEnums())
|
||||
return;
|
||||
std::vector<std::string> value = display->getEnumVector();
|
||||
if (it == views.begin()) {
|
||||
for (std::vector<std::string>::const_iterator jt = value.begin(); jt != value.end(); ++jt)
|
||||
commonModes << QLatin1String(jt->c_str());
|
||||
for (const auto & jt : value)
|
||||
commonModes << QLatin1String(jt.c_str());
|
||||
}
|
||||
else {
|
||||
for (std::vector<std::string>::const_iterator jt = value.begin(); jt != value.end(); ++jt) {
|
||||
if (commonModes.contains(QLatin1String(jt->c_str())))
|
||||
modes << QLatin1String(jt->c_str());
|
||||
for (const auto & jt : value) {
|
||||
if (commonModes.contains(QLatin1String(jt.c_str())))
|
||||
modes << QLatin1String(jt.c_str());
|
||||
}
|
||||
|
||||
commonModes = modes;
|
||||
@@ -422,10 +423,10 @@ void DlgDisplayPropertiesImp::setDisplayModes(const std::vector<Gui::ViewProvide
|
||||
d->ui.changeMode->setDisabled(commonModes.isEmpty());
|
||||
|
||||
// find the display mode to activate
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("DisplayMode");
|
||||
for (const auto & view : views) {
|
||||
App::Property* prop = view->getPropertyByName("DisplayMode");
|
||||
if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) {
|
||||
App::PropertyEnumeration* display = static_cast<App::PropertyEnumeration*>(prop);
|
||||
auto display = static_cast<App::PropertyEnumeration*>(prop);
|
||||
QString activeMode = QString::fromLatin1(display->getValueAsString());
|
||||
int index = d->ui.changeMode->findText(activeMode);
|
||||
if (index != -1) {
|
||||
@@ -440,8 +441,8 @@ void DlgDisplayPropertiesImp::setMaterial(const std::vector<Gui::ViewProvider*>&
|
||||
{
|
||||
bool material = false;
|
||||
App::Material::MaterialType matType = App::Material::DEFAULT;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("ShapeMaterial");
|
||||
for (const auto & view : views) {
|
||||
App::Property* prop = view->getPropertyByName("ShapeMaterial");
|
||||
if (prop && prop->getTypeId() == App::PropertyMaterial::getClassTypeId()) {
|
||||
material = true;
|
||||
matType = static_cast<App::PropertyMaterial*>(prop)->getValue().getType();
|
||||
@@ -460,8 +461,8 @@ void DlgDisplayPropertiesImp::setMaterial(const std::vector<Gui::ViewProvider*>&
|
||||
void DlgDisplayPropertiesImp::setColorPlot(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
bool material = false;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("TextureMaterial");
|
||||
for (const auto & view : views) {
|
||||
App::Property* prop = view->getPropertyByName("TextureMaterial");
|
||||
if (prop && prop->getTypeId() == App::PropertyMaterial::getClassTypeId()) {
|
||||
material = true;
|
||||
break;
|
||||
@@ -500,8 +501,8 @@ void DlgDisplayPropertiesImp::fillupMaterials()
|
||||
void DlgDisplayPropertiesImp::setShapeColor(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
bool shapeColor = false;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("ShapeColor");
|
||||
for (const auto & view : views) {
|
||||
App::Property* prop = view->getPropertyByName("ShapeColor");
|
||||
if (prop && prop->getTypeId() == App::PropertyColor::getClassTypeId()) {
|
||||
App::Color c = static_cast<App::PropertyColor*>(prop)->getValue();
|
||||
QColor shape;
|
||||
@@ -520,8 +521,8 @@ void DlgDisplayPropertiesImp::setShapeColor(const std::vector<Gui::ViewProvider*
|
||||
void DlgDisplayPropertiesImp::setLineColor(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
bool shapeColor = false;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("LineColor");
|
||||
for (const auto & view : views) {
|
||||
App::Property* prop = view->getPropertyByName("LineColor");
|
||||
if (prop && prop->getTypeId() == App::PropertyColor::getClassTypeId()) {
|
||||
App::Color c = static_cast<App::PropertyColor*>(prop)->getValue();
|
||||
QColor shape;
|
||||
@@ -540,8 +541,8 @@ void DlgDisplayPropertiesImp::setLineColor(const std::vector<Gui::ViewProvider*>
|
||||
void DlgDisplayPropertiesImp::setPointSize(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
bool pointSize = false;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("PointSize");
|
||||
for (const auto & view : views) {
|
||||
App::Property* prop = view->getPropertyByName("PointSize");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||
bool blocked = d->ui.spinPointSize->blockSignals(true);
|
||||
d->ui.spinPointSize->setValue((int)static_cast<App::PropertyFloat*>(prop)->getValue());
|
||||
@@ -557,8 +558,8 @@ void DlgDisplayPropertiesImp::setPointSize(const std::vector<Gui::ViewProvider*>
|
||||
void DlgDisplayPropertiesImp::setLineWidth(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
bool lineWidth = false;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("LineWidth");
|
||||
for (const auto & view : views) {
|
||||
App::Property* prop = view->getPropertyByName("LineWidth");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyFloat::getClassTypeId())) {
|
||||
bool blocked = d->ui.spinLineWidth->blockSignals(true);
|
||||
d->ui.spinLineWidth->setValue((int)static_cast<App::PropertyFloat*>(prop)->getValue());
|
||||
@@ -574,8 +575,8 @@ void DlgDisplayPropertiesImp::setLineWidth(const std::vector<Gui::ViewProvider*>
|
||||
void DlgDisplayPropertiesImp::setTransparency(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
bool transparency = false;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("Transparency");
|
||||
for (const auto & view : views) {
|
||||
App::Property* prop = view->getPropertyByName("Transparency");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
|
||||
bool blocked = d->ui.spinTransparency->blockSignals(true);
|
||||
d->ui.spinTransparency->setValue(static_cast<App::PropertyInteger*>(prop)->getValue());
|
||||
@@ -596,8 +597,8 @@ void DlgDisplayPropertiesImp::setTransparency(const std::vector<Gui::ViewProvide
|
||||
void DlgDisplayPropertiesImp::setLineTransparency(const std::vector<Gui::ViewProvider*>& views)
|
||||
{
|
||||
bool transparency = false;
|
||||
for (std::vector<Gui::ViewProvider*>::const_iterator it = views.begin(); it != views.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName("LineTransparency");
|
||||
for (const auto & view : views) {
|
||||
App::Property* prop = view->getPropertyByName("LineTransparency");
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
|
||||
bool blocked = d->ui.spinLineTransparency->blockSignals(true);
|
||||
d->ui.spinLineTransparency->setValue(static_cast<App::PropertyInteger*>(prop)->getValue());
|
||||
@@ -621,8 +622,8 @@ std::vector<Gui::ViewProvider*> DlgDisplayPropertiesImp::getSelection() const
|
||||
|
||||
// get the complete selection
|
||||
std::vector<SelectionSingleton::SelObj> sel = Selection().getCompleteSelection();
|
||||
for (std::vector<SelectionSingleton::SelObj>::iterator it = sel.begin(); it != sel.end(); ++it) {
|
||||
Gui::ViewProvider* view = Application::Instance->getDocument(it->pDoc)->getViewProvider(it->pObject);
|
||||
for (const auto & it : sel) {
|
||||
Gui::ViewProvider* view = Application::Instance->getDocument(it.pDoc)->getViewProvider(it.pObject);
|
||||
views.push_back(view);
|
||||
}
|
||||
|
||||
|
||||
@@ -133,7 +133,7 @@ DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent )
|
||||
ui->displayItems->setHeaderLabels(labels);
|
||||
ui->displayItems->header()->hide();
|
||||
for (QVector<QPair<QString, unsigned int> >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->displayItems);
|
||||
auto item = new QTreeWidgetItem(ui->displayItems);
|
||||
item->setText(0, tr((*it).first.toLatin1()));
|
||||
}
|
||||
pythonSyntax = new PythonSyntaxHighlighter(ui->textEdit1);
|
||||
@@ -194,7 +194,7 @@ void DlgSettingsEditorImp::saveSettings()
|
||||
// Saves the color map
|
||||
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Editor");
|
||||
for (QVector<QPair<QString, unsigned int> >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it) {
|
||||
unsigned long col = static_cast<unsigned long>((*it).second);
|
||||
auto col = static_cast<unsigned long>((*it).second);
|
||||
hGrp->SetUnsigned((*it).first.toLatin1(), col);
|
||||
}
|
||||
|
||||
@@ -232,7 +232,7 @@ void DlgSettingsEditorImp::loadSettings()
|
||||
// Restores the color map
|
||||
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Editor");
|
||||
for (QVector<QPair<QString, unsigned int> >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it){
|
||||
unsigned long col = static_cast<unsigned long>((*it).second);
|
||||
auto col = static_cast<unsigned long>((*it).second);
|
||||
col = hGrp->GetUnsigned((*it).first.toLatin1(), col);
|
||||
(*it).second = static_cast<unsigned int>(col);
|
||||
QColor color;
|
||||
|
||||
@@ -156,7 +156,7 @@ void DlgExpressionInput::textChanged(const QString &text)
|
||||
//set default palette as we may have read text right now
|
||||
ui->msg->setPalette(ui->okBtn->palette());
|
||||
|
||||
NumberExpression * n = Base::freecad_dynamic_cast<NumberExpression>(result.get());
|
||||
auto * n = Base::freecad_dynamic_cast<NumberExpression>(result.get());
|
||||
if (n) {
|
||||
Base::Quantity value = n->getQuantity();
|
||||
QString msg = value.getUserString();
|
||||
@@ -252,7 +252,7 @@ bool DlgExpressionInput::eventFilter(QObject *obj, QEvent *ev)
|
||||
// cursor is on this or an underlying widget or outside.
|
||||
if (!underMouse()) {
|
||||
// if the expression fields context-menu is open do not close the dialog
|
||||
QMenu* menu = qobject_cast<QMenu*>(obj);
|
||||
auto menu = qobject_cast<QMenu*>(obj);
|
||||
if (menu && menu->parentWidget() == ui->expression) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+12
-11
@@ -62,9 +62,9 @@ DlgGeneralImp::DlgGeneralImp( QWidget* parent )
|
||||
// sorted by their menu text
|
||||
QStringList work = Application::Instance->workbenches();
|
||||
QMap<QString, QString> menuText;
|
||||
for (QStringList::Iterator it = work.begin(); it != work.end(); ++it) {
|
||||
QString text = Application::Instance->workbenchMenuText(*it);
|
||||
menuText[text] = *it;
|
||||
for (const auto & it : work) {
|
||||
QString text = Application::Instance->workbenchMenuText(it);
|
||||
menuText[text] = it;
|
||||
}
|
||||
|
||||
{ // add special workbench to selection
|
||||
@@ -113,7 +113,8 @@ DlgGeneralImp::~DlgGeneralImp()
|
||||
*/
|
||||
void DlgGeneralImp::setRecentFileSize()
|
||||
{
|
||||
RecentFilesAction *recent = getMainWindow()->findChild<RecentFilesAction *>(QLatin1String("recentFiles"));
|
||||
auto recent = getMainWindow()->findChild<RecentFilesAction *>
|
||||
(QLatin1String("recentFiles"));
|
||||
if (recent) {
|
||||
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentFiles");
|
||||
recent->resizeList(hGrp->GetInt("RecentFiles", 4));
|
||||
@@ -236,7 +237,7 @@ void DlgGeneralImp::loadSettings()
|
||||
TStringMap list = Translator::instance()->supportedLocales();
|
||||
ui->Languages->clear();
|
||||
ui->Languages->addItem(QString::fromLatin1("English"), QByteArray("English"));
|
||||
for (TStringMap::iterator it = list.begin(); it != list.end(); ++it, index++) {
|
||||
for (auto it = list.begin(); it != list.end(); ++it, index++) {
|
||||
QByteArray lang = it->first.c_str();
|
||||
QString langname = QString::fromLatin1(lang.constData());
|
||||
|
||||
@@ -300,12 +301,12 @@ void DlgGeneralImp::loadSettings()
|
||||
|
||||
// read from user, resource and built-in directory
|
||||
QStringList qssPaths = QDir::searchPaths(QString::fromLatin1("qss"));
|
||||
for (QStringList::iterator it = qssPaths.begin(); it != qssPaths.end(); ++it) {
|
||||
dir.setPath(*it);
|
||||
for (const auto & qssPath : qssPaths) {
|
||||
dir.setPath(qssPath);
|
||||
fileNames = dir.entryInfoList(filter, QDir::Files, QDir::Name);
|
||||
for (QFileInfoList::iterator jt = fileNames.begin(); jt != fileNames.end(); ++jt) {
|
||||
if (cssFiles.find(jt->baseName()) == cssFiles.end()) {
|
||||
cssFiles[jt->baseName()] = jt->fileName();
|
||||
for (const auto & fileName : fileNames) {
|
||||
if (cssFiles.find(fileName.baseName()) == cssFiles.end()) {
|
||||
cssFiles[fileName.baseName()] = fileName.fileName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -389,7 +390,7 @@ void DlgGeneralImp::recreatePreferencePackMenu()
|
||||
else
|
||||
tagString.append(QStringLiteral(", ") + QString::fromStdString(tag));
|
||||
}
|
||||
QTableWidgetItem* kind = new QTableWidgetItem(tagString);
|
||||
auto kind = new QTableWidgetItem(tagString);
|
||||
ui->PreferencePacks->setItem(row, 1, kind);
|
||||
auto button = new QPushButton(icon, tr("Apply"));
|
||||
button->setToolTip(tr("Apply the %1 preference pack").arg(QString::fromStdString(pack.first)));
|
||||
|
||||
+37
-37
@@ -84,9 +84,9 @@ DlgCustomKeyboardImp::DlgCustomKeyboardImp( QWidget* parent )
|
||||
groupMap.push_back(std::make_pair(QLatin1String("Help"), QString()));
|
||||
groupMap.push_back(std::make_pair(QLatin1String("Macros"), qApp->translate("Gui::MacroCommand", "Macros")));
|
||||
|
||||
for (std::map<std::string,Command*>::iterator it = sCommands.begin(); it != sCommands.end(); ++it) {
|
||||
QLatin1String group(it->second->getGroupName());
|
||||
QString text = it->second->translatedGroupName();
|
||||
for (const auto & sCommand : sCommands) {
|
||||
QLatin1String group(sCommand.second->getGroupName());
|
||||
QString text = sCommand.second->translatedGroupName();
|
||||
GroupMap::iterator jt;
|
||||
jt = std::find_if(groupMap.begin(), groupMap.end(), GroupMap_find(group));
|
||||
if (jt != groupMap.end()) {
|
||||
@@ -99,7 +99,7 @@ DlgCustomKeyboardImp::DlgCustomKeyboardImp( QWidget* parent )
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
for (GroupMap::iterator it = groupMap.begin(); it != groupMap.end(); ++it, ++index) {
|
||||
for (auto it = groupMap.begin(); it != groupMap.end(); ++it, ++index) {
|
||||
ui->categoryBox->addItem(it->second);
|
||||
ui->categoryBox->setItemData(index, QVariant(it->first), Qt::UserRole);
|
||||
}
|
||||
@@ -184,25 +184,25 @@ void DlgCustomKeyboardImp::on_categoryBox_activated(int index)
|
||||
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands( group.toLatin1() );
|
||||
|
||||
if (group == QLatin1String("Macros")) {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8((*it)->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8((*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
for (const auto & aCmd : aCmds) {
|
||||
auto item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8(aCmd->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8(aCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray(aCmd->getName()));
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
if ((*it)->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme((*it)->getPixmap()));
|
||||
if (aCmd->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme(aCmd->getPixmap()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, qApp->translate((*it)->className(), (*it)->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate((*it)->className(), (*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
for (const auto & aCmd : aCmds) {
|
||||
auto item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, qApp->translate(aCmd->className(), aCmd->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate(aCmd->className(), aCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray(aCmd->getName()));
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
if ((*it)->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme((*it)->getPixmap()));
|
||||
if (aCmd->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme(aCmd->getPixmap()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -299,14 +299,14 @@ void DlgCustomKeyboardImp::on_buttonResetAll_clicked()
|
||||
{
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
std::vector<Command*> cmds = cCmdMgr.getAllCommands();
|
||||
for (std::vector<Command*>::iterator it = cmds.begin(); it != cmds.end(); ++it) {
|
||||
if ((*it)->getAction()) {
|
||||
(*it)->getAction()->setShortcut(QKeySequence(QString::fromLatin1((*it)->getAccel()))
|
||||
for (const auto & cmd : cmds) {
|
||||
if (cmd->getAction()) {
|
||||
cmd->getAction()->setShortcut(QKeySequence(QString::fromLatin1(cmd->getAccel()))
|
||||
.toString(QKeySequence::NativeText));
|
||||
|
||||
|
||||
// update the tool tip (and status tip)
|
||||
(*it)->recreateTooltip((*it)->className(), (*it)->getAction());
|
||||
cmd->recreateTooltip(cmd->className(), cmd->getAction());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,24 +342,24 @@ void DlgCustomKeyboardImp::on_editShortcut_textChanged(const QString& sc)
|
||||
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
std::vector<Command*> cmds = cCmdMgr.getAllCommands();
|
||||
for (std::vector<Command*>::iterator it = cmds.begin(); it != cmds.end(); ++it) {
|
||||
if ((*it)->getAction()) {
|
||||
for (const auto & cmd : cmds) {
|
||||
if (cmd->getAction()) {
|
||||
// A command may have several QAction's. So, check all of them if one of them matches (See bug #0002160)
|
||||
QList<QAction*> acts = (*it)->getAction()->findChildren<QAction*>();
|
||||
for (QList<QAction*>::iterator jt = acts.begin(); jt != acts.end(); ++jt) {
|
||||
if ((*jt)->shortcut() == ks) {
|
||||
QList<QAction*> acts = cmd->getAction()->findChildren<QAction*>();
|
||||
for (const auto & act : acts) {
|
||||
if (act->shortcut() == ks) {
|
||||
++countAmbiguous;
|
||||
ambiguousCommands.push_back(*it);
|
||||
ambiguousCommand = QString::fromLatin1((*it)->getName()); // store the last one
|
||||
ambiguousMenu = qApp->translate((*it)->className(), (*it)->getMenuText());
|
||||
ambiguousCommands.push_back(cmd);
|
||||
ambiguousCommand = QString::fromLatin1(cmd->getName()); // store the last one
|
||||
ambiguousMenu = qApp->translate(cmd->className(), cmd->getMenuText());
|
||||
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->assignedTreeWidget);
|
||||
item->setText(1, qApp->translate((*it)->className(), (*it)->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate((*it)->className(), (*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
auto item = new QTreeWidgetItem(ui->assignedTreeWidget);
|
||||
item->setText(1, qApp->translate(cmd->className(), cmd->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate(cmd->className(), cmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray(cmd->getName()));
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
if ((*it)->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme((*it)->getPixmap()));
|
||||
if (cmd->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme(cmd->getPixmap()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -419,7 +419,7 @@ void DlgCustomKeyboardImp::onAddMacroAction(const QByteArray& macro)
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
Command* pCmd = cCmdMgr.getCommandByName(macro);
|
||||
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
auto item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8(pCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, macro);
|
||||
|
||||
@@ -118,7 +118,7 @@ void DlgMacroExecuteImp::fillUpList()
|
||||
// fill up with the directory
|
||||
ui->userMacroListBox->clear();
|
||||
for (unsigned int i=0; i<dir.count(); i++ ) {
|
||||
MacroItem* item = new MacroItem(ui->userMacroListBox,false);
|
||||
auto item = new MacroItem(ui->userMacroListBox,false);
|
||||
item->setText(0, dir[i]);
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ void DlgMacroExecuteImp::fillUpList()
|
||||
ui->systemMacroListBox->clear();
|
||||
if (dir.exists()) {
|
||||
for (unsigned int i=0; i<dir.count(); i++ ) {
|
||||
MacroItem* item = new MacroItem(ui->systemMacroListBox,true);
|
||||
auto item = new MacroItem(ui->systemMacroListBox,true);
|
||||
item->setText(0, dir[i]);
|
||||
}
|
||||
}
|
||||
@@ -261,7 +261,7 @@ void DlgMacroExecuteImp::accept()
|
||||
|
||||
QDialog::accept();
|
||||
|
||||
MacroItem * mitem = static_cast<MacroItem *>(item);
|
||||
auto mitem = static_cast<MacroItem *>(item);
|
||||
|
||||
QDir dir;
|
||||
|
||||
@@ -326,12 +326,12 @@ void DlgMacroExecuteImp::on_editButton_clicked()
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
MacroItem * mitem = static_cast<MacroItem *>(item);
|
||||
auto mitem = static_cast<MacroItem *>(item);
|
||||
|
||||
QString file = QString::fromLatin1("%1/%2").arg(dir.absolutePath(), item->text(0));
|
||||
PythonEditor* editor = new PythonEditor();
|
||||
auto editor = new PythonEditor();
|
||||
editor->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
|
||||
PythonEditorView* edit = new PythonEditorView(editor, getMainWindow());
|
||||
auto edit = new PythonEditorView(editor, getMainWindow());
|
||||
edit->setDisplayName(PythonEditorView::FileName);
|
||||
edit->open(file);
|
||||
edit->resize(400, 300);
|
||||
@@ -386,9 +386,9 @@ void DlgMacroExecuteImp::on_createButton_clicked()
|
||||
return;
|
||||
}
|
||||
file.close();
|
||||
PythonEditor* editor = new PythonEditor();
|
||||
auto editor = new PythonEditor();
|
||||
editor->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
|
||||
PythonEditorView* edit = new PythonEditorView(editor, getMainWindow());
|
||||
auto edit = new PythonEditorView(editor, getMainWindow());
|
||||
edit->open(fi.absoluteFilePath());
|
||||
getMainWindow()->appendRecentMacro(fi.absoluteFilePath());
|
||||
edit->setWindowTitle(QString::fromLatin1("%1[*]").arg(fn));
|
||||
@@ -406,7 +406,7 @@ void DlgMacroExecuteImp::on_deleteButton_clicked()
|
||||
if (!item)
|
||||
return;
|
||||
|
||||
MacroItem * mitem = static_cast<MacroItem *>(item);
|
||||
auto mitem = static_cast<MacroItem *>(item);
|
||||
|
||||
if (mitem->systemWide) {
|
||||
QMessageBox::critical(Gui::getMainWindow(), QObject::tr("Delete macro"),
|
||||
@@ -481,8 +481,8 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
QString macroMenuText;
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands("Macros");
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
MacroCommand* mc = dynamic_cast<MacroCommand*>(*it);
|
||||
for (const auto & aCmd : aCmds) {
|
||||
auto mc = dynamic_cast<MacroCommand*>(aCmd);
|
||||
if (mc && fn.compare(QLatin1String(mc->getScriptName())) == 0) {
|
||||
hasMacroCommand = true;
|
||||
macroMenuText = QString::fromLatin1(mc->getMenuText());
|
||||
@@ -504,14 +504,14 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
QWidget* setupCustomMacrosPage = tabWidget->findChild<QWidget*>(QString::fromLatin1("Gui__Dialog__DlgCustomActions"));
|
||||
auto setupCustomMacrosPage = tabWidget->findChild<QWidget*>(QString::fromLatin1("Gui__Dialog__DlgCustomActions"));
|
||||
if (!setupCustomMacrosPage) {
|
||||
std::cerr << "Toolbar walkthrough error: Unable to find setupCustomMacrosPage" << std::endl;
|
||||
return;
|
||||
}
|
||||
tabWidget->setCurrentWidget(setupCustomMacrosPage);
|
||||
|
||||
QGroupBox* groupBox7 = setupCustomMacrosPage->findChild<QGroupBox*>(QString::fromLatin1("GroupBox7"));
|
||||
auto groupBox7 = setupCustomMacrosPage->findChild<QGroupBox*>(QString::fromLatin1("GroupBox7"));
|
||||
if (!groupBox7) {
|
||||
Base::Console().Warning("Toolbar walkthrough: Unable to find groupBox7\n");
|
||||
//just warn when not a fatal error
|
||||
@@ -521,14 +521,14 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
groupBox7->setStyleSheet(QString::fromLatin1("QGroupBox::title {color:red}"));
|
||||
}
|
||||
|
||||
QPushButton* buttonAddAction = setupCustomMacrosPage->findChild<QPushButton*>(QString::fromLatin1("buttonAddAction"));
|
||||
auto buttonAddAction = setupCustomMacrosPage->findChild<QPushButton*>(QString::fromLatin1("buttonAddAction"));
|
||||
if (!buttonAddAction) {
|
||||
Base::Console().Warning("Toolbar walkthrough: Unable to find buttonAddAction\n");
|
||||
} else {
|
||||
buttonAddAction->setStyleSheet(QString::fromLatin1("color:red"));
|
||||
}
|
||||
|
||||
QComboBox* macroListBox = setupCustomMacrosPage->findChild<QComboBox*>(QString::fromLatin1("actionMacros"));
|
||||
auto macroListBox = setupCustomMacrosPage->findChild<QComboBox*>(QString::fromLatin1("actionMacros"));
|
||||
if (!macroListBox) {
|
||||
Base::Console().Warning("Toolbar walkthrough: Unable to find actionMacros combo box\n");
|
||||
} else {
|
||||
@@ -536,7 +536,7 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
macroListBox->setCurrentIndex(macroIndex); //select it for the user so they don't have to
|
||||
}
|
||||
|
||||
QLineEdit* menuText = setupCustomMacrosPage->findChild<QLineEdit*>(QString::fromLatin1("actionMenu"));
|
||||
auto menuText = setupCustomMacrosPage->findChild<QLineEdit*>(QString::fromLatin1("actionMenu"));
|
||||
if (!menuText) {
|
||||
Base::Console().Warning("Toolbar walkthrough: Unable to find actionMenu menuText\n");
|
||||
} else {
|
||||
@@ -563,14 +563,14 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
return;
|
||||
}
|
||||
|
||||
DlgCustomToolbars* setupToolbarPage = tabWidget->findChild<DlgCustomToolbars*>(QString::fromLatin1("Gui__Dialog__DlgCustomToolbars"));
|
||||
auto setupToolbarPage = tabWidget->findChild<DlgCustomToolbars*>(QString::fromLatin1("Gui__Dialog__DlgCustomToolbars"));
|
||||
if (!setupToolbarPage){
|
||||
std::cerr << "Toolbar walkthrough: Unable to find setupToolbarPage Gui__Dialog__DlgCustomToolbars" << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
tabWidget->setCurrentWidget(setupToolbarPage);
|
||||
QPushButton* moveActionRightButton = setupToolbarPage->findChild<QPushButton*>(QString::fromLatin1("moveActionRightButton"));
|
||||
auto moveActionRightButton = setupToolbarPage->findChild<QPushButton*>(QString::fromLatin1("moveActionRightButton"));
|
||||
if (!moveActionRightButton){
|
||||
Base::Console().Warning("Toolbar walkthrough: Unable to find moveActionRightButton\n");
|
||||
} else {
|
||||
@@ -581,7 +581,7 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
**/
|
||||
|
||||
QString instructions2 = tr("Walkthrough instructions: Click right arrow button (->), then Close.");
|
||||
QComboBox* workbenchBox = setupToolbarPage->findChild<QComboBox*>(QString::fromLatin1("workbenchBox"));
|
||||
auto workbenchBox = setupToolbarPage->findChild<QComboBox*>(QString::fromLatin1("workbenchBox"));
|
||||
if (!workbenchBox) {
|
||||
Base::Console().Warning("Toolbar walkthrough: Unable to find workbenchBox\n");
|
||||
}
|
||||
@@ -600,7 +600,7 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
}
|
||||
|
||||
if (!hasCustomToolbar){
|
||||
QPushButton* newButton = setupToolbarPage->findChild<QPushButton*>(QString::fromLatin1("newButton"));
|
||||
auto newButton = setupToolbarPage->findChild<QPushButton*>(QString::fromLatin1("newButton"));
|
||||
if (!newButton){
|
||||
Base::Console().Warning("Toolbar walkthrough: Unable to find newButton\n");
|
||||
} else {
|
||||
@@ -611,7 +611,7 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
}
|
||||
/** "label" normally says "Note: the changes become active the next time you load the appropriate workbench" **/
|
||||
|
||||
QLabel *label = setupToolbarPage->findChild<QLabel*>(QString::fromLatin1("label"));
|
||||
auto label = setupToolbarPage->findChild<QLabel*>(QString::fromLatin1("label"));
|
||||
if (!label){
|
||||
Base::Console().Warning("Toolbar walkthrough: Unable to find label\n");
|
||||
} else {
|
||||
@@ -620,7 +620,7 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
}
|
||||
|
||||
/** find Macros category and select it for the user **/
|
||||
QComboBox* categoryBox = setupToolbarPage->findChild<QComboBox*>(QString::fromLatin1("categoryBox"));
|
||||
auto categoryBox = setupToolbarPage->findChild<QComboBox*>(QString::fromLatin1("categoryBox"));
|
||||
if (!categoryBox){
|
||||
Base::Console().Warning("Toolbar walkthrough: Unable to find categoryBox\n");
|
||||
} else {
|
||||
@@ -637,7 +637,7 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
}
|
||||
|
||||
/** expand custom toolbar items **/
|
||||
QTreeWidget* toolbarTreeWidget = setupToolbarPage->findChild<QTreeWidget*>(QString::fromLatin1("toolbarTreeWidget"));
|
||||
auto toolbarTreeWidget = setupToolbarPage->findChild<QTreeWidget*>(QString::fromLatin1("toolbarTreeWidget"));
|
||||
if (!toolbarTreeWidget) {
|
||||
Base::Console().Warning("Toolbar walkthrough: Unable to find toolbarTreeWidget\n");
|
||||
} else {
|
||||
@@ -646,7 +646,7 @@ Note: your changes will be applied when you next switch workbenches\n"));
|
||||
|
||||
/** preselect macro command for user **/
|
||||
|
||||
QTreeWidget* commandTreeWidget = setupToolbarPage->findChild<QTreeWidget*>(QString::fromLatin1("commandTreeWidget"));
|
||||
auto commandTreeWidget = setupToolbarPage->findChild<QTreeWidget*>(QString::fromLatin1("commandTreeWidget"));
|
||||
if (!commandTreeWidget) {
|
||||
Base::Console().Warning("Toolbar walkthrough: Unable to find commandTreeWidget\n");
|
||||
} else {
|
||||
|
||||
@@ -81,10 +81,10 @@ void DlgMaterialPropertiesImp::on_ambientColor_changed()
|
||||
float b = (float)col.blue()/255.0f;
|
||||
App::Color ambient(r,g,b);
|
||||
|
||||
for (std::vector<ViewProvider*>::iterator it= Objects.begin();it!=Objects.end();++it) {
|
||||
for (std::vector<ViewProvider*>::iterator it= Objects.begin(); it != Objects.end(); ++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName(material.c_str());
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyMaterial::getClassTypeId())) {
|
||||
App::PropertyMaterial* ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
auto ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
App::Material mat = ShapeMaterial->getValue();
|
||||
mat.ambientColor = ambient;
|
||||
ShapeMaterial->setValue(mat);
|
||||
@@ -106,7 +106,7 @@ void DlgMaterialPropertiesImp::on_diffuseColor_changed()
|
||||
for (std::vector<ViewProvider*>::iterator it= Objects.begin();it!=Objects.end();++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName(material.c_str());
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyMaterial::getClassTypeId())) {
|
||||
App::PropertyMaterial* ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
auto ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
App::Material mat = ShapeMaterial->getValue();
|
||||
mat.diffuseColor = diffuse;
|
||||
ShapeMaterial->setValue(mat);
|
||||
@@ -128,7 +128,7 @@ void DlgMaterialPropertiesImp::on_emissiveColor_changed()
|
||||
for (std::vector<ViewProvider*>::iterator it= Objects.begin();it!=Objects.end();++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName(material.c_str());
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyMaterial::getClassTypeId())) {
|
||||
App::PropertyMaterial* ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
auto ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
App::Material mat = ShapeMaterial->getValue();
|
||||
mat.emissiveColor = emissive;
|
||||
ShapeMaterial->setValue(mat);
|
||||
@@ -150,7 +150,7 @@ void DlgMaterialPropertiesImp::on_specularColor_changed()
|
||||
for (std::vector<ViewProvider*>::iterator it= Objects.begin();it!=Objects.end();++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName(material.c_str());
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyMaterial::getClassTypeId())) {
|
||||
App::PropertyMaterial* ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
auto ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
App::Material mat = ShapeMaterial->getValue();
|
||||
mat.specularColor = specular;
|
||||
ShapeMaterial->setValue(mat);
|
||||
@@ -167,7 +167,7 @@ void DlgMaterialPropertiesImp::on_shininess_valueChanged(int sh)
|
||||
for (std::vector<ViewProvider*>::iterator it= Objects.begin();it!=Objects.end();++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName(material.c_str());
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyMaterial::getClassTypeId())) {
|
||||
App::PropertyMaterial* ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
auto ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
App::Material mat = ShapeMaterial->getValue();
|
||||
mat.shininess = shininess;
|
||||
ShapeMaterial->setValue(mat);
|
||||
@@ -185,7 +185,7 @@ void DlgMaterialPropertiesImp::setViewProviders(const std::vector<Gui::ViewProvi
|
||||
for (std::vector<ViewProvider*>::iterator it= Objects.begin();it!=Objects.end();++it) {
|
||||
App::Property* prop = (*it)->getPropertyByName(material.c_str());
|
||||
if (prop && prop->getTypeId().isDerivedFrom(App::PropertyMaterial::getClassTypeId())) {
|
||||
App::PropertyMaterial* ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
auto ShapeMaterial = (App::PropertyMaterial*)prop;
|
||||
App::Material mat = ShapeMaterial->getValue();
|
||||
int r = int(mat.ambientColor.r * 255.0f);
|
||||
int g = int(mat.ambientColor.g * 255.0f);
|
||||
|
||||
@@ -120,7 +120,7 @@ bool DlgParameterFind::matches(QTreeWidgetItem* item, const Options& opt) const
|
||||
}
|
||||
|
||||
if (opt.name || opt.value) {
|
||||
ParameterGroupItem* group = static_cast<ParameterGroupItem*>(item);
|
||||
auto group = static_cast<ParameterGroupItem*>(item);
|
||||
Base::Reference<ParameterGrp> hGrp = group->_hcGrp;
|
||||
|
||||
auto boolMap = hGrp->GetBoolMap();
|
||||
@@ -235,7 +235,7 @@ QTreeWidgetItem* DlgParameterFind::findItem(QTreeWidgetItem* root, const Options
|
||||
|
||||
void DlgParameterFind::accept()
|
||||
{
|
||||
ParameterGroup* groupTree = dialog->findChild<ParameterGroup*>();
|
||||
auto groupTree = dialog->findChild<ParameterGroup*>();
|
||||
if (groupTree) {
|
||||
Options opt;
|
||||
opt.text = ui->lineEdit->text();
|
||||
|
||||
+37
-37
@@ -93,9 +93,9 @@ DlgParameterImp::DlgParameterImp( QWidget* parent, Qt::WindowFlags fl )
|
||||
|
||||
ParameterManager* sys = App::GetApplication().GetParameterSet("System parameter");
|
||||
const std::map<std::string,ParameterManager *>& rcList = App::GetApplication().GetParameterSetList();
|
||||
for (std::map<std::string,ParameterManager *>::const_iterator it= rcList.begin();it!=rcList.end();++it) {
|
||||
if (it->second != sys) // for now ignore system parameters because they are nowhere used
|
||||
ui->parameterSet->addItem(tr(it->first.c_str()), QVariant(QByteArray(it->first.c_str())));
|
||||
for (const auto & it : rcList) {
|
||||
if (it.second != sys) // for now ignore system parameters because they are nowhere used
|
||||
ui->parameterSet->addItem(tr(it.first.c_str()), QVariant(QByteArray(it.first.c_str())));
|
||||
}
|
||||
|
||||
QByteArray cStr("User parameter");
|
||||
@@ -307,38 +307,38 @@ void DlgParameterImp::onGroupSelected( QTreeWidgetItem * item )
|
||||
|
||||
// filling up Text nodes
|
||||
std::vector<std::pair<std::string,std::string> > mcTextMap = _hcGrp->GetASCIIMap();
|
||||
for(std::vector<std::pair<std::string,std::string> >::iterator It2=mcTextMap.begin();It2!=mcTextMap.end();++It2)
|
||||
for(const auto & It2 : mcTextMap)
|
||||
{
|
||||
(void)new ParameterText(paramValue,QString::fromUtf8(It2->first.c_str()),
|
||||
It2->second.c_str(), _hcGrp);
|
||||
(void)new ParameterText(paramValue,QString::fromUtf8(It2.first.c_str()),
|
||||
It2.second.c_str(), _hcGrp);
|
||||
}
|
||||
|
||||
// filling up Int nodes
|
||||
std::vector<std::pair<std::string,long> > mcIntMap = _hcGrp->GetIntMap();
|
||||
for(std::vector<std::pair<std::string,long> >::iterator It3=mcIntMap.begin();It3!=mcIntMap.end();++It3)
|
||||
for(const auto & It3 : mcIntMap)
|
||||
{
|
||||
(void)new ParameterInt(paramValue,QString::fromUtf8(It3->first.c_str()),It3->second, _hcGrp);
|
||||
(void)new ParameterInt(paramValue,QString::fromUtf8(It3.first.c_str()),It3.second, _hcGrp);
|
||||
}
|
||||
|
||||
// filling up Float nodes
|
||||
std::vector<std::pair<std::string,double> > mcFloatMap = _hcGrp->GetFloatMap();
|
||||
for(std::vector<std::pair<std::string,double> >::iterator It4=mcFloatMap.begin();It4!=mcFloatMap.end();++It4)
|
||||
for(const auto & It4 : mcFloatMap)
|
||||
{
|
||||
(void)new ParameterFloat(paramValue,QString::fromUtf8(It4->first.c_str()),It4->second, _hcGrp);
|
||||
(void)new ParameterFloat(paramValue,QString::fromUtf8(It4.first.c_str()),It4.second, _hcGrp);
|
||||
}
|
||||
|
||||
// filling up bool nodes
|
||||
std::vector<std::pair<std::string,bool> > mcBoolMap = _hcGrp->GetBoolMap();
|
||||
for(std::vector<std::pair<std::string,bool> >::iterator It5=mcBoolMap.begin();It5!=mcBoolMap.end();++It5)
|
||||
for(const auto & It5 : mcBoolMap)
|
||||
{
|
||||
(void)new ParameterBool(paramValue,QString::fromUtf8(It5->first.c_str()),It5->second, _hcGrp);
|
||||
(void)new ParameterBool(paramValue,QString::fromUtf8(It5.first.c_str()),It5.second, _hcGrp);
|
||||
}
|
||||
|
||||
// filling up UInt nodes
|
||||
std::vector<std::pair<std::string,unsigned long> > mcUIntMap = _hcGrp->GetUnsignedMap();
|
||||
for(std::vector<std::pair<std::string,unsigned long> >::iterator It6=mcUIntMap.begin();It6!=mcUIntMap.end();++It6)
|
||||
for(const auto & It6 : mcUIntMap)
|
||||
{
|
||||
(void)new ParameterUInt(paramValue,QString::fromUtf8(It6->first.c_str()),It6->second, _hcGrp);
|
||||
(void)new ParameterUInt(paramValue,QString::fromUtf8(It6.first.c_str()),It6.second, _hcGrp);
|
||||
}
|
||||
paramValue->setSortingEnabled(sortingEnabled);
|
||||
}
|
||||
@@ -370,8 +370,8 @@ void DlgParameterImp::onChangeParameterSet(int itemPos)
|
||||
|
||||
// root labels
|
||||
std::vector<Base::Reference<ParameterGrp> > grps = rcParMngr->GetGroups();
|
||||
for ( std::vector<Base::Reference<ParameterGrp> >::iterator it = grps.begin(); it != grps.end(); ++it ) {
|
||||
QTreeWidgetItem* item = new ParameterGroupItem(paramGroup, *it);
|
||||
for (const auto & grp : grps) {
|
||||
auto item = new ParameterGroupItem(paramGroup, grp);
|
||||
paramGroup->expandItem(item);
|
||||
item->setIcon(0, QApplication::style()->standardPixmap(QStyle::SP_ComputerIcon));
|
||||
}
|
||||
@@ -516,7 +516,7 @@ void ParameterGroup::onDeleteSelectedItem()
|
||||
// hold a reference to the parameter group
|
||||
delete sel;
|
||||
|
||||
ParameterGroupItem* para = static_cast<ParameterGroupItem*>(parent);
|
||||
auto para = static_cast<ParameterGroupItem*>(parent);
|
||||
para->_hcGrp->RemoveGrp(groupName.c_str());
|
||||
}
|
||||
}
|
||||
@@ -545,7 +545,7 @@ void ParameterGroup::onCreateSubgroup()
|
||||
QTreeWidgetItem* item = currentItem();
|
||||
if (item && item->isSelected())
|
||||
{
|
||||
ParameterGroupItem* para = static_cast<ParameterGroupItem*>(item);
|
||||
auto para = static_cast<ParameterGroupItem*>(item);
|
||||
Base::Reference<ParameterGrp> hGrp = para->_hcGrp;
|
||||
|
||||
if ( hGrp->HasGroup( name.toLatin1() ) )
|
||||
@@ -571,7 +571,7 @@ void ParameterGroup::onExportToFile()
|
||||
QTreeWidgetItem* item = currentItem();
|
||||
if (item && item->isSelected())
|
||||
{
|
||||
ParameterGroupItem* para = static_cast<ParameterGroupItem*>(item);
|
||||
auto para = static_cast<ParameterGroupItem*>(item);
|
||||
Base::Reference<ParameterGrp> hGrp = para->_hcGrp;
|
||||
hGrp->exportTo( file.toUtf8() );
|
||||
}
|
||||
@@ -587,23 +587,23 @@ void ParameterGroup::onImportFromFile()
|
||||
QTreeWidgetItem* item = currentItem();
|
||||
if (item && item->isSelected())
|
||||
{
|
||||
ParameterGroupItem* para = static_cast<ParameterGroupItem*>(item);
|
||||
auto para = static_cast<ParameterGroupItem*>(item);
|
||||
Base::Reference<ParameterGrp> hGrp = para->_hcGrp;
|
||||
|
||||
// remove the items and internal parameter values
|
||||
QList<QTreeWidgetItem*> childs = para->takeChildren();
|
||||
for (QList<QTreeWidgetItem*>::iterator it = childs.begin(); it != childs.end(); ++it)
|
||||
for (auto & child : childs)
|
||||
{
|
||||
delete *it;
|
||||
delete child;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
hGrp->importFrom( file.toUtf8() );
|
||||
std::vector<Base::Reference<ParameterGrp> > cSubGrps = hGrp->GetGroups();
|
||||
for ( std::vector<Base::Reference<ParameterGrp> >::iterator it = cSubGrps.begin(); it != cSubGrps.end(); ++it )
|
||||
for (const auto & cSubGrp : cSubGrps)
|
||||
{
|
||||
new ParameterGroupItem(para,*it);
|
||||
new ParameterGroupItem(para,cSubGrp);
|
||||
}
|
||||
|
||||
para->setExpanded(para->childCount());
|
||||
@@ -768,8 +768,8 @@ void ParameterValue::onCreateTextItem()
|
||||
return;
|
||||
|
||||
std::vector<std::pair<std::string,std::string> > smap = _hcGrp->GetASCIIMap();
|
||||
for (std::vector<std::pair<std::string,std::string> >::iterator it = smap.begin(); it != smap.end(); ++it) {
|
||||
if (name == QLatin1String(it->first.c_str()))
|
||||
for (const auto & it : smap) {
|
||||
if (name == QLatin1String(it.first.c_str()))
|
||||
{
|
||||
QMessageBox::critical( this, tr("Existing item"),
|
||||
tr("The item '%1' already exists.").arg( name ) );
|
||||
@@ -797,8 +797,8 @@ void ParameterValue::onCreateIntItem()
|
||||
return;
|
||||
|
||||
std::vector<std::pair<std::string,long> > lmap = _hcGrp->GetIntMap();
|
||||
for (std::vector<std::pair<std::string,long> >::iterator it = lmap.begin(); it != lmap.end(); ++it) {
|
||||
if (name == QLatin1String(it->first.c_str()))
|
||||
for (const auto & it : lmap) {
|
||||
if (name == QLatin1String(it.first.c_str()))
|
||||
{
|
||||
QMessageBox::critical( this, tr("Existing item"),
|
||||
tr("The item '%1' already exists.").arg( name ) );
|
||||
@@ -827,8 +827,8 @@ void ParameterValue::onCreateUIntItem()
|
||||
return;
|
||||
|
||||
std::vector<std::pair<std::string,unsigned long> > lmap = _hcGrp->GetUnsignedMap();
|
||||
for (std::vector<std::pair<std::string,unsigned long> >::iterator it = lmap.begin(); it != lmap.end(); ++it) {
|
||||
if (name == QLatin1String(it->first.c_str()))
|
||||
for (const auto & it : lmap) {
|
||||
if (name == QLatin1String(it.first.c_str()))
|
||||
{
|
||||
QMessageBox::critical( this, tr("Existing item"),
|
||||
tr("The item '%1' already exists.").arg( name ) );
|
||||
@@ -863,8 +863,8 @@ void ParameterValue::onCreateFloatItem()
|
||||
return;
|
||||
|
||||
std::vector<std::pair<std::string,double> > fmap = _hcGrp->GetFloatMap();
|
||||
for (std::vector<std::pair<std::string,double> >::iterator it = fmap.begin(); it != fmap.end(); ++it) {
|
||||
if (name == QLatin1String(it->first.c_str()))
|
||||
for (const auto & it : fmap) {
|
||||
if (name == QLatin1String(it.first.c_str()))
|
||||
{
|
||||
QMessageBox::critical( this, tr("Existing item"),
|
||||
tr("The item '%1' already exists.").arg( name ) );
|
||||
@@ -892,8 +892,8 @@ void ParameterValue::onCreateBoolItem()
|
||||
return;
|
||||
|
||||
std::vector<std::pair<std::string,bool> > bmap = _hcGrp->GetBoolMap();
|
||||
for (std::vector<std::pair<std::string,bool> >::iterator it = bmap.begin(); it != bmap.end(); ++it) {
|
||||
if (name == QLatin1String(it->first.c_str()))
|
||||
for (const auto & it : bmap) {
|
||||
if (name == QLatin1String(it.first.c_str()))
|
||||
{
|
||||
QMessageBox::critical( this, tr("Existing item"),
|
||||
tr("The item '%1' already exists.").arg( name ) );
|
||||
@@ -943,8 +943,8 @@ void ParameterGroupItem::fillUp()
|
||||
std::vector<Base::Reference<ParameterGrp> > vhcParamGrp = _hcGrp->GetGroups();
|
||||
|
||||
setText(0,QString::fromUtf8(_hcGrp->GetGroupName()));
|
||||
for(std::vector<Base::Reference<ParameterGrp> >::iterator It=vhcParamGrp.begin();It!=vhcParamGrp.end();++It)
|
||||
(void)new ParameterGroupItem(this,*It);
|
||||
for(const auto & It : vhcParamGrp)
|
||||
(void)new ParameterGroupItem(this,It);
|
||||
}
|
||||
|
||||
void ParameterGroupItem::setData ( int column, int role, const QVariant & value )
|
||||
@@ -959,7 +959,7 @@ void ParameterGroupItem::setData ( int column, int role, const QVariant & value
|
||||
return;
|
||||
|
||||
// first check if there is already a group with name "newName"
|
||||
ParameterGroupItem* item = static_cast<ParameterGroupItem*>(parent());
|
||||
auto item = static_cast<ParameterGroupItem*>(parent());
|
||||
if ( !item )
|
||||
{
|
||||
QMessageBox::critical( treeWidget(), QObject::tr("Rename group"),
|
||||
|
||||
@@ -137,11 +137,11 @@ QTabWidget* DlgPreferencesImp::createTabForGroup(const std::string &groupName)
|
||||
QString tooltip;
|
||||
getGroupData(groupName, fileName, tooltip);
|
||||
|
||||
QTabWidget* tabWidget = new QTabWidget;
|
||||
auto tabWidget = new QTabWidget;
|
||||
ui->tabWidgetStack->addWidget(tabWidget);
|
||||
tabWidget->setProperty("GroupName", QVariant(groupNameQString));
|
||||
|
||||
QListWidgetItem* item = new QListWidgetItem(ui->listBox);
|
||||
auto item = new QListWidgetItem(ui->listBox);
|
||||
item->setData(GroupNameRole, QVariant(groupNameQString));
|
||||
item->setText(QObject::tr(groupNameQString.toLatin1()));
|
||||
item->setToolTip(tooltip);
|
||||
@@ -205,7 +205,7 @@ void DlgPreferencesImp::changeGroup(QListWidgetItem *current, QListWidgetItem *p
|
||||
void DlgPreferencesImp::addPage(const std::string& className, const std::string& group)
|
||||
{
|
||||
std::list<TGroupPages>::iterator groupToAddTo = _pages.end();
|
||||
for (std::list<TGroupPages>::iterator it = _pages.begin(); it != _pages.end(); ++it) {
|
||||
for (auto it = _pages.begin(); it != _pages.end(); ++it) {
|
||||
if (it->first == group) {
|
||||
groupToAddTo = it;
|
||||
break;
|
||||
@@ -239,7 +239,7 @@ void DlgPreferencesImp::removePage(const std::string& className, const std::stri
|
||||
}
|
||||
else {
|
||||
std::list<std::string>& p = it->second;
|
||||
for (std::list<std::string>::iterator jt = p.begin(); jt != p.end(); ++jt) {
|
||||
for (auto jt = p.begin(); jt != p.end(); ++jt) {
|
||||
if (*jt == className) {
|
||||
p.erase(jt);
|
||||
if (p.empty())
|
||||
@@ -292,7 +292,7 @@ void DlgPreferencesImp::activateGroupPage(const QString& group, int index)
|
||||
QListWidgetItem* item = ui->listBox->item(i);
|
||||
if (item->data(GroupNameRole).toString() == group) {
|
||||
ui->listBox->setCurrentItem(item);
|
||||
QTabWidget* tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
|
||||
auto tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
|
||||
tabWidget->setCurrentIndex(index);
|
||||
break;
|
||||
}
|
||||
@@ -376,7 +376,7 @@ void DlgPreferencesImp::reloadPages()
|
||||
QString pageName = QString::fromStdString(page);
|
||||
bool pageExists = false;
|
||||
for (int pageNumber = 0; pageNumber < tabWidget->count(); ++pageNumber) {
|
||||
PreferencePage* prefPage = qobject_cast<PreferencePage*>(tabWidget->widget(pageNumber));
|
||||
auto prefPage = qobject_cast<PreferencePage*>(tabWidget->widget(pageNumber));
|
||||
if (prefPage && prefPage->property("PageName").toString() == pageName) {
|
||||
pageExists = true;
|
||||
break;
|
||||
@@ -400,7 +400,7 @@ void DlgPreferencesImp::applyChanges()
|
||||
// cancel further operation in other methods (like in accept()).
|
||||
try {
|
||||
for (int i=0; i<ui->tabWidgetStack->count(); i++) {
|
||||
QTabWidget* tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
|
||||
auto tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
|
||||
for (int j=0; j<tabWidget->count(); j++) {
|
||||
QWidget* page = tabWidget->widget(j);
|
||||
int index = page->metaObject()->indexOfMethod("checkSettings()");
|
||||
@@ -425,9 +425,9 @@ void DlgPreferencesImp::applyChanges()
|
||||
// If everything is ok (i.e., no validation problem), call method
|
||||
// saveSettings() in every subpage (DlgSetting*) object.
|
||||
for (int i=0; i<ui->tabWidgetStack->count(); i++) {
|
||||
QTabWidget* tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
|
||||
auto tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
|
||||
for (int j=0; j<tabWidget->count(); j++) {
|
||||
PreferencePage* page = qobject_cast<PreferencePage*>(tabWidget->widget(j));
|
||||
auto page = qobject_cast<PreferencePage*>(tabWidget->widget(j));
|
||||
if (page)
|
||||
page->saveSettings();
|
||||
}
|
||||
@@ -458,7 +458,7 @@ void DlgPreferencesImp::resizeEvent(QResizeEvent* ev)
|
||||
if (height() > maxHeight || width() > maxWidth) {
|
||||
canEmbedScrollArea = false;
|
||||
ui->hboxLayout->removeWidget(ui->tabWidgetStack);
|
||||
QScrollArea* scrollArea = new QScrollArea(this);
|
||||
auto scrollArea = new QScrollArea(this);
|
||||
scrollArea->setFrameShape(QFrame::NoFrame);
|
||||
scrollArea->setWidgetResizable(true);
|
||||
scrollArea->setWidget(ui->tabWidgetStack);
|
||||
@@ -466,7 +466,7 @@ void DlgPreferencesImp::resizeEvent(QResizeEvent* ev)
|
||||
|
||||
// if possible the minimum width should so that it doesn't show
|
||||
// a horizontal scroll bar.
|
||||
QScrollBar* bar = scrollArea->verticalScrollBar();
|
||||
auto bar = scrollArea->verticalScrollBar();
|
||||
if (bar) {
|
||||
int newWidth = width() + bar->width();
|
||||
newWidth = std::min<int>(newWidth, maxWidth);
|
||||
@@ -495,7 +495,7 @@ void DlgPreferencesImp::changeEvent(QEvent *e)
|
||||
ui->retranslateUi(this);
|
||||
// update the widgets' tabs
|
||||
for (int i=0; i<ui->tabWidgetStack->count(); i++) {
|
||||
QTabWidget* tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
|
||||
auto tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
|
||||
for (int j=0; j<tabWidget->count(); j++) {
|
||||
QWidget* page = tabWidget->widget(j);
|
||||
tabWidget->setTabText(j, page->windowTitle());
|
||||
@@ -515,9 +515,9 @@ void DlgPreferencesImp::changeEvent(QEvent *e)
|
||||
void DlgPreferencesImp::reload()
|
||||
{
|
||||
for (int i = 0; i < ui->tabWidgetStack->count(); i++) {
|
||||
QTabWidget* tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
|
||||
auto tabWidget = (QTabWidget*)ui->tabWidgetStack->widget(i);
|
||||
for (int j = 0; j < tabWidget->count(); j++) {
|
||||
PreferencePage* page = qobject_cast<PreferencePage*>(tabWidget->widget(j));
|
||||
auto page = qobject_cast<PreferencePage*>(tabWidget->widget(j));
|
||||
if (page)
|
||||
page->loadSettings();
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ DlgSettingsColorGradientImp::~DlgSettingsColorGradientImp()
|
||||
|
||||
void DlgSettingsColorGradientImp::setupConnections()
|
||||
{
|
||||
QButtonGroup* group = new QButtonGroup(this);
|
||||
auto group = new QButtonGroup(this);
|
||||
group->setExclusive(true);
|
||||
group->addButton(ui->radioButtonFlow);
|
||||
group->addButton(ui->radioButtonZero);
|
||||
|
||||
@@ -150,12 +150,12 @@ void DlgSettingsLazyLoadedImp::buildUnloadedWorkbenchList()
|
||||
// Column 3: Autoloaded checkbox
|
||||
//
|
||||
// To get the checkbox centered, we have to jump through some hoops...
|
||||
QWidget* checkWidget = new QWidget(this);
|
||||
auto checkWidget = new QWidget(this);
|
||||
auto autoloadCheckbox = new QCheckBox(this);
|
||||
autoloadCheckbox->setToolTip(tr("If checked") +
|
||||
QString::fromUtf8(", ") + wbDisplayName + QString::fromUtf8(" ") +
|
||||
tr("will be loaded automatically when FreeCAD starts up"));
|
||||
QHBoxLayout* checkLayout = new QHBoxLayout(checkWidget);
|
||||
auto checkLayout = new QHBoxLayout(checkWidget);
|
||||
checkLayout->addWidget(autoloadCheckbox);
|
||||
checkLayout->setAlignment(Qt::AlignCenter);
|
||||
checkLayout->setContentsMargins(0, 0, 0, 0);
|
||||
|
||||
@@ -65,7 +65,7 @@ DlgSettingsMacroImp::~DlgSettingsMacroImp()
|
||||
*/
|
||||
void DlgSettingsMacroImp::setRecentMacroSize()
|
||||
{
|
||||
RecentMacrosAction *recent = getMainWindow()->findChild<RecentMacrosAction *>(QLatin1String("recentMacros"));
|
||||
auto recent = getMainWindow()->findChild<RecentMacrosAction *>(QLatin1String("recentMacros"));
|
||||
if (recent) {
|
||||
ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("RecentMacros");
|
||||
recent->resizeList(hGrp->GetInt("RecentMacros", 4));
|
||||
|
||||
@@ -211,9 +211,9 @@ void DlgSettingsNavigation::retranslate()
|
||||
|
||||
// add submenu at the end to select navigation style
|
||||
std::map<Base::Type, std::string> styles = UserNavigationStyle::getUserFriendlyNames();
|
||||
for (std::map<Base::Type, std::string>::iterator it = styles.begin(); it != styles.end(); ++it) {
|
||||
QByteArray data(it->first.getName());
|
||||
QString name = QApplication::translate(it->first.getName(), it->second.c_str());
|
||||
for (const auto & style : styles) {
|
||||
QByteArray data(style.first.getName());
|
||||
QString name = QApplication::translate(style.first.getName(), style.second.c_str());
|
||||
|
||||
ui->comboNavigationStyle->addItem(name, data);
|
||||
}
|
||||
@@ -256,7 +256,7 @@ CameraDialog::CameraDialog(QWidget* parent)
|
||||
layout = new QGridLayout(groupBox);
|
||||
|
||||
// Q0
|
||||
QLabel* label0 = new QLabel(groupBox);
|
||||
auto label0 = new QLabel(groupBox);
|
||||
label0->setText(tr("Q0"));
|
||||
layout->addWidget(label0, 0, 0, 1, 1);
|
||||
|
||||
@@ -266,7 +266,7 @@ CameraDialog::CameraDialog(QWidget* parent)
|
||||
layout->addWidget(sb0, 0, 1, 1, 1);
|
||||
|
||||
// Q1
|
||||
QLabel* label1 = new QLabel(groupBox);
|
||||
auto label1 = new QLabel(groupBox);
|
||||
label1->setText(tr("Q1"));
|
||||
layout->addWidget(label1, 1, 0, 1, 1);
|
||||
|
||||
@@ -276,7 +276,7 @@ CameraDialog::CameraDialog(QWidget* parent)
|
||||
layout->addWidget(sb1, 1, 1, 1, 1);
|
||||
|
||||
// Q2
|
||||
QLabel* label2 = new QLabel(groupBox);
|
||||
auto label2 = new QLabel(groupBox);
|
||||
label2->setText(tr("Q2"));
|
||||
layout->addWidget(label2, 2, 0, 1, 1);
|
||||
|
||||
@@ -286,7 +286,7 @@ CameraDialog::CameraDialog(QWidget* parent)
|
||||
layout->addWidget(sb2, 2, 1, 1, 1);
|
||||
|
||||
// Q3
|
||||
QLabel* label3 = new QLabel(groupBox);
|
||||
auto label3 = new QLabel(groupBox);
|
||||
label3->setText(tr("Q3"));
|
||||
layout->addWidget(label3, 3, 0, 1, 1);
|
||||
|
||||
@@ -295,8 +295,7 @@ CameraDialog::CameraDialog(QWidget* parent)
|
||||
sb3->setSingleStep(0.1);
|
||||
layout->addWidget(sb3, 3, 1, 1, 1);
|
||||
|
||||
QPushButton *currentViewButton;
|
||||
currentViewButton = new QPushButton(this);
|
||||
auto currentViewButton = new QPushButton(this);
|
||||
currentViewButton->setText(tr("Current view"));
|
||||
currentViewButton->setObjectName(QString::fromLatin1("currentView"));
|
||||
layout->addWidget(currentViewButton, 4, 1, 2, 1);
|
||||
@@ -328,7 +327,7 @@ void CameraDialog::getValues(double& q0, double& q1, double& q2, double& q3) con
|
||||
|
||||
void CameraDialog::on_currentView_clicked()
|
||||
{
|
||||
View3DInventor* mdi = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
auto mdi = qobject_cast<View3DInventor*>(getMainWindow()->activeWindow());
|
||||
if (mdi) {
|
||||
SbRotation rot = mdi->getViewer()->getCameraOrientation();
|
||||
const float* q = rot.getValue();
|
||||
|
||||
+58
-58
@@ -91,9 +91,9 @@ DlgCustomToolbars::DlgCustomToolbars(DlgCustomToolbars::Type t, QWidget* parent)
|
||||
groupMap.push_back(std::make_pair(QLatin1String("Help"), QString()));
|
||||
groupMap.push_back(std::make_pair(QLatin1String("Macros"), qApp->translate("Gui::MacroCommand", "Macros")));
|
||||
|
||||
for (std::map<std::string,Command*>::iterator it = sCommands.begin(); it != sCommands.end(); ++it) {
|
||||
QLatin1String group(it->second->getGroupName());
|
||||
QString text = it->second->translatedGroupName();
|
||||
for (const auto & sCommand : sCommands) {
|
||||
QLatin1String group(sCommand.second->getGroupName());
|
||||
QString text = sCommand.second->translatedGroupName();
|
||||
GroupMap::iterator jt;
|
||||
jt = std::find_if(groupMap.begin(), groupMap.end(), GroupMap_find(group));
|
||||
if (jt != groupMap.end()) {
|
||||
@@ -106,7 +106,7 @@ DlgCustomToolbars::DlgCustomToolbars(DlgCustomToolbars::Type t, QWidget* parent)
|
||||
}
|
||||
|
||||
int index = 0;
|
||||
for (GroupMap::iterator it = groupMap.begin(); it != groupMap.end(); ++it, ++index) {
|
||||
for (auto it = groupMap.begin(); it != groupMap.end(); ++it, ++index) {
|
||||
ui->categoryBox->addItem(it->second);
|
||||
ui->categoryBox->setItemData(index, QVariant(it->first), Qt::UserRole);
|
||||
}
|
||||
@@ -117,15 +117,15 @@ DlgCustomToolbars::DlgCustomToolbars(DlgCustomToolbars::Type t, QWidget* parent)
|
||||
index = 1;
|
||||
ui->workbenchBox->addItem(QApplication::windowIcon(), tr("Global"));
|
||||
ui->workbenchBox->setItemData(0, QVariant(QString::fromLatin1("Global")), Qt::UserRole);
|
||||
for (QStringList::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) {
|
||||
QPixmap px = Application::Instance->workbenchIcon(*it);
|
||||
QString mt = Application::Instance->workbenchMenuText(*it);
|
||||
for (const auto & workbench : workbenches) {
|
||||
QPixmap px = Application::Instance->workbenchIcon(workbench);
|
||||
QString mt = Application::Instance->workbenchMenuText(workbench);
|
||||
if (mt != QLatin1String("<none>")) {
|
||||
if (px.isNull())
|
||||
ui->workbenchBox->addItem(mt);
|
||||
else
|
||||
ui->workbenchBox->addItem(px, mt);
|
||||
ui->workbenchBox->setItemData(index, QVariant(*it), Qt::UserRole);
|
||||
ui->workbenchBox->setItemData(index, QVariant(workbench), Qt::UserRole);
|
||||
index++;
|
||||
}
|
||||
}
|
||||
@@ -203,31 +203,31 @@ void DlgCustomToolbars::on_categoryBox_activated(int index)
|
||||
std::vector<Command*> aCmds = cCmdMgr.getGroupCommands(group.toLatin1());
|
||||
|
||||
// Create a separator item
|
||||
QTreeWidgetItem* sepitem = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
auto sepitem = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
sepitem->setText(1, tr("<Separator>"));
|
||||
sepitem->setData(1, Qt::UserRole, QByteArray("Separator"));
|
||||
sepitem->setSizeHint(0, QSize(32, 32));
|
||||
|
||||
if (group == QLatin1String("Macros")) {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8((*it)->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8((*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
for (const auto & aCmd : aCmds) {
|
||||
auto item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8(aCmd->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8(aCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray(aCmd->getName()));
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
if ((*it)->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme((*it)->getPixmap()));
|
||||
if (aCmd->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme(aCmd->getPixmap()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (std::vector<Command*>::iterator it = aCmds.begin(); it != aCmds.end(); ++it) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, qApp->translate((*it)->className(), (*it)->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate((*it)->className(), (*it)->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray((*it)->getName()));
|
||||
for (const auto & aCmd : aCmds) {
|
||||
auto item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, qApp->translate(aCmd->className(), aCmd->getMenuText()));
|
||||
item->setToolTip(1, qApp->translate(aCmd->className(), aCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, QByteArray(aCmd->getName()));
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
if ((*it)->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme((*it)->getPixmap()));
|
||||
if (aCmd->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme(aCmd->getPixmap()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -256,45 +256,45 @@ void DlgCustomToolbars::importCustomToolbars(const QByteArray& name)
|
||||
|
||||
std::vector<Base::Reference<ParameterGrp> > hGrps = hGrp->GetGroups();
|
||||
CommandManager& rMgr = Application::Instance->commandManager();
|
||||
for (std::vector<Base::Reference<ParameterGrp> >::iterator it = hGrps.begin(); it != hGrps.end(); ++it) {
|
||||
for (const auto & hGrp : hGrps) {
|
||||
// create a toplevel item
|
||||
QTreeWidgetItem* toplevel = new QTreeWidgetItem(ui->toolbarTreeWidget);
|
||||
bool active = (*it)->GetBool("Active", true);
|
||||
auto toplevel = new QTreeWidgetItem(ui->toolbarTreeWidget);
|
||||
bool active = hGrp->GetBool("Active", true);
|
||||
toplevel->setCheckState(0, (active ? Qt::Checked : Qt::Unchecked));
|
||||
|
||||
// get the elements of the subgroups
|
||||
std::vector<std::pair<std::string,std::string> > items = (*it)->GetASCIIMap();
|
||||
for (std::vector<std::pair<std::string,std::string> >::iterator it2 = items.begin(); it2 != items.end(); ++it2) {
|
||||
std::vector<std::pair<std::string,std::string> > items = hGrp->GetASCIIMap();
|
||||
for (const auto & it2 : items) {
|
||||
// since we have stored the separators to the user parameters as (key, pair) we had to
|
||||
// make sure to use a unique key because otherwise we cannot store more than
|
||||
// one.
|
||||
if (it2->first.substr(0, separator.size()) == separator) {
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(toplevel);
|
||||
if (it2.first.substr(0, separator.size()) == separator) {
|
||||
auto item = new QTreeWidgetItem(toplevel);
|
||||
item->setText(0, tr("<Separator>"));
|
||||
item->setData(0, Qt::UserRole, QByteArray("Separator"));
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
}
|
||||
else if (it2->first == "Name") {
|
||||
QString toolbarName = QString::fromUtf8(it2->second.c_str());
|
||||
else if (it2.first == "Name") {
|
||||
QString toolbarName = QString::fromUtf8(it2.second.c_str());
|
||||
toplevel->setText(0, toolbarName);
|
||||
}
|
||||
else {
|
||||
Command* pCmd = rMgr.getCommandByName(it2->first.c_str());
|
||||
Command* pCmd = rMgr.getCommandByName(it2.first.c_str());
|
||||
if (pCmd) {
|
||||
// command name
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(toplevel);
|
||||
auto item = new QTreeWidgetItem(toplevel);
|
||||
item->setText(0, qApp->translate(pCmd->className(), pCmd->getMenuText()));
|
||||
item->setData(0, Qt::UserRole, QByteArray(it2->first.c_str()));
|
||||
item->setData(0, Qt::UserRole, QByteArray(it2.first.c_str()));
|
||||
if (pCmd->getPixmap())
|
||||
item->setIcon(0, BitmapFactory().iconFromTheme(pCmd->getPixmap()));
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
}
|
||||
else {
|
||||
// If corresponding module is not yet loaded do not lose the entry
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(toplevel);
|
||||
item->setText(0, tr("%1 module not loaded").arg(QString::fromStdString(it2->second)));
|
||||
item->setData(0, Qt::UserRole, QByteArray(it2->first.c_str()));
|
||||
item->setData(0, Qt::WhatsThisPropertyRole, QByteArray(it2->second.c_str()));
|
||||
auto item = new QTreeWidgetItem(toplevel);
|
||||
item->setText(0, tr("%1 module not loaded").arg(QString::fromStdString(it2.second)));
|
||||
item->setData(0, Qt::UserRole, QByteArray(it2.first.c_str()));
|
||||
item->setData(0, Qt::WhatsThisPropertyRole, QByteArray(it2.second.c_str()));
|
||||
item->setSizeHint(0, QSize(32, 32));
|
||||
}
|
||||
}
|
||||
@@ -355,7 +355,7 @@ void DlgCustomToolbars::on_moveActionRightButton_clicked()
|
||||
else if (current->parent())
|
||||
current = current->parent();
|
||||
if (current && !current->parent()) {
|
||||
QTreeWidgetItem* copy = new QTreeWidgetItem(current);
|
||||
auto copy = new QTreeWidgetItem(current);
|
||||
copy->setText(0, item->text(1));
|
||||
copy->setIcon(0, item->icon(0));
|
||||
QByteArray data = item->data(1, Qt::UserRole).toByteArray();
|
||||
@@ -496,7 +496,7 @@ void DlgCustomToolbars::on_newButton_clicked()
|
||||
}
|
||||
}
|
||||
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->toolbarTreeWidget);
|
||||
auto item = new QTreeWidgetItem(ui->toolbarTreeWidget);
|
||||
item->setText(0, text);
|
||||
item->setCheckState(0, Qt::Checked);
|
||||
item->setExpanded(true);
|
||||
@@ -565,7 +565,7 @@ void DlgCustomToolbars::onAddMacroAction(const QByteArray& macro)
|
||||
CommandManager & cCmdMgr = Application::Instance->commandManager();
|
||||
Command* pCmd = cCmdMgr.getCommandByName(macro);
|
||||
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
auto item = new QTreeWidgetItem(ui->commandTreeWidget);
|
||||
item->setText(1, QString::fromUtf8(pCmd->getMenuText()));
|
||||
item->setToolTip(1, QString::fromUtf8(pCmd->getToolTipText()));
|
||||
item->setData(1, Qt::UserRole, macro);
|
||||
@@ -716,8 +716,8 @@ QList<QAction*> DlgCustomToolbarsImp::getActionGroup(QAction* action)
|
||||
{
|
||||
QList<QAction*> group;
|
||||
QList<QWidget*> widgets = action->associatedWidgets();
|
||||
for (QList<QWidget*>::iterator it = widgets.begin(); it != widgets.end(); ++it) {
|
||||
QToolButton* tb = qobject_cast<QToolButton*>(*it);
|
||||
for (const auto & widget : widgets) {
|
||||
auto tb = qobject_cast<QToolButton*>(widget);
|
||||
if (tb) {
|
||||
QMenu* menu = tb->menu();
|
||||
if (menu) {
|
||||
@@ -733,14 +733,14 @@ void DlgCustomToolbarsImp::setActionGroup(QAction* action, const QList<QAction*>
|
||||
{
|
||||
// See also ActionGroup::addTo()
|
||||
QList<QWidget*> widgets = action->associatedWidgets();
|
||||
for (QList<QWidget*>::iterator it = widgets.begin(); it != widgets.end(); ++it) {
|
||||
QToolButton* tb = qobject_cast<QToolButton*>(*it);
|
||||
for (const auto & widget : widgets) {
|
||||
auto tb = qobject_cast<QToolButton*>(widget);
|
||||
if (tb) {
|
||||
QMenu* menu = tb->menu();
|
||||
if (!menu) {
|
||||
tb->setPopupMode(QToolButton::MenuButtonPopup);
|
||||
tb->setObjectName(QString::fromLatin1("qt_toolbutton_menubutton"));
|
||||
QMenu* menu = new QMenu(tb);
|
||||
auto menu = new QMenu(tb);
|
||||
menu->addActions(group);
|
||||
tb->setMenu(menu);
|
||||
}
|
||||
@@ -791,14 +791,14 @@ void DlgCustomToolbarsImp::removeCustomCommand(const QString& name, const QByteA
|
||||
cmd = "Separator";
|
||||
}
|
||||
QList<QAction*> actions = bars.front()->actions();
|
||||
for (QList<QAction*>::Iterator it = actions.begin(); it != actions.end(); ++it) {
|
||||
if ((*it)->data().toByteArray() == cmd) {
|
||||
for (const auto & action : actions) {
|
||||
if (action->data().toByteArray() == cmd) {
|
||||
// if we move a separator then make sure to pick up the right one
|
||||
if (numSep > 0) {
|
||||
if (++indexSep < numSep)
|
||||
continue;
|
||||
}
|
||||
bars.front()->removeAction(*it);
|
||||
bars.front()->removeAction(action);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -822,26 +822,26 @@ void DlgCustomToolbarsImp::moveUpCustomCommand(const QString& name, const QByteA
|
||||
}
|
||||
QList<QAction*> actions = bars.front()->actions();
|
||||
QAction* before=nullptr;
|
||||
for (QList<QAction*>::Iterator it = actions.begin(); it != actions.end(); ++it) {
|
||||
if ((*it)->data().toByteArray() == cmd) {
|
||||
for (const auto & action : actions) {
|
||||
if (action->data().toByteArray() == cmd) {
|
||||
// if we move a separator then make sure to pick up the right one
|
||||
if (numSep > 0) {
|
||||
if (++indexSep < numSep) {
|
||||
before = *it;
|
||||
before = action;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (before) {
|
||||
QList<QAction*> group = getActionGroup(*it);
|
||||
bars.front()->removeAction(*it);
|
||||
bars.front()->insertAction(before, *it);
|
||||
QList<QAction*> group = getActionGroup(action);
|
||||
bars.front()->removeAction(action);
|
||||
bars.front()->insertAction(before, action);
|
||||
if (!group.isEmpty())
|
||||
setActionGroup(*it, group);
|
||||
setActionGroup(action, group);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
before = *it;
|
||||
before = action;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ void UndoDialog::onFetchInfo()
|
||||
/** Closes the dialog and sends the message 'Undo' to the currently active MDI view. */
|
||||
void UndoDialog::onSelected()
|
||||
{
|
||||
QAction* a = static_cast<QAction*>(sender());
|
||||
auto a = static_cast<QAction*>(sender());
|
||||
QList<QAction*> acts = this->actions();
|
||||
for (QList<QAction*>::Iterator it = acts.begin(); it != acts.end(); ++it) {
|
||||
Gui::Application::Instance->sendMsgToActiveView("Undo");
|
||||
@@ -122,7 +122,7 @@ void RedoDialog::onFetchInfo()
|
||||
/** Closes the dialog and sends the message 'Redo' to the currently active MDI view. */
|
||||
void RedoDialog::onSelected()
|
||||
{
|
||||
QAction* a = static_cast<QAction*>(sender());
|
||||
auto a = static_cast<QAction*>(sender());
|
||||
QList<QAction*> acts = this->actions();
|
||||
for (QList<QAction*>::Iterator it = acts.begin(); it != acts.end(); ++it) {
|
||||
Gui::Application::Instance->sendMsgToActiveView("Redo");
|
||||
|
||||
@@ -99,7 +99,7 @@ void DlgWorkbenchesImp::add_workbench(QListWidgetCustom *lw, const QString& it)
|
||||
{
|
||||
QPixmap px = Application::Instance->workbenchIcon(it);
|
||||
QString mt = Application::Instance->workbenchMenuText(it);
|
||||
QListWidgetItem *wi = (new QListWidgetItem(QIcon(px), mt));
|
||||
auto wi = (new QListWidgetItem(QIcon(px), mt));
|
||||
wi->setData(Qt::UserRole, QVariant(it));
|
||||
lw->addItem(wi);
|
||||
}
|
||||
|
||||
@@ -131,7 +131,7 @@ QDockWidget* DockWindowManager::addDockWindow(const char* name, QWidget* widget,
|
||||
{
|
||||
// creates the dock widget as container to embed this widget
|
||||
MainWindow* mw = getMainWindow();
|
||||
QDockWidget* dw = new QDockWidget(mw);
|
||||
auto dw = new QDockWidget(mw);
|
||||
// Note: By default all dock widgets are hidden but the user can show them manually in the view menu.
|
||||
// First, hide immediately the dock widget to avoid flickering, after setting up the dock widgets
|
||||
// MainWindow::loadLayoutSettings() is called to restore the layout.
|
||||
|
||||
+61
-61
@@ -258,8 +258,8 @@ Document::~Document()
|
||||
d->_isClosing = true;
|
||||
// calls Document::detachView() and alter the view list
|
||||
std::list<Gui::BaseView*> temp = d->baseViews;
|
||||
for(std::list<Gui::BaseView*>::iterator it=temp.begin();it!=temp.end();++it)
|
||||
(*it)->deleteSelf();
|
||||
for(auto & it : temp)
|
||||
it->deleteSelf();
|
||||
|
||||
std::map<const App::DocumentObject*,ViewProviderDocumentObject*>::iterator jt;
|
||||
for (jt = d->_ViewProviderMap.begin();jt != d->_ViewProviderMap.end(); ++jt)
|
||||
@@ -281,7 +281,7 @@ Document::~Document()
|
||||
|
||||
bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname)
|
||||
{
|
||||
ViewProviderDocumentObject* vp = dynamic_cast<ViewProviderDocumentObject*>(p);
|
||||
auto vp = dynamic_cast<ViewProviderDocumentObject*>(p);
|
||||
if (!vp) {
|
||||
FC_ERR("cannot edit non ViewProviderDocumentObject");
|
||||
return false;
|
||||
@@ -391,7 +391,7 @@ bool Document::setEdit(Gui::ViewProvider* p, int ModNum, const char *subname)
|
||||
}
|
||||
}
|
||||
|
||||
View3DInventor *view3d = dynamic_cast<View3DInventor *>(getActiveView());
|
||||
auto view3d = dynamic_cast<View3DInventor *>(getActiveView());
|
||||
// if the currently active view is not the 3d view search for it and activate it
|
||||
if (view3d)
|
||||
getMainWindow()->setActiveWindow(view3d);
|
||||
@@ -452,7 +452,7 @@ const Base::Matrix4D &Document::getEditingTransform() const {
|
||||
void Document::setEditingTransform(const Base::Matrix4D &mat) {
|
||||
d->_editObjs.clear();
|
||||
d->_editingTransform = mat;
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(getActiveView());
|
||||
auto activeView = dynamic_cast<View3DInventor *>(getActiveView());
|
||||
if (activeView)
|
||||
activeView->getViewer()->setEditingTransform(mat);
|
||||
}
|
||||
@@ -466,7 +466,7 @@ void Document::_resetEdit()
|
||||
std::list<Gui::BaseView*>::iterator it;
|
||||
if (d->_editViewProvider) {
|
||||
for (it = d->baseViews.begin();it != d->baseViews.end();++it) {
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(*it);
|
||||
auto activeView = dynamic_cast<View3DInventor *>(*it);
|
||||
if (activeView)
|
||||
activeView->getViewer()->resetEditingViewProvider();
|
||||
}
|
||||
@@ -508,7 +508,7 @@ ViewProvider *Document::getInEdit(ViewProviderDocumentObject **parentVp,
|
||||
|
||||
if (d->_editViewProvider) {
|
||||
// there is only one 3d view which is in edit mode
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(getActiveView());
|
||||
auto activeView = dynamic_cast<View3DInventor *>(getActiveView());
|
||||
if (activeView && activeView->getViewer()->isEditingViewProvider())
|
||||
return d->_editViewProvider;
|
||||
}
|
||||
@@ -537,7 +537,7 @@ void Document::setAnnotationViewProvider(const char* name, ViewProvider *pcProvi
|
||||
|
||||
// cycling to all views of the document
|
||||
for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
auto activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
if (activeView)
|
||||
activeView->getViewer()->addViewProvider(pcProvider);
|
||||
}
|
||||
@@ -556,7 +556,7 @@ void Document::removeAnnotationViewProvider(const char* name)
|
||||
|
||||
// cycling to all views of the document
|
||||
for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
auto activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
if (activeView)
|
||||
activeView->getViewer()->removeViewProvider(it->second);
|
||||
}
|
||||
@@ -647,7 +647,7 @@ void Document::setPos(const char* name, const Base::Matrix4D& rclMtrx)
|
||||
//*****************************************************************************************************
|
||||
void Document::slotNewObject(const App::DocumentObject& Obj)
|
||||
{
|
||||
ViewProviderDocumentObject* pcProvider = static_cast<ViewProviderDocumentObject*>(getViewProvider(&Obj));
|
||||
auto pcProvider = static_cast<ViewProviderDocumentObject*>(getViewProvider(&Obj));
|
||||
if (!pcProvider) {
|
||||
//Base::Console().Log("Document::slotNewObject() called\n");
|
||||
std::string cName = Obj.getViewProviderNameStored();
|
||||
@@ -710,7 +710,7 @@ void Document::slotNewObject(const App::DocumentObject& Obj)
|
||||
std::list<Gui::BaseView*>::iterator vIt;
|
||||
// cycling to all views of the document
|
||||
for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
auto activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
if (activeView)
|
||||
activeView->getViewer()->addViewProvider(pcProvider);
|
||||
}
|
||||
@@ -753,7 +753,7 @@ void Document::slotDeletedObject(const App::DocumentObject& Obj)
|
||||
(ViewProviderDocumentObject::getClassTypeId())) {
|
||||
// go through the views
|
||||
for (vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
auto activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
if (activeView)
|
||||
activeView->getViewer()->removeViewProvider(viewProvider);
|
||||
}
|
||||
@@ -959,8 +959,8 @@ void Document::setModified(bool b)
|
||||
d->_isModified = b;
|
||||
|
||||
std::list<MDIView*> mdis = getMDIViews();
|
||||
for (std::list<MDIView*>::iterator it = mdis.begin(); it != mdis.end(); ++it) {
|
||||
(*it)->setWindowModified(b);
|
||||
for (auto & mdi : mdis) {
|
||||
mdi->setWindowModified(b);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1350,9 +1350,9 @@ void Document::Save (Base::Writer &writer) const
|
||||
int size = hGrp->GetInt("ThumbnailSize", 128);
|
||||
size = Base::clamp<int>(size, 64, 512);
|
||||
std::list<MDIView*> mdi = getMDIViews();
|
||||
for (std::list<MDIView*>::iterator it = mdi.begin(); it != mdi.end(); ++it) {
|
||||
if ((*it)->getTypeId().isDerivedFrom(View3DInventor::getClassTypeId())) {
|
||||
View3DInventorViewer* view = static_cast<View3DInventor*>(*it)->getViewer();
|
||||
for (const auto & it : mdi) {
|
||||
if (it->getTypeId().isDerivedFrom(View3DInventor::getClassTypeId())) {
|
||||
View3DInventorViewer* view = static_cast<View3DInventor*>(it)->getViewer();
|
||||
d->thumb.setFileName(d->_pcDocument->FileName.getValue());
|
||||
d->thumb.setSize(size);
|
||||
d->thumb.setViewer(view);
|
||||
@@ -1424,7 +1424,7 @@ void Document::RestoreDocFile(Base::Reader &reader)
|
||||
if (pObj) // check if this feature has been registered
|
||||
pObj->Restore(*localreader);
|
||||
if (pObj && expanded) {
|
||||
Gui::ViewProviderDocumentObject* vp = static_cast<Gui::ViewProviderDocumentObject*>(pObj);
|
||||
auto vp = static_cast<Gui::ViewProviderDocumentObject*>(pObj);
|
||||
this->signalExpandObject(*vp, TreeItemMode::ExpandItem,0,0);
|
||||
}
|
||||
localreader->readEndElement("ViewProvider");
|
||||
@@ -1440,9 +1440,9 @@ void Document::RestoreDocFile(Base::Reader &reader)
|
||||
try {
|
||||
const char** pReturnIgnore=nullptr;
|
||||
std::list<MDIView*> mdi = getMDIViews();
|
||||
for (std::list<MDIView*>::iterator it = mdi.begin(); it != mdi.end(); ++it) {
|
||||
if ((*it)->onHasMsg("SetCamera"))
|
||||
(*it)->onMsg(cameraSettings.c_str(), pReturnIgnore);
|
||||
for (const auto & it : mdi) {
|
||||
if (it->onHasMsg("SetCamera"))
|
||||
it->onMsg(cameraSettings.c_str(), pReturnIgnore);
|
||||
}
|
||||
}
|
||||
catch (const Base::Exception& e) {
|
||||
@@ -1558,10 +1558,10 @@ void Document::SaveDocFile (Base::Writer &writer) const
|
||||
|
||||
// save camera settings
|
||||
std::list<MDIView*> mdi = getMDIViews();
|
||||
for (std::list<MDIView*>::iterator it = mdi.begin(); it != mdi.end(); ++it) {
|
||||
if ((*it)->onHasMsg("GetCamera")) {
|
||||
for (const auto & it : mdi) {
|
||||
if (it->onHasMsg("GetCamera")) {
|
||||
const char* ppReturn=nullptr;
|
||||
(*it)->onMsg("GetCamera",&ppReturn);
|
||||
it->onMsg("GetCamera",&ppReturn);
|
||||
if(saveCameraSettings(ppReturn))
|
||||
break;
|
||||
}
|
||||
@@ -1580,11 +1580,11 @@ void Document::exportObjects(const std::vector<App::DocumentObject*>& obj, Base:
|
||||
writer.Stream() << "<Document SchemaVersion=\"1\">" << std::endl;
|
||||
|
||||
std::map<const App::DocumentObject*,ViewProvider*> views;
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = obj.begin(); it != obj.end(); ++it) {
|
||||
Document* doc = Application::Instance->getDocument((*it)->getDocument());
|
||||
for (const auto & it : obj) {
|
||||
Document* doc = Application::Instance->getDocument(it->getDocument());
|
||||
if (doc) {
|
||||
ViewProvider* vp = doc->getViewProvider(*it);
|
||||
if (vp) views[*it] = vp;
|
||||
ViewProvider* vp = doc->getViewProvider(it);
|
||||
if (vp) views[it] = vp;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1637,14 +1637,14 @@ void Document::importObjects(const std::vector<App::DocumentObject*>& obj, Base:
|
||||
// read the viewproviders itself
|
||||
localreader->readElement("ViewProviderData");
|
||||
int Cnt = localreader->getAttributeAsInteger("Count");
|
||||
std::vector<App::DocumentObject*>::const_iterator it = obj.begin();
|
||||
auto it = obj.begin();
|
||||
for (int i=0;i<Cnt&&it!=obj.end();++i,++it) {
|
||||
// The stored name usually doesn't match with the current name anymore
|
||||
// thus we try to match by type. This should work because the order of
|
||||
// objects should not have changed
|
||||
localreader->readElement("ViewProvider");
|
||||
std::string name = localreader->getAttribute("name");
|
||||
std::map<std::string, std::string>::const_iterator jt = nameMapping.find(name);
|
||||
auto jt = nameMapping.find(name);
|
||||
if (jt != nameMapping.end())
|
||||
name = jt->second;
|
||||
bool expanded = false;
|
||||
@@ -1694,16 +1694,16 @@ void Document::slotFinishImportObjects(const std::vector<App::DocumentObject*> &
|
||||
void Document::addRootObjectsToGroup(const std::vector<App::DocumentObject*>& obj, App::DocumentObjectGroup* grp)
|
||||
{
|
||||
std::map<App::DocumentObject*, bool> rootMap;
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = obj.begin(); it != obj.end(); ++it) {
|
||||
rootMap[*it] = true;
|
||||
for (const auto it : obj) {
|
||||
rootMap[it] = true;
|
||||
}
|
||||
// get the view providers and check which objects are children
|
||||
for (std::vector<App::DocumentObject*>::const_iterator it = obj.begin(); it != obj.end(); ++it) {
|
||||
Gui::ViewProvider* vp = getViewProvider(*it);
|
||||
for (const auto it : obj) {
|
||||
Gui::ViewProvider* vp = getViewProvider(it);
|
||||
if (vp) {
|
||||
std::vector<App::DocumentObject*> child = vp->claimChildren();
|
||||
for (std::vector<App::DocumentObject*>::iterator jt = child.begin(); jt != child.end(); ++jt) {
|
||||
std::map<App::DocumentObject*, bool>::iterator kt = rootMap.find(*jt);
|
||||
for (const auto & jt : child) {
|
||||
auto kt = rootMap.find(jt);
|
||||
if (kt != rootMap.end()) {
|
||||
kt->second = false;
|
||||
}
|
||||
@@ -1712,9 +1712,9 @@ void Document::addRootObjectsToGroup(const std::vector<App::DocumentObject*>& ob
|
||||
}
|
||||
|
||||
// all objects that are not children of other objects can be added to the group
|
||||
for (std::map<App::DocumentObject*, bool>::iterator it = rootMap.begin(); it != rootMap.end(); ++it) {
|
||||
if (it->second)
|
||||
grp->addObject(it->first);
|
||||
for (const auto & it : rootMap) {
|
||||
if (it.second)
|
||||
grp->addObject(it.first);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1729,7 +1729,7 @@ MDIView *Document::createView(const Base::Type& typeId)
|
||||
QtGLWidget* shareWidget = nullptr;
|
||||
// VBO rendering doesn't work correctly when we don't share the OpenGL widgets
|
||||
if (!theViews.empty()) {
|
||||
View3DInventor* firstView = static_cast<View3DInventor*>(theViews.front());
|
||||
auto firstView = static_cast<View3DInventor*>(theViews.front());
|
||||
shareWidget = qobject_cast<QtGLWidget*>(firstView->getViewer()->getGLWidget());
|
||||
|
||||
const char *ppReturn = nullptr;
|
||||
@@ -1737,9 +1737,9 @@ MDIView *Document::createView(const Base::Type& typeId)
|
||||
saveCameraSettings(ppReturn);
|
||||
}
|
||||
|
||||
View3DInventor* view3D = new View3DInventor(this, getMainWindow(), shareWidget);
|
||||
auto view3D = new View3DInventor(this, getMainWindow(), shareWidget);
|
||||
if (!theViews.empty()) {
|
||||
View3DInventor* firstView = static_cast<View3DInventor*>(theViews.front());
|
||||
auto firstView = static_cast<View3DInventor*>(theViews.front());
|
||||
std::string overrideMode = firstView->getViewer()->getOverrideMode();
|
||||
view3D->getViewer()->setOverrideMode(overrideMode);
|
||||
}
|
||||
@@ -1791,9 +1791,9 @@ Gui::MDIView* Document::cloneView(Gui::MDIView* oldview)
|
||||
return nullptr;
|
||||
|
||||
if (oldview->getTypeId() == View3DInventor::getClassTypeId()) {
|
||||
View3DInventor* view3D = new View3DInventor(this, getMainWindow());
|
||||
auto view3D = new View3DInventor(this, getMainWindow());
|
||||
|
||||
View3DInventor* firstView = static_cast<View3DInventor*>(oldview);
|
||||
auto firstView = static_cast<View3DInventor*>(oldview);
|
||||
std::string overrideMode = firstView->getViewer()->getOverrideMode();
|
||||
view3D->getViewer()->setOverrideMode(overrideMode);
|
||||
|
||||
@@ -2036,7 +2036,7 @@ std::list<MDIView*> Document::getMDIViews() const
|
||||
std::list<MDIView*> views;
|
||||
for (std::list<BaseView*>::const_iterator it = d->baseViews.begin();
|
||||
it != d->baseViews.end(); ++it) {
|
||||
MDIView* view = dynamic_cast<MDIView*>(*it);
|
||||
auto view = dynamic_cast<MDIView*>(*it);
|
||||
if (view)
|
||||
views.push_back(view);
|
||||
}
|
||||
@@ -2049,7 +2049,7 @@ std::list<MDIView*> Document::getMDIViewsOfType(const Base::Type& typeId) const
|
||||
std::list<MDIView*> views;
|
||||
for (std::list<BaseView*>::const_iterator it = d->baseViews.begin();
|
||||
it != d->baseViews.end(); ++it) {
|
||||
MDIView* view = dynamic_cast<MDIView*>(*it);
|
||||
auto view = dynamic_cast<MDIView*>(*it);
|
||||
if (view && view->isDerivedFrom(typeId))
|
||||
views.push_back(view);
|
||||
}
|
||||
@@ -2089,8 +2089,8 @@ bool Document::sendMsgToFirstView(const Base::Type& typeId, const char* pMsg, co
|
||||
|
||||
// now try the other views
|
||||
std::list<Gui::MDIView*> views = getMDIViewsOfType(typeId);
|
||||
for (std::list<Gui::MDIView*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
if ((*it != view) && (*it)->onMsg(pMsg, ppReturn)) {
|
||||
for (const auto & it : views) {
|
||||
if ((it != view) && it->onMsg(pMsg, ppReturn)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -2109,8 +2109,8 @@ MDIView* Document::getActiveView() const
|
||||
|
||||
// check whether the active view is part of this document
|
||||
bool ok=false;
|
||||
for (std::list<MDIView*>::const_iterator it = mdis.begin(); it != mdis.end(); ++it) {
|
||||
if ((*it) == active) {
|
||||
for (const auto & mdi : mdis) {
|
||||
if (mdi == active) {
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
@@ -2218,10 +2218,10 @@ void Document::setActiveWindow(Gui::MDIView* view)
|
||||
Gui::MDIView* Document::getViewOfNode(SoNode* node) const
|
||||
{
|
||||
std::list<MDIView*> mdis = getMDIViewsOfType(View3DInventor::getClassTypeId());
|
||||
for (std::list<MDIView*>::const_iterator it = mdis.begin(); it != mdis.end(); ++it) {
|
||||
View3DInventor* view = static_cast<View3DInventor*>(*it);
|
||||
for (const auto & mdi : mdis) {
|
||||
auto view = static_cast<View3DInventor*>(mdi);
|
||||
if (view->getViewer()->searchNode(node))
|
||||
return *it;
|
||||
return mdi;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@@ -2235,12 +2235,12 @@ Gui::MDIView* Document::getViewOfViewProvider(const Gui::ViewProvider* vp) const
|
||||
Gui::MDIView* Document::getEditingViewOfViewProvider(Gui::ViewProvider* vp) const
|
||||
{
|
||||
std::list<MDIView*> mdis = getMDIViewsOfType(View3DInventor::getClassTypeId());
|
||||
for (std::list<MDIView*>::const_iterator it = mdis.begin(); it != mdis.end(); ++it) {
|
||||
View3DInventor* view = static_cast<View3DInventor*>(*it);
|
||||
for (const auto & mdi : mdis) {
|
||||
auto view = static_cast<View3DInventor*>(mdi);
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
// there is only one 3d view which is in edit mode
|
||||
if (viewer->hasViewProvider(vp) && viewer->isEditingViewProvider())
|
||||
return *it;
|
||||
return mdi;
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
@@ -2415,8 +2415,8 @@ void Document::handleChildren3D(ViewProvider* viewProvider, bool deleting)
|
||||
Gui::coinRemoveAllChildren(backGroup);
|
||||
|
||||
if(!deleting) {
|
||||
for (std::vector<App::DocumentObject*>::iterator it=children.begin();it!=children.end();++it) {
|
||||
ViewProvider* ChildViewProvider = getViewProvider(*it);
|
||||
for (const auto & it : children) {
|
||||
ViewProvider* ChildViewProvider = getViewProvider(it);
|
||||
if (ChildViewProvider) {
|
||||
auto itOld = oldChildren.find(static_cast<ViewProviderDocumentObject*>(ChildViewProvider));
|
||||
if(itOld!=oldChildren.end()) oldChildren.erase(itOld);
|
||||
@@ -2434,7 +2434,7 @@ void Document::handleChildren3D(ViewProvider* viewProvider, bool deleting)
|
||||
|
||||
// cycling to all views of the document to remove the viewprovider from the viewer itself
|
||||
for (std::list<Gui::BaseView*>::iterator vIt = d->baseViews.begin();vIt != d->baseViews.end();++vIt) {
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
auto activeView = dynamic_cast<View3DInventor *>(*vIt);
|
||||
if (activeView && activeView->getViewer()->hasViewProvider(ChildViewProvider)) {
|
||||
// @Note hasViewProvider()
|
||||
// remove the viewprovider serves the purpose of detaching the inventor nodes from the
|
||||
@@ -2454,7 +2454,7 @@ void Document::handleChildren3D(ViewProvider* viewProvider, bool deleting)
|
||||
continue;
|
||||
|
||||
for (BaseView* view : d->baseViews) {
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(view);
|
||||
auto activeView = dynamic_cast<View3DInventor *>(view);
|
||||
if (activeView && !activeView->getViewer()->hasViewProvider(vpd))
|
||||
activeView->getViewer()->addViewProvider(vpd);
|
||||
}
|
||||
@@ -2468,7 +2468,7 @@ void Document::toggleInSceneGraph(ViewProvider *vp)
|
||||
// FIXME: What's the point of having this function?
|
||||
//
|
||||
for (auto view : d->baseViews) {
|
||||
View3DInventor *activeView = dynamic_cast<View3DInventor *>(view);
|
||||
auto activeView = dynamic_cast<View3DInventor *>(view);
|
||||
if (!activeView)
|
||||
continue;
|
||||
|
||||
|
||||
+29
-29
@@ -178,7 +178,7 @@ namespace Gui {
|
||||
int child=0;
|
||||
QList<DocumentModelIndex*>::const_iterator it;
|
||||
for (it = childItems.begin(); it != childItems.end(); ++it, ++child) {
|
||||
DocumentIndex* doc = static_cast<DocumentIndex*>(*it);
|
||||
auto doc = static_cast<DocumentIndex*>(*it);
|
||||
if (&doc->d == &d)
|
||||
return child;
|
||||
}
|
||||
@@ -237,7 +237,7 @@ namespace Gui {
|
||||
{
|
||||
QList<DocumentModelIndex*>::const_iterator it;
|
||||
for (it = childItems.begin(); it != childItems.end(); ++it) {
|
||||
ViewProviderIndex* v = static_cast<ViewProviderIndex*>(*it);
|
||||
auto v = static_cast<ViewProviderIndex*>(*it);
|
||||
v->findViewProviders(vp, index);
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,7 @@ namespace Gui {
|
||||
QList<DocumentModelIndex*>::const_iterator it;
|
||||
int index=0;
|
||||
for (it = childItems.begin(); it != childItems.end(); ++it, ++index) {
|
||||
ViewProviderIndex* v = static_cast<ViewProviderIndex*>(*it);
|
||||
auto v = static_cast<ViewProviderIndex*>(*it);
|
||||
if (&v->v == &vp)
|
||||
return index;
|
||||
}
|
||||
@@ -291,9 +291,9 @@ namespace Gui {
|
||||
|
||||
ViewProviderIndex* ViewProviderIndex::clone() const
|
||||
{
|
||||
ViewProviderIndex* copy = new ViewProviderIndex(this->v, this->d);
|
||||
for (QList<DocumentModelIndex*>::const_iterator it = childItems.begin(); it != childItems.end(); ++it) {
|
||||
ViewProviderIndex* c = static_cast<ViewProviderIndex*>(*it)->clone();
|
||||
auto copy = new ViewProviderIndex(this->v, this->d);
|
||||
for (const auto & childItem : childItems) {
|
||||
ViewProviderIndex* c = static_cast<ViewProviderIndex*>(childItem)->clone();
|
||||
copy->appendChild(c);
|
||||
}
|
||||
return copy;
|
||||
@@ -306,7 +306,7 @@ namespace Gui {
|
||||
index.push_back(const_cast<ViewProviderIndex*>(this));
|
||||
QList<DocumentModelIndex*>::const_iterator it;
|
||||
for (it = childItems.begin(); it != childItems.end(); ++it) {
|
||||
ViewProviderIndex* v = static_cast<ViewProviderIndex*>(*it);
|
||||
auto v = static_cast<ViewProviderIndex*>(*it);
|
||||
v->findViewProviders(vp, index);
|
||||
}
|
||||
}
|
||||
@@ -448,7 +448,7 @@ void DocumentModel::slotNewObject(const Gui::ViewProviderDocumentObject& obj)
|
||||
Gui::Document* gdc = Application::Instance->getDocument(doc);
|
||||
int row = d->rootItem->findChild(*gdc);
|
||||
if (row > -1) {
|
||||
DocumentIndex* index = static_cast<DocumentIndex*>(d->rootItem->child(row));
|
||||
auto index = static_cast<DocumentIndex*>(d->rootItem->child(row));
|
||||
QModelIndex parent = createIndex(index->row(),0,index);
|
||||
int count_obj = index->childCount();
|
||||
beginInsertRows(parent, count_obj, count_obj);
|
||||
@@ -463,16 +463,16 @@ void DocumentModel::slotDeleteObject(const Gui::ViewProviderDocumentObject& obj)
|
||||
Gui::Document* gdc = Application::Instance->getDocument(doc);
|
||||
int row = d->rootItem->findChild(*gdc);
|
||||
if (row > -1) {
|
||||
DocumentIndex* doc_index = static_cast<DocumentIndex*>(d->rootItem->child(row));
|
||||
auto doc_index = static_cast<DocumentIndex*>(d->rootItem->child(row));
|
||||
QList<ViewProviderIndex*> views;
|
||||
doc_index->findViewProviders(obj, views);
|
||||
for (QList<ViewProviderIndex*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
DocumentModelIndex* parentitem = (*it)->parent();
|
||||
for (auto & view : views) {
|
||||
DocumentModelIndex* parentitem = view->parent();
|
||||
QModelIndex parent = createIndex(doc_index->row(), 0, parentitem);
|
||||
int row = (*it)->row();
|
||||
int row = view->row();
|
||||
beginRemoveRows(parent, row, row);
|
||||
parentitem->removeChild(row);
|
||||
delete *it;
|
||||
delete view;
|
||||
endRemoveRows();
|
||||
}
|
||||
}
|
||||
@@ -486,13 +486,13 @@ void DocumentModel::slotChangeObject(const Gui::ViewProviderDocumentObject& obj,
|
||||
Gui::Document* gdc = Application::Instance->getDocument(doc);
|
||||
int row = d->rootItem->findChild(*gdc);
|
||||
if (row > -1) {
|
||||
DocumentIndex* doc_index = static_cast<DocumentIndex*>(d->rootItem->child(row));
|
||||
auto doc_index = static_cast<DocumentIndex*>(d->rootItem->child(row));
|
||||
QList<ViewProviderIndex*> views;
|
||||
doc_index->findViewProviders(obj, views);
|
||||
for (QList<ViewProviderIndex*>::iterator it = views.begin(); it != views.end(); ++it) {
|
||||
DocumentModelIndex* parentitem = (*it)->parent();
|
||||
for (const auto & view : views) {
|
||||
DocumentModelIndex* parentitem = view->parent();
|
||||
QModelIndex parent = createIndex(0,0,parentitem);
|
||||
int row = (*it)->row();
|
||||
int row = view->row();
|
||||
QModelIndex item = index (row, 0, parent);
|
||||
Q_EMIT dataChanged(item, item);
|
||||
}
|
||||
@@ -506,9 +506,9 @@ void DocumentModel::slotChangeObject(const Gui::ViewProviderDocumentObject& obj,
|
||||
int row = d->rootItem->findChild(*gdc);
|
||||
if (row > -1) {
|
||||
QList<DocumentModelIndex*> del_items;
|
||||
DocumentIndex* doc_index = static_cast<DocumentIndex*>(d->rootItem->child(row));
|
||||
for (std::vector<ViewProviderDocumentObject*>::iterator vp = views.begin(); vp != views.end(); ++vp) {
|
||||
int row = doc_index->rowOfViewProvider(**vp);
|
||||
auto doc_index = static_cast<DocumentIndex*>(d->rootItem->child(row));
|
||||
for (const auto & view : views) {
|
||||
int row = doc_index->rowOfViewProvider(*view);
|
||||
// is it a top-level child in the document
|
||||
if (row >= 0) {
|
||||
DocumentModelIndex* child = doc_index->child(row);
|
||||
@@ -523,18 +523,18 @@ void DocumentModel::slotChangeObject(const Gui::ViewProviderDocumentObject& obj,
|
||||
// get all occurrences of the view provider in the tree structure
|
||||
QList<ViewProviderIndex*> obj_index;
|
||||
doc_index->findViewProviders(obj, obj_index);
|
||||
for (QList<ViewProviderIndex*>::iterator it = obj_index.begin(); it != obj_index.end(); ++it) {
|
||||
QModelIndex parent = createIndex((*it)->row(),0,*it);
|
||||
int count_obj = (*it)->childCount();
|
||||
for (const auto & it : obj_index) {
|
||||
QModelIndex parent = createIndex(it->row(),0,it);
|
||||
int count_obj = it->childCount();
|
||||
beginRemoveRows(parent, 0, count_obj);
|
||||
// remove all children but do not yet delete them
|
||||
QList<DocumentModelIndex*> items = (*it)->removeAll();
|
||||
QList<DocumentModelIndex*> items = it->removeAll();
|
||||
endRemoveRows();
|
||||
|
||||
beginInsertRows(parent, 0, (int)views.size());
|
||||
for (std::vector<ViewProviderDocumentObject*>::iterator vp = views.begin(); vp != views.end(); ++vp) {
|
||||
ViewProviderIndex* clone = doc_index->cloneViewProvider(**vp);
|
||||
(*it)->appendChild(clone);
|
||||
for (const auto & view : views) {
|
||||
ViewProviderIndex* clone = doc_index->cloneViewProvider(*view);
|
||||
it->appendChild(clone);
|
||||
}
|
||||
endInsertRows();
|
||||
|
||||
@@ -591,8 +591,8 @@ DocumentModel::claimChildren(const Gui::Document& doc, const ViewProviderDocumen
|
||||
{
|
||||
std::vector<ViewProviderDocumentObject*> views;
|
||||
std::vector<App::DocumentObject*> childs = obj.claimChildren();
|
||||
for (std::vector<App::DocumentObject*>::iterator it = childs.begin(); it != childs.end(); ++it) {
|
||||
ViewProvider* view = doc.getViewProvider(*it);
|
||||
for (const auto & child : childs) {
|
||||
ViewProvider* view = doc.getViewProvider(child);
|
||||
if (view && view->getTypeId().isDerivedFrom(ViewProviderDocumentObject::getClassTypeId()))
|
||||
views.push_back(static_cast<ViewProviderDocumentObject*>(view));
|
||||
}
|
||||
|
||||
@@ -179,7 +179,7 @@ PyObject* DocumentPy::addAnnotation(PyObject *args)
|
||||
return nullptr;
|
||||
|
||||
PY_TRY {
|
||||
ViewProviderExtern *pcExt = new ViewProviderExtern();
|
||||
auto pcExt = new ViewProviderExtern();
|
||||
|
||||
pcExt->setModeByFile(psModName ? psModName : "Main", psFileName);
|
||||
pcExt->adjustDocumentName(getDocumentPtr()->getDocument()->getName());
|
||||
@@ -269,7 +269,7 @@ PyObject* DocumentPy::mdiViewsOfType(PyObject *args)
|
||||
PY_TRY {
|
||||
std::list<Gui::MDIView*> views = getDocumentPtr()->getMDIViewsOfType(type);
|
||||
Py::List list;
|
||||
for (std::list<Gui::MDIView*>::iterator it = views.begin(); it != views.end(); ++it)
|
||||
for (auto it = views.begin(); it != views.end(); ++it)
|
||||
list.append(Py::asObject((*it)->getPyObject()));
|
||||
return Py::new_reference_to(list);
|
||||
}
|
||||
@@ -331,7 +331,7 @@ PyObject* DocumentPy::toggleTreeItem(PyObject *args)
|
||||
// get the gui document of the Assembly Item
|
||||
//ActiveAppDoc = Item->getDocument();
|
||||
//ActiveGuiDoc = Gui::Application::Instance->getDocument(getDocumentPtr());
|
||||
Gui::ViewProviderDocumentObject* ActiveVp = dynamic_cast<Gui::ViewProviderDocumentObject*>(getDocumentPtr()->getViewProvider(Object));
|
||||
auto ActiveVp = dynamic_cast<Gui::ViewProviderDocumentObject*>(getDocumentPtr()->getViewProvider(Object));
|
||||
switch (mod) {
|
||||
case 0:
|
||||
getDocumentPtr()->signalExpandObject(*ActiveVp, TreeItemMode::ToggleItem, parent, subname);
|
||||
|
||||
@@ -186,7 +186,7 @@ DocumentRecovery::DocumentRecovery(const QList<QFileInfo>& dirs, QWidget* parent
|
||||
if (info.status == DocumentRecoveryPrivate::Created) {
|
||||
d_ptr->recoveryInfo << info;
|
||||
|
||||
QTreeWidgetItem* item = new QTreeWidgetItem(d_ptr->ui.treeWidget);
|
||||
auto item = new QTreeWidgetItem(d_ptr->ui.treeWidget);
|
||||
item->setText(0, info.label);
|
||||
item->setToolTip(0, info.tooltip);
|
||||
item->setText(1, tr("Not yet recovered"));
|
||||
|
||||
@@ -165,7 +165,7 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent)
|
||||
connect(this, SIGNAL(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)),
|
||||
SLOT(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*)));
|
||||
|
||||
QNetworkDiskCache *diskCache = new QNetworkDiskCache(this);
|
||||
auto diskCache = new QNetworkDiskCache(this);
|
||||
QString location = QStandardPaths::writableLocation(QStandardPaths::CacheLocation);
|
||||
diskCache->setCacheDirectory(location);
|
||||
setCache(diskCache);
|
||||
|
||||
@@ -161,7 +161,7 @@ void DownloadManager::handleUnsupportedContent(QNetworkReply *reply, bool reques
|
||||
if (ok && size == 0)
|
||||
return;
|
||||
|
||||
DownloadItem *item = new DownloadItem(reply, requestFileName, this);
|
||||
auto item = new DownloadItem(reply, requestFileName, this);
|
||||
addItem(item);
|
||||
}
|
||||
|
||||
@@ -182,7 +182,7 @@ void DownloadManager::addItem(DownloadItem *item)
|
||||
|
||||
void DownloadManager::updateRow()
|
||||
{
|
||||
DownloadItem *item = qobject_cast<DownloadItem*>(sender());
|
||||
auto item = qobject_cast<DownloadItem*>(sender());
|
||||
int row = m_downloads.indexOf(item);
|
||||
if (-1 == row)
|
||||
return;
|
||||
@@ -264,7 +264,7 @@ void DownloadManager::load()
|
||||
QString fileName = settings.value(key + QLatin1String("location")).toString();
|
||||
bool done = settings.value(key + QLatin1String("done"), true).toBool();
|
||||
if (!url.isEmpty() && !fileName.isEmpty()) {
|
||||
DownloadItem *item = new DownloadItem(nullptr, false, this);
|
||||
auto item = new DownloadItem(nullptr, false, this);
|
||||
item->m_output.setFileName(fileName);
|
||||
item->fileNameLabel->setText(QFileInfo(item->m_output.fileName()).fileName());
|
||||
item->m_url = url;
|
||||
|
||||
@@ -110,10 +110,10 @@ EditorView::EditorView(QPlainTextEdit* editor, QWidget* parent)
|
||||
connect(editor, SIGNAL(findPrevious()), d->searchBar, SLOT(findPrevious()));
|
||||
|
||||
// Create the layout containing the workspace and a tab bar
|
||||
QFrame* hbox = new QFrame(this);
|
||||
auto hbox = new QFrame(this);
|
||||
hbox->setFrameShape(QFrame::StyledPanel);
|
||||
hbox->setFrameShadow(QFrame::Sunken);
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->setMargin(1);
|
||||
layout->addWidget(d->textEdit);
|
||||
layout->addWidget(d->searchBar);
|
||||
|
||||
@@ -64,12 +64,12 @@ PyObject *ExpressionBindingPy::PyMake(struct _typeobject *, PyObject * args, PyO
|
||||
QWidget* obj = dynamic_cast<QWidget*>(wrap.toQObject(Py::Object(pyObj)));
|
||||
if (obj) {
|
||||
do {
|
||||
QuantitySpinBox* qsb = qobject_cast<QuantitySpinBox*>(obj);
|
||||
auto qsb = qobject_cast<QuantitySpinBox*>(obj);
|
||||
if (qsb) {
|
||||
expr = qsb;
|
||||
break;
|
||||
}
|
||||
InputField* inp = qobject_cast<InputField*>(obj);
|
||||
auto inp = qobject_cast<InputField*>(obj);
|
||||
if (inp) {
|
||||
expr = inp;
|
||||
break;
|
||||
|
||||
@@ -406,7 +406,7 @@ QStringList ExpressionCompleter::splitPath ( const QString & input ) const
|
||||
currentObj.getObject(), path);
|
||||
|
||||
std::vector<std::string> sl = p.getStringList();
|
||||
std::vector<std::string>::const_iterator sli = sl.begin();
|
||||
auto sli = sl.begin();
|
||||
if(retry && !sl.empty())
|
||||
sl.pop_back();
|
||||
if(!trim.empty() && boost::ends_with(sl.back(),trim))
|
||||
@@ -779,7 +779,7 @@ void ExpressionTextEdit::contextMenuEvent(QContextMenuEvent *event)
|
||||
|
||||
ExpressionParameter* ExpressionParameter::instance()
|
||||
{
|
||||
static ExpressionParameter* inst = new ExpressionParameter();
|
||||
static auto inst = new ExpressionParameter();
|
||||
return inst;
|
||||
}
|
||||
|
||||
|
||||
+33
-34
@@ -119,8 +119,7 @@ bool FileDialog::hasSuffix(const QString& ext) const
|
||||
QRegExp rx(QString::fromLatin1("\\*.(%1)\\W").arg(ext));
|
||||
rx.setCaseSensitivity(Qt::CaseInsensitive);
|
||||
QStringList filters = nameFilters();
|
||||
for (QStringList::iterator it = filters.begin(); it != filters.end(); ++it) {
|
||||
QString str = *it;
|
||||
for (const auto & str : filters) {
|
||||
if (rx.indexIn(str) != -1) {
|
||||
return true;
|
||||
}
|
||||
@@ -144,7 +143,7 @@ void FileDialog::accept()
|
||||
if (!ext.isEmpty() && (suffix.isEmpty() || !hasSuffix(suffix))) {
|
||||
file = QString::fromLatin1("%1.%2").arg(file, ext);
|
||||
// That's the built-in line edit
|
||||
QLineEdit* fileNameEdit = this->findChild<QLineEdit*>(QString::fromLatin1("fileNameEdit"));
|
||||
auto fileNameEdit = this->findChild<QLineEdit*>(QString::fromLatin1("fileNameEdit"));
|
||||
if (fileNameEdit)
|
||||
fileNameEdit->setText(file);
|
||||
}
|
||||
@@ -354,8 +353,8 @@ QStringList FileDialog::getOpenFileNames (QWidget * parent, const QString & capt
|
||||
}
|
||||
else {
|
||||
files = QFileDialog::getOpenFileNames(parent, windowTitle, dirName, filter, selectedFilter, options);
|
||||
for (QStringList::iterator it = files.begin(); it != files.end(); ++it) {
|
||||
*it = QDir::fromNativeSeparators(*it);
|
||||
for (auto & file : files) {
|
||||
file = QDir::fromNativeSeparators(file);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -443,7 +442,7 @@ FileOptionsDialog::FileOptionsDialog( QWidget* parent, Qt::WindowFlags fl )
|
||||
//box->addButton(extensionButton, QDialogButtonBox::ActionRole);
|
||||
|
||||
//search for the grid layout and add the new button
|
||||
QGridLayout* grid = this->findChild<QGridLayout*>();
|
||||
auto grid = this->findChild<QGridLayout*>();
|
||||
grid->addWidget(extensionButton, 4, 2, Qt::AlignLeft);
|
||||
|
||||
connect(extensionButton, SIGNAL(clicked()), this, SLOT(toggleExtension()));
|
||||
@@ -456,7 +455,7 @@ FileOptionsDialog::~FileOptionsDialog()
|
||||
void FileOptionsDialog::accept()
|
||||
{
|
||||
// Fixes a bug of the default implementation when entering an asterisk
|
||||
QLineEdit* filename = this->findChild<QLineEdit*>();
|
||||
auto filename = this->findChild<QLineEdit*>();
|
||||
QString fn = filename->text();
|
||||
if (fn.startsWith(QLatin1String("*"))) {
|
||||
QFileInfo fi(fn);
|
||||
@@ -466,9 +465,9 @@ void FileOptionsDialog::accept()
|
||||
bool ok=false;
|
||||
// Compare the given suffix with the suffixes of all filters
|
||||
QString filter;
|
||||
for (QStringList::ConstIterator it = filters.cbegin(); it != filters.cend(); ++it) {
|
||||
if ((*it).contains(ext)) {
|
||||
filter = *it;
|
||||
for (const auto & it : filters) {
|
||||
if (it.contains(ext)) {
|
||||
filter = it;
|
||||
ok = true;
|
||||
break;
|
||||
}
|
||||
@@ -502,7 +501,7 @@ void FileOptionsDialog::accept()
|
||||
fn = QString::fromLatin1("%1.%2").arg(fn, suf);
|
||||
selectFile(fn);
|
||||
// That's the built-in line edit (fixes Debian bug #811200)
|
||||
QLineEdit* fileNameEdit = this->findChild<QLineEdit*>(QString::fromLatin1("fileNameEdit"));
|
||||
auto fileNameEdit = this->findChild<QLineEdit*>(QString::fromLatin1("fileNameEdit"));
|
||||
if (fileNameEdit)
|
||||
fileNameEdit->setText(fn);
|
||||
}
|
||||
@@ -543,7 +542,7 @@ void FileOptionsDialog::setOptionsWidget(FileOptionsDialog::ExtensionPosition po
|
||||
if (extensionWidget->parentWidget() != this)
|
||||
extensionWidget->setParent(this);
|
||||
|
||||
QGridLayout* grid = this->findChild<QGridLayout*>();
|
||||
auto grid = this->findChild<QGridLayout*>();
|
||||
|
||||
if (extensionPos == ExtensionRight) {
|
||||
int cols = grid->columnCount();
|
||||
@@ -654,7 +653,7 @@ FileChooser::FileChooser ( QWidget * parent )
|
||||
, accMode( AcceptOpen )
|
||||
, _filter( QString() )
|
||||
{
|
||||
QHBoxLayout *layout = new QHBoxLayout( this );
|
||||
auto layout = new QHBoxLayout( this );
|
||||
layout->setMargin( 0 );
|
||||
layout->setSpacing( 2 );
|
||||
|
||||
@@ -857,7 +856,7 @@ SelectModule::SelectModule (const QString& type, const SelectModule::Dict& types
|
||||
|
||||
int index = 0;
|
||||
for (SelectModule::Dict::const_iterator it = types.begin(); it != types.end(); ++it) {
|
||||
QRadioButton* button = new QRadioButton(groupBox);
|
||||
auto button = new QRadioButton(groupBox);
|
||||
|
||||
QRegExp rx;
|
||||
QString filter = it.key();
|
||||
@@ -953,8 +952,8 @@ SelectModule::Dict SelectModule::exportHandler(const QStringList& fileNames, con
|
||||
it = filterList.find((const char*)filter.toUtf8());
|
||||
if (it != filterList.end()) {
|
||||
QString module = QString::fromLatin1(it->second.c_str());
|
||||
for (QStringList::const_iterator it = fileNames.begin(); it != fileNames.end(); ++it) {
|
||||
dict[*it] = module;
|
||||
for (const auto & fileName : fileNames) {
|
||||
dict[fileName] = module;
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
@@ -964,8 +963,8 @@ SelectModule::Dict SelectModule::exportHandler(const QStringList& fileNames, con
|
||||
// handled by more than one module and ask to the user to select one.
|
||||
QMap<QString, SelectModule::Dict> filetypeHandler;
|
||||
QMap<QString, QStringList > fileExtension;
|
||||
for (QStringList::const_iterator it = fileNames.begin(); it != fileNames.end(); ++it) {
|
||||
QFileInfo fi(*it);
|
||||
for (const auto & fileName : fileNames) {
|
||||
QFileInfo fi(fileName);
|
||||
QString ext = fi.completeSuffix().toLower();
|
||||
std::map<std::string, std::string> filters = App::GetApplication().getExportFilters(ext.toLatin1());
|
||||
|
||||
@@ -974,12 +973,12 @@ SelectModule::Dict SelectModule::exportHandler(const QStringList& fileNames, con
|
||||
filters = App::GetApplication().getExportFilters(ext.toLatin1());
|
||||
}
|
||||
|
||||
fileExtension[ext].push_back(*it);
|
||||
for (std::map<std::string, std::string>::iterator jt = filters.begin(); jt != filters.end(); ++jt)
|
||||
filetypeHandler[ext][QString::fromUtf8(jt->first.c_str())] = QString::fromLatin1(jt->second.c_str());
|
||||
fileExtension[ext].push_back(fileName);
|
||||
for (const auto & filter : filters)
|
||||
filetypeHandler[ext][QString::fromUtf8(filter.first.c_str())] = QString::fromLatin1(filter.second.c_str());
|
||||
// set the default module handler
|
||||
if (!filters.empty())
|
||||
dict[*it] = QString::fromLatin1(filters.begin()->second.c_str());
|
||||
dict[fileName] = QString::fromLatin1(filters.begin()->second.c_str());
|
||||
}
|
||||
|
||||
for (QMap<QString, SelectModule::Dict>::const_iterator it = filetypeHandler.cbegin();
|
||||
@@ -990,8 +989,8 @@ SelectModule::Dict SelectModule::exportHandler(const QStringList& fileNames, con
|
||||
if (dlg.exec()) {
|
||||
QString mod = dlg.getModule();
|
||||
const QStringList& files = fileExtension[it.key()];
|
||||
for (QStringList::const_iterator jt = files.begin(); jt != files.end(); ++jt)
|
||||
dict[*jt] = mod;
|
||||
for (const auto & file : files)
|
||||
dict[file] = mod;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1015,8 +1014,8 @@ SelectModule::Dict SelectModule::importHandler(const QStringList& fileNames, con
|
||||
it = filterList.find((const char*)filter.toUtf8());
|
||||
if (it != filterList.end()) {
|
||||
QString module = QString::fromLatin1(it->second.c_str());
|
||||
for (QStringList::const_iterator it = fileNames.begin(); it != fileNames.end(); ++it) {
|
||||
dict[*it] = module;
|
||||
for (const auto & fileName : fileNames) {
|
||||
dict[fileName] = module;
|
||||
}
|
||||
return dict;
|
||||
}
|
||||
@@ -1026,8 +1025,8 @@ SelectModule::Dict SelectModule::importHandler(const QStringList& fileNames, con
|
||||
// handled by more than one module and ask to the user to select one.
|
||||
QMap<QString, SelectModule::Dict> filetypeHandler;
|
||||
QMap<QString, QStringList > fileExtension;
|
||||
for (QStringList::const_iterator it = fileNames.begin(); it != fileNames.end(); ++it) {
|
||||
QFileInfo fi(*it);
|
||||
for (const auto & fileName : fileNames) {
|
||||
QFileInfo fi(fileName);
|
||||
QString ext = fi.completeSuffix().toLower();
|
||||
std::map<std::string, std::string> filters = App::GetApplication().getImportFilters(ext.toLatin1());
|
||||
|
||||
@@ -1036,12 +1035,12 @@ SelectModule::Dict SelectModule::importHandler(const QStringList& fileNames, con
|
||||
filters = App::GetApplication().getImportFilters(ext.toLatin1());
|
||||
}
|
||||
|
||||
fileExtension[ext].push_back(*it);
|
||||
for (std::map<std::string, std::string>::iterator jt = filters.begin(); jt != filters.end(); ++jt)
|
||||
filetypeHandler[ext][QString::fromUtf8(jt->first.c_str())] = QString::fromLatin1(jt->second.c_str());
|
||||
fileExtension[ext].push_back(fileName);
|
||||
for (const auto & filter : filters)
|
||||
filetypeHandler[ext][QString::fromUtf8(filter.first.c_str())] = QString::fromLatin1(filter.second.c_str());
|
||||
// set the default module handler
|
||||
if (!filters.empty())
|
||||
dict[*it] = QString::fromLatin1(filters.begin()->second.c_str());
|
||||
dict[fileName] = QString::fromLatin1(filters.begin()->second.c_str());
|
||||
}
|
||||
|
||||
for (QMap<QString, SelectModule::Dict>::const_iterator it = filetypeHandler.cbegin();
|
||||
@@ -1052,8 +1051,8 @@ SelectModule::Dict SelectModule::importHandler(const QStringList& fileNames, con
|
||||
if (dlg.exec()) {
|
||||
QString mod = dlg.getModule();
|
||||
const QStringList& files = fileExtension[it.key()];
|
||||
for (QStringList::const_iterator jt = files.begin(); jt != files.end(); ++jt)
|
||||
dict[*jt] = mod;
|
||||
for (const auto & file : files)
|
||||
dict[file] = mod;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -134,7 +134,7 @@ void Flag::mouseMoveEvent(QMouseEvent *e)
|
||||
if (e->buttons() & Qt::LeftButton) {
|
||||
move(e->globalPos() - dragPosition);
|
||||
e->accept();
|
||||
View3DInventorViewer* viewer = dynamic_cast<View3DInventorViewer*>(parentWidget());
|
||||
auto viewer = dynamic_cast<View3DInventorViewer*>(parentWidget());
|
||||
if (viewer)
|
||||
viewer->getSoRenderManager()->scheduleRedraw();
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ int OpenGLBuffer::size() const
|
||||
|
||||
void OpenGLBuffer::context_destruction_cb(uint32_t context, void * userdata)
|
||||
{
|
||||
OpenGLBuffer * self = static_cast<OpenGLBuffer*>(userdata);
|
||||
auto self = static_cast<OpenGLBuffer*>(userdata);
|
||||
|
||||
if (self->context == context && self->bufferId) {
|
||||
const cc_glglue * glue = cc_glglue_instance((int) context);
|
||||
@@ -183,7 +183,7 @@ void OpenGLBuffer::context_destruction_cb(uint32_t context, void * userdata)
|
||||
void OpenGLBuffer::buffer_delete(void * closure, uint32_t contextid)
|
||||
{
|
||||
const cc_glglue * glue = cc_glglue_instance((int) contextid);
|
||||
GLuint id = (GLuint) ((uintptr_t) closure);
|
||||
auto id = (GLuint) ((uintptr_t) closure);
|
||||
cc_glglue_glDeleteBuffers(glue, 1, &id);
|
||||
}
|
||||
|
||||
@@ -288,7 +288,7 @@ int OpenGLMultiBuffer::size() const
|
||||
|
||||
void OpenGLMultiBuffer::context_destruction_cb(uint32_t context, void * userdata)
|
||||
{
|
||||
OpenGLMultiBuffer * self = static_cast<OpenGLMultiBuffer*>(userdata);
|
||||
auto self = static_cast<OpenGLMultiBuffer*>(userdata);
|
||||
|
||||
auto it = self->bufs.find(context);
|
||||
if (it != self->bufs.end() && it->second) {
|
||||
@@ -304,7 +304,7 @@ void OpenGLMultiBuffer::context_destruction_cb(uint32_t context, void * userdata
|
||||
void OpenGLMultiBuffer::buffer_delete(void * closure, uint32_t contextid)
|
||||
{
|
||||
const cc_glglue * glue = cc_glglue_instance((int) contextid);
|
||||
GLuint id = (GLuint) ((uintptr_t) closure);
|
||||
auto id = (GLuint) ((uintptr_t) closure);
|
||||
cc_glglue_glDeleteBuffers(glue, 1, &id);
|
||||
}
|
||||
|
||||
|
||||
@@ -723,7 +723,7 @@ public:
|
||||
panDist,
|
||||
SbVec2f(0,0));
|
||||
} else if (ev.inventor_event->isOfType(SoGesturePinchEvent::getClassTypeId())){
|
||||
const SoGesturePinchEvent* const pinch = static_cast<const SoGesturePinchEvent*>(ev.inventor_event);
|
||||
const auto pinch = static_cast<const SoGesturePinchEvent*>(ev.inventor_event);
|
||||
SbVec2f panDist = ns.normalizePixelPos(pinch->deltaCenter.getValue());
|
||||
ns.panCamera(ns.viewer->getSoRenderManager()->getCamera(),
|
||||
ratio,
|
||||
@@ -963,7 +963,7 @@ bool GestureNavigationStyle::isDraggerUnderCursor(SbVec2s pos)
|
||||
rp.apply(this->viewer->getSoRenderManager()->getSceneGraph());
|
||||
SoPickedPoint* pick = rp.getPickedPoint();
|
||||
if (pick){
|
||||
const SoFullPath* fullpath = static_cast<const SoFullPath*>(pick->getPath());
|
||||
const auto fullpath = static_cast<const SoFullPath*>(pick->getPath());
|
||||
for(int i = 0; i < fullpath->getLength(); ++i){
|
||||
if(fullpath->getNode(i)->isOfType(SoDragger::getClassTypeId()))
|
||||
return true;
|
||||
|
||||
@@ -69,14 +69,14 @@ void GraphicsViewZoom::set_zoom_factor_base(double value) {
|
||||
|
||||
bool GraphicsViewZoom::eventFilter(QObject *object, QEvent *event) {
|
||||
if (event->type() == QEvent::MouseMove) {
|
||||
QMouseEvent* mouse_event = static_cast<QMouseEvent*>(event);
|
||||
auto mouse_event = static_cast<QMouseEvent*>(event);
|
||||
QPointF delta = target_viewport_pos - mouse_event->pos();
|
||||
if (qAbs(delta.x()) > 5 || qAbs(delta.y()) > 5) {
|
||||
target_viewport_pos = mouse_event->pos();
|
||||
target_scene_pos = _view->mapToScene(mouse_event->pos());
|
||||
}
|
||||
} else if (event->type() == QEvent::Wheel) {
|
||||
QWheelEvent* wheel_event = static_cast<QWheelEvent*>(event);
|
||||
auto wheel_event = static_cast<QWheelEvent*>(event);
|
||||
if (QApplication::keyboardModifiers() == _modifiers) {
|
||||
QPoint delta = wheel_event->angleDelta();
|
||||
if (qAbs(delta.y()) > qAbs(delta.x())) { // vertical
|
||||
|
||||
@@ -308,7 +308,7 @@ bool WheelEventFilter::eventFilter(QObject* obj, QEvent* ev)
|
||||
{
|
||||
if (qobject_cast<QComboBox*>(obj) && ev->type() == QEvent::Wheel)
|
||||
return true;
|
||||
QAbstractSpinBox* sb = qobject_cast<QAbstractSpinBox*>(obj);
|
||||
auto sb = qobject_cast<QAbstractSpinBox*>(obj);
|
||||
if (sb) {
|
||||
if (ev->type() == QEvent::Show) {
|
||||
sb->setFocusPolicy(Qt::StrongFocus);
|
||||
@@ -328,7 +328,7 @@ KeyboardFilter::KeyboardFilter(QObject* parent)
|
||||
bool KeyboardFilter::eventFilter(QObject* obj, QEvent* ev)
|
||||
{
|
||||
if (ev->type() == QEvent::KeyPress || ev->type() == QEvent::KeyRelease) {
|
||||
QKeyEvent *kev = static_cast<QKeyEvent *>(ev);
|
||||
auto kev = static_cast<QKeyEvent *>(ev);
|
||||
Qt::KeyboardModifiers mod = kev->modifiers();
|
||||
int key = kev->key();
|
||||
if ((mod & Qt::KeypadModifier) && (key == Qt::Key_Period || key == Qt::Key_Comma))
|
||||
|
||||
@@ -79,26 +79,26 @@ bool Gui::GUIApplicationNativeEventAware::processSpaceballEvent(QObject *object,
|
||||
QApplication::notify(object, event);
|
||||
if (event->type() == Spaceball::MotionEvent::MotionEventType)
|
||||
{
|
||||
Spaceball::MotionEvent *motionEvent = dynamic_cast<Spaceball::MotionEvent*>(event);
|
||||
auto motionEvent = dynamic_cast<Spaceball::MotionEvent*>(event);
|
||||
if (!motionEvent)
|
||||
return true;
|
||||
if (!motionEvent->isHandled())
|
||||
{
|
||||
//make a new event and post to parent.
|
||||
Spaceball::MotionEvent *newEvent = new Spaceball::MotionEvent(*motionEvent);
|
||||
auto newEvent = new Spaceball::MotionEvent(*motionEvent);
|
||||
postEvent(object->parent(), newEvent);
|
||||
}
|
||||
}
|
||||
|
||||
if (event->type() == Spaceball::ButtonEvent::ButtonEventType)
|
||||
{
|
||||
Spaceball::ButtonEvent *buttonEvent = dynamic_cast<Spaceball::ButtonEvent*>(event);
|
||||
auto buttonEvent = dynamic_cast<Spaceball::ButtonEvent*>(event);
|
||||
if (!buttonEvent)
|
||||
return true;
|
||||
if (!buttonEvent->isHandled())
|
||||
{
|
||||
//make a new event and post to parent.
|
||||
Spaceball::ButtonEvent *newEvent = new Spaceball::ButtonEvent(*buttonEvent);
|
||||
auto newEvent = new Spaceball::ButtonEvent(*buttonEvent);
|
||||
postEvent(object->parent(), newEvent);
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ void Gui::GUIApplicationNativeEventAware::postMotionEvent(std::vector<int> motio
|
||||
}
|
||||
importSettings(motionDataArray);
|
||||
|
||||
Spaceball::MotionEvent *motionEvent = new Spaceball::MotionEvent();
|
||||
auto motionEvent = new Spaceball::MotionEvent();
|
||||
motionEvent->setTranslations(motionDataArray[0], motionDataArray[1], motionDataArray[2]);
|
||||
motionEvent->setRotations(motionDataArray[3], motionDataArray[4], motionDataArray[5]);
|
||||
this->postEvent(currentWidget, motionEvent);
|
||||
@@ -126,7 +126,7 @@ void Gui::GUIApplicationNativeEventAware::postButtonEvent(int buttonNumber, int
|
||||
return;
|
||||
}
|
||||
|
||||
Spaceball::ButtonEvent *buttonEvent = new Spaceball::ButtonEvent();
|
||||
auto buttonEvent = new Spaceball::ButtonEvent();
|
||||
buttonEvent->setButtonNumber(buttonNumber);
|
||||
if (buttonPress)
|
||||
{
|
||||
|
||||
+18
-18
@@ -105,7 +105,7 @@ void InputField::bind(const App::ObjectIdentifier &_path)
|
||||
{
|
||||
ExpressionBinding::bind(_path);
|
||||
|
||||
PropertyQuantity * prop = freecad_dynamic_cast<PropertyQuantity>(getPath().getProperty());
|
||||
auto * prop = freecad_dynamic_cast<PropertyQuantity>(getPath().getProperty());
|
||||
|
||||
if (prop)
|
||||
actQuantity = Base::Quantity(prop->getValue());
|
||||
@@ -189,7 +189,7 @@ void InputField::contextMenuEvent(QContextMenuEvent *event)
|
||||
{
|
||||
QMenu *editMenu = createStandardContextMenu();
|
||||
editMenu->setTitle(tr("Edit"));
|
||||
QMenu* menu = new QMenu(QString::fromLatin1("InputFieldContextmenu"));
|
||||
auto menu = new QMenu(QString::fromLatin1("InputFieldContextmenu"));
|
||||
|
||||
menu->addMenu(editMenu);
|
||||
menu->addSeparator();
|
||||
@@ -201,9 +201,9 @@ void InputField::contextMenuEvent(QContextMenuEvent *event)
|
||||
// add the history menu part...
|
||||
std::vector<QString> history = getHistory();
|
||||
|
||||
for(std::vector<QString>::const_iterator it = history.begin();it!= history.end();++it){
|
||||
actions.push_back(menu->addAction(*it));
|
||||
values.push_back(*it);
|
||||
for(const auto & it : history){
|
||||
actions.push_back(menu->addAction(it));
|
||||
values.push_back(it);
|
||||
}
|
||||
|
||||
// add the save value portion of the menu
|
||||
@@ -211,9 +211,9 @@ void InputField::contextMenuEvent(QContextMenuEvent *event)
|
||||
QAction *SaveValueAction = menu->addAction(tr("Save value"));
|
||||
std::vector<QString> savedValues = getSavedValues();
|
||||
|
||||
for(std::vector<QString>::const_iterator it = savedValues.begin();it!= savedValues.end();++it){
|
||||
actions.push_back(menu->addAction(*it));
|
||||
values.push_back(*it);
|
||||
for(const auto & savedValue : savedValues){
|
||||
actions.push_back(menu->addAction(savedValue));
|
||||
values.push_back(savedValue);
|
||||
}
|
||||
|
||||
// call the menu and wait until its back
|
||||
@@ -224,7 +224,7 @@ void InputField::contextMenuEvent(QContextMenuEvent *event)
|
||||
pushToSavedValues();
|
||||
else{
|
||||
int i=0;
|
||||
for(std::vector<QAction *>::const_iterator it = actions.begin();it!=actions.end();++it,i++)
|
||||
for(auto it = actions.begin();it!=actions.end();++it,i++)
|
||||
if(*it == saveAction)
|
||||
this->setText(values[i]);
|
||||
}
|
||||
@@ -246,7 +246,7 @@ void InputField::newInput(const QString & text)
|
||||
|
||||
std::unique_ptr<Expression> evalRes(getExpression()->eval());
|
||||
|
||||
NumberExpression * value = freecad_dynamic_cast<NumberExpression>(evalRes.get());
|
||||
auto * value = freecad_dynamic_cast<NumberExpression>(evalRes.get());
|
||||
if (value) {
|
||||
res.setValue(value->getValue());
|
||||
res.setUnit(value->getUnit());
|
||||
@@ -311,8 +311,8 @@ void InputField::pushToHistory(const QString &valueq)
|
||||
|
||||
// check if already in:
|
||||
std::vector<QString> hist = InputField::getHistory();
|
||||
for(std::vector<QString>::const_iterator it = hist.begin();it!=hist.end();++it)
|
||||
if( *it == val)
|
||||
for(const auto & it : hist)
|
||||
if( it == val)
|
||||
return;
|
||||
|
||||
std::string value(val.toUtf8());
|
||||
@@ -600,16 +600,16 @@ void InputField::selectNumber()
|
||||
QChar n = locale().negativeSign();
|
||||
QChar e = locale().exponential();
|
||||
|
||||
for (QString::const_iterator it = str.cbegin(); it != str.cend(); ++it) {
|
||||
if (it->isDigit())
|
||||
for (const auto & it : str) {
|
||||
if (it.isDigit())
|
||||
i++;
|
||||
else if (*it == d)
|
||||
else if (it == d)
|
||||
i++;
|
||||
else if (*it == g)
|
||||
else if (it == g)
|
||||
i++;
|
||||
else if (*it == n)
|
||||
else if (it == n)
|
||||
i++;
|
||||
else if (*it == e && actQuantity.getFormat().format != Base::QuantityFormat::Fixed)
|
||||
else if (it == e && actQuantity.getFormat().format != Base::QuantityFormat::Fixed)
|
||||
i++;
|
||||
else // any non-number character
|
||||
break;
|
||||
|
||||
@@ -71,7 +71,7 @@ LocationWidget::LocationWidget (QWidget * parent)
|
||||
yValue->setUnit(Base::Unit::Length);
|
||||
zValue->setUnit(Base::Unit::Length);
|
||||
|
||||
QGridLayout* gridLayout = new QGridLayout(this);
|
||||
auto gridLayout = new QGridLayout(this);
|
||||
gridLayout->addLayout(box, 0, 0, 1, 2);
|
||||
|
||||
connect(dValue, SIGNAL(activated(int)),
|
||||
@@ -151,7 +151,7 @@ void LocationWidget::setDirection(const Base::Vector3d& dir)
|
||||
for (int i=0; i<dValue->count()-1; i++) {
|
||||
QVariant data = dValue->itemData (i);
|
||||
if (data.canConvert<Base::Vector3d>()) {
|
||||
const Base::Vector3d val = data.value<Base::Vector3d>();
|
||||
const auto val = data.value<Base::Vector3d>();
|
||||
if (val == dir) {
|
||||
dValue->setCurrentIndex(i);
|
||||
return;
|
||||
|
||||
@@ -195,7 +195,7 @@ private:
|
||||
for (int i=0; i<this->direction->count()-1; i++) {
|
||||
QVariant data = this->direction->itemData (i);
|
||||
if (data.canConvert<Base::Vector3d>()) {
|
||||
const Base::Vector3d val = data.value<Base::Vector3d>();
|
||||
const auto val = data.value<Base::Vector3d>();
|
||||
if (val == dir) {
|
||||
this->direction->setCurrentIndex(i);
|
||||
return;
|
||||
@@ -315,7 +315,7 @@ public:
|
||||
for (int i=0; i<this->direction->count()-1; i++) {
|
||||
QVariant data = this->direction->itemData (i);
|
||||
if (data.canConvert<Base::Vector3d>()) {
|
||||
const Base::Vector3d val = data.value<Base::Vector3d>();
|
||||
const auto val = data.value<Base::Vector3d>();
|
||||
if (val == dir) {
|
||||
this->direction->setCurrentIndex(i);
|
||||
return;
|
||||
@@ -501,7 +501,7 @@ public:
|
||||
for (int i=0; i<ui->direction->count()-1; i++) {
|
||||
QVariant data = ui->direction->itemData (i);
|
||||
if (data.canConvert<Base::Vector3d>()) {
|
||||
const Base::Vector3d val = data.value<Base::Vector3d>();
|
||||
const auto val = data.value<Base::Vector3d>();
|
||||
if (val == dir) {
|
||||
ui->direction->setCurrentIndex(i);
|
||||
return;
|
||||
|
||||
@@ -125,7 +125,7 @@ SmSwitchboard::doAction(SoAction * action)
|
||||
if (action->isOfType(SoGetBoundingBoxAction::getClassTypeId())) {
|
||||
// calculate center of bbox if bboxaction. This makes the
|
||||
// switchboard node behave exactly like a group node
|
||||
SoGetBoundingBoxAction * bbaction = (SoGetBoundingBoxAction*) action;
|
||||
auto bbaction = (SoGetBoundingBoxAction*) action;
|
||||
// Initialize accumulation variables.
|
||||
SbVec3f acccenter(0.0f, 0.0f, 0.0f);
|
||||
int numcenters = 0;
|
||||
|
||||
@@ -113,13 +113,13 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Keyboard handling
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
const SoKeyboardEvent * const event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
auto event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
processed = processKeyboardEvent(event);
|
||||
}
|
||||
|
||||
// Mouse Button / Spaceball Button handling
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
const auto event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
@@ -220,7 +220,7 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
// Mouse Movement handling
|
||||
if (type.isDerivedFrom(SoLocation2Event::getClassTypeId())) {
|
||||
this->lockrecenter = true;
|
||||
const SoLocation2Event * const event = (const SoLocation2Event *) ev;
|
||||
const auto event = (const SoLocation2Event *) ev;
|
||||
if (this->currentmode == NavigationStyle::ZOOMING) {
|
||||
this->zoomByCursor(posn, prevnormalized);
|
||||
processed = true;
|
||||
@@ -240,7 +240,7 @@ SbBool InventorNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Spaceball & Joystick handling
|
||||
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
|
||||
const SoMotion3Event * const event = static_cast<const SoMotion3Event *>(ev);
|
||||
const auto event = static_cast<const SoMotion3Event *>(ev);
|
||||
if (event)
|
||||
this->processMotionEvent(event);
|
||||
processed = true;
|
||||
|
||||
@@ -303,11 +303,11 @@ void Translator::installQMFiles(const QDir& dir, const char* locale)
|
||||
{
|
||||
QString filter = QString::fromLatin1("*_%1.qm").arg(QLatin1String(locale));
|
||||
QStringList fileNames = dir.entryList(QStringList(filter), QDir::Files, QDir::Name);
|
||||
for (QStringList::Iterator it = fileNames.begin(); it != fileNames.end(); ++it){
|
||||
for (const auto &it : fileNames){
|
||||
bool ok=false;
|
||||
for (std::list<QTranslator*>::const_iterator tt = d->translators.begin();
|
||||
tt != d->translators.end(); ++tt) {
|
||||
if ((*tt)->objectName() == *it) {
|
||||
if ((*tt)->objectName() == it) {
|
||||
ok = true; // this file is already installed
|
||||
break;
|
||||
}
|
||||
@@ -315,9 +315,9 @@ void Translator::installQMFiles(const QDir& dir, const char* locale)
|
||||
|
||||
// okay, we need to install this file
|
||||
if (!ok) {
|
||||
QTranslator* translator = new QTranslator;
|
||||
translator->setObjectName(*it);
|
||||
if (translator->load(dir.filePath(*it))) {
|
||||
auto translator = new QTranslator;
|
||||
translator->setObjectName(it);
|
||||
if (translator->load(dir.filePath(it))) {
|
||||
qApp->installTranslator(translator);
|
||||
d->translators.push_back(translator);
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ PyObject* LinkViewPy::getElementPicked(PyObject* args)
|
||||
return nullptr;
|
||||
void *ptr = nullptr;
|
||||
Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoPickedPoint *", obj, &ptr, 0);
|
||||
SoPickedPoint *pp = static_cast<SoPickedPoint*>(ptr);
|
||||
auto pp = static_cast<SoPickedPoint*>(ptr);
|
||||
if(!pp)
|
||||
throw Py::TypeError("type must be of coin.SoPickedPoint");
|
||||
PY_TRY{
|
||||
@@ -296,7 +296,7 @@ PyObject* LinkViewPy::getDetailPath(PyObject* args)
|
||||
return nullptr;
|
||||
void *ptr = nullptr;
|
||||
Base::Interpreter().convertSWIGPointerObj("pivy.coin", "SoPath *", path, &ptr, 0);
|
||||
SoPath *pPath = static_cast<SoPath*>(ptr);
|
||||
auto pPath = static_cast<SoPath*>(ptr);
|
||||
if(!pPath)
|
||||
throw Py::TypeError("type must be of coin.SoPath");
|
||||
PY_TRY{
|
||||
|
||||
+4
-4
@@ -277,8 +277,8 @@ QStringList MDIView::undoActions() const
|
||||
Gui::Document* doc = getGuiDocument();
|
||||
if (doc) {
|
||||
std::vector<std::string> vecUndos = doc->getUndoVector();
|
||||
for (std::vector<std::string>::iterator i = vecUndos.begin(); i != vecUndos.end(); ++i) {
|
||||
actions << QCoreApplication::translate("Command", i->c_str());
|
||||
for (const auto & vecUndo : vecUndos) {
|
||||
actions << QCoreApplication::translate("Command", vecUndo.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,8 +291,8 @@ QStringList MDIView::redoActions() const
|
||||
Gui::Document* doc = getGuiDocument();
|
||||
if (doc) {
|
||||
std::vector<std::string> vecRedos = doc->getRedoVector();
|
||||
for (std::vector<std::string>::iterator i = vecRedos.begin(); i != vecRedos.end(); ++i) {
|
||||
actions << QCoreApplication::translate("Command", i->c_str());
|
||||
for (const auto & vecRedo : vecRedos) {
|
||||
actions << QCoreApplication::translate("Command", vecRedo.c_str());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+87
-87
@@ -270,7 +270,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
|
||||
d->mdiArea->setTabsMovable(true);
|
||||
d->mdiArea->setTabPosition(QTabWidget::South);
|
||||
d->mdiArea->setViewMode(QMdiArea::TabbedView);
|
||||
QTabBar* tab = d->mdiArea->findChild<QTabBar*>();
|
||||
auto tab = d->mdiArea->findChild<QTabBar*>();
|
||||
if (tab) {
|
||||
tab->setTabsClosable(true);
|
||||
// The tabs might be very wide
|
||||
@@ -330,7 +330,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
|
||||
|
||||
std::string hiddenDockWindows;;
|
||||
const std::map<std::string,std::string>& config = App::Application::Config();
|
||||
std::map<std::string, std::string>::const_iterator ht = config.find("HiddenDockWindow");
|
||||
auto ht = config.find("HiddenDockWindow");
|
||||
if (ht != config.end())
|
||||
hiddenDockWindows = ht->second;
|
||||
|
||||
@@ -347,7 +347,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
|
||||
group->SetBool("Enabled", enabled); //ensure entry exists.
|
||||
if (enabled) {
|
||||
treeView = true;
|
||||
TreeDockWidget* tree = new TreeDockWidget(nullptr, this);
|
||||
auto tree = new TreeDockWidget(nullptr, this);
|
||||
tree->setObjectName
|
||||
(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Tree view")));
|
||||
tree->setMinimumWidth(210);
|
||||
@@ -368,7 +368,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
|
||||
group->SetBool("Enabled", enabled); //ensure entry exists.
|
||||
if (enabled) {
|
||||
propertyView = true;
|
||||
PropertyDockView* pcPropView = new PropertyDockView(nullptr, this);
|
||||
auto pcPropView = new PropertyDockView(nullptr, this);
|
||||
pcPropView->setObjectName
|
||||
(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Property view")));
|
||||
pcPropView->setMinimumWidth(210);
|
||||
@@ -378,7 +378,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
|
||||
|
||||
// Selection view
|
||||
if (hiddenDockWindows.find("Std_SelectionView") == std::string::npos) {
|
||||
SelectionView* pcSelectionView = new SelectionView(nullptr, this);
|
||||
auto pcSelectionView = new SelectionView(nullptr, this);
|
||||
pcSelectionView->setObjectName
|
||||
(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Selection view")));
|
||||
pcSelectionView->setMinimumWidth(210);
|
||||
@@ -394,7 +394,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
|
||||
enable = group->GetBool("Enabled", true);
|
||||
}
|
||||
|
||||
ComboView* pcComboView = new ComboView(enable, nullptr, this);
|
||||
auto pcComboView = new ComboView(enable, nullptr, this);
|
||||
pcComboView->setObjectName(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Combo View")));
|
||||
pcComboView->setMinimumWidth(150);
|
||||
pDockMgr->registerDockWindow("Std_ComboView", pcComboView);
|
||||
@@ -402,18 +402,18 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
|
||||
|
||||
// Report view (must be created before PythonConsole!)
|
||||
if (hiddenDockWindows.find("Std_ReportView") == std::string::npos) {
|
||||
ReportOutput* pcReport = new ReportOutput(this);
|
||||
auto pcReport = new ReportOutput(this);
|
||||
pcReport->setWindowIcon(BitmapFactory().pixmap("MacroEditor"));
|
||||
pcReport->setObjectName
|
||||
(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Report view")));
|
||||
pDockMgr->registerDockWindow("Std_ReportView", pcReport);
|
||||
ReportOutputObserver* rvObserver = new ReportOutputObserver(pcReport);
|
||||
auto rvObserver = new ReportOutputObserver(pcReport);
|
||||
qApp->installEventFilter(rvObserver);
|
||||
}
|
||||
|
||||
// Python console
|
||||
if (hiddenDockWindows.find("Std_PythonView") == std::string::npos) {
|
||||
PythonConsole* pcPython = new PythonConsole(this);
|
||||
auto pcPython = new PythonConsole(this);
|
||||
pcPython->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
|
||||
pcPython->setObjectName
|
||||
(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Python console")));
|
||||
@@ -439,7 +439,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f)
|
||||
enabled = group->GetBool("Enabled", enabled);
|
||||
group->SetBool("Enabled", enabled); //ensure entry exists.
|
||||
if (enabled) {
|
||||
DAG::DockWindow *dagDockWindow = new DAG::DockWindow(nullptr, this);
|
||||
auto dagDockWindow = new DAG::DockWindow(nullptr, this);
|
||||
dagDockWindow->setObjectName
|
||||
(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","DAG View")));
|
||||
pDockMgr->registerDockWindow("Std_DAGView", dagDockWindow);
|
||||
@@ -474,12 +474,12 @@ QMenu* MainWindow::createPopupMenu ()
|
||||
if (item.hasItems()) {
|
||||
menu->addSeparator();
|
||||
QList<MenuItem*> items = item.getItems();
|
||||
for (QList<MenuItem*>::iterator it = items.begin(); it != items.end(); ++it) {
|
||||
if ((*it)->command() == "Separator") {
|
||||
for (const auto & item : items) {
|
||||
if (item->command() == "Separator") {
|
||||
menu->addSeparator();
|
||||
}
|
||||
else {
|
||||
Command* cmd = Application::Instance->commandManager().getCommandByName((*it)->command().c_str());
|
||||
Command* cmd = Application::Instance->commandManager().getCommandByName(item->command().c_str());
|
||||
if (cmd) cmd->addTo(menu);
|
||||
}
|
||||
}
|
||||
@@ -710,7 +710,7 @@ bool MainWindow::event(QEvent *e)
|
||||
// this in eventFilter().
|
||||
}
|
||||
else if (e->type() == QEvent::WhatsThisClicked) {
|
||||
QWhatsThisClickedEvent* wt = static_cast<QWhatsThisClickedEvent*>(e);
|
||||
auto wt = static_cast<QWhatsThisClickedEvent*>(e);
|
||||
showDocumentation(wt->href());
|
||||
}
|
||||
else if (e->type() == QEvent::ApplicationWindowIconChange) {
|
||||
@@ -723,7 +723,7 @@ bool MainWindow::event(QEvent *e)
|
||||
}
|
||||
}
|
||||
else if (e->type() == Spaceball::ButtonEvent::ButtonEventType) {
|
||||
Spaceball::ButtonEvent *buttonEvent = dynamic_cast<Spaceball::ButtonEvent *>(e);
|
||||
auto buttonEvent = dynamic_cast<Spaceball::ButtonEvent *>(e);
|
||||
if (!buttonEvent)
|
||||
return true;
|
||||
buttonEvent->setHandled(true);
|
||||
@@ -745,14 +745,14 @@ bool MainWindow::event(QEvent *e)
|
||||
return true;
|
||||
}
|
||||
else if (e->type() == Spaceball::MotionEvent::MotionEventType) {
|
||||
Spaceball::MotionEvent *motionEvent = dynamic_cast<Spaceball::MotionEvent *>(e);
|
||||
auto motionEvent = dynamic_cast<Spaceball::MotionEvent *>(e);
|
||||
if (!motionEvent)
|
||||
return true;
|
||||
motionEvent->setHandled(true);
|
||||
Gui::Document *doc = Application::Instance->activeDocument();
|
||||
if (!doc)
|
||||
return true;
|
||||
View3DInventor *temp = dynamic_cast<View3DInventor *>(doc->getActiveView());
|
||||
auto temp = dynamic_cast<View3DInventor *>(doc->getActiveView());
|
||||
if (!temp)
|
||||
return true;
|
||||
View3DInventorViewer *view = temp->getViewer();
|
||||
@@ -775,7 +775,7 @@ bool MainWindow::eventFilter(QObject* o, QEvent* e)
|
||||
if (e->type() == QEvent::WindowStateChange) {
|
||||
// notify all mdi views when the active view receives a show normal, show minimized
|
||||
// or show maximized event
|
||||
MDIView * view = qobject_cast<MDIView*>(o);
|
||||
auto view = qobject_cast<MDIView*>(o);
|
||||
if (view) { // emit this signal
|
||||
Qt::WindowStates oldstate = static_cast<QWindowStateChangeEvent*>(e)->oldState();
|
||||
Qt::WindowStates newstate = view->windowState();
|
||||
@@ -792,7 +792,7 @@ bool MainWindow::eventFilter(QObject* o, QEvent* e)
|
||||
if (!o->isWidgetType())
|
||||
return false;
|
||||
// clicked on a widget in what's this mode
|
||||
QWidget * w = static_cast<QWidget *>(o);
|
||||
auto w = static_cast<QWidget *>(o);
|
||||
d->whatstext = w->whatsThis();
|
||||
}
|
||||
if (e->type() == QEvent::WhatsThisClicked) {
|
||||
@@ -807,7 +807,7 @@ bool MainWindow::eventFilter(QObject* o, QEvent* e)
|
||||
if (o->inherits("QMenu") && QWhatsThis::inWhatsThisMode()) {
|
||||
bool whatthis = false;
|
||||
if (e->type() == QEvent::KeyPress) {
|
||||
QKeyEvent* ke = static_cast<QKeyEvent*>(e);
|
||||
auto ke = static_cast<QKeyEvent*>(e);
|
||||
if (ke->key() == Qt::Key_Return || ke->key() == Qt::Key_Enter || ke->key() == Qt::Key_F1)
|
||||
whatthis = true;
|
||||
}
|
||||
@@ -854,7 +854,7 @@ void MainWindow::addWindow(MDIView* view)
|
||||
{
|
||||
// make workspace parent of view
|
||||
bool isempty = d->mdiArea->subWindowList().isEmpty();
|
||||
QMdiSubWindow* child = qobject_cast<QMdiSubWindow*>(view->parentWidget());
|
||||
auto child = qobject_cast<QMdiSubWindow*>(view->parentWidget());
|
||||
if(!child) {
|
||||
child = new QMdiSubWindow(d->mdiArea->viewport());
|
||||
child->setAttribute(Qt::WA_DeleteOnClose);
|
||||
@@ -864,9 +864,9 @@ void MainWindow::addWindow(MDIView* view)
|
||||
|
||||
// See StdCmdCloseActiveWindow (#0002631)
|
||||
QList<QAction*> acts = menu->actions();
|
||||
for (QList<QAction*>::iterator it = acts.begin(); it != acts.end(); ++it) {
|
||||
if ((*it)->shortcut() == QKeySequence(QKeySequence::Close)) {
|
||||
(*it)->setShortcuts(QList<QKeySequence>());
|
||||
for (auto & act : acts) {
|
||||
if (act->shortcut() == QKeySequence(QKeySequence::Close)) {
|
||||
act->setShortcuts(QList<QKeySequence>());
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -948,7 +948,7 @@ void MainWindow::tabChanged(MDIView* view)
|
||||
|
||||
void MainWindow::tabCloseRequested(int index)
|
||||
{
|
||||
QTabBar* tab = d->mdiArea->findChild<QTabBar*>();
|
||||
auto tab = d->mdiArea->findChild<QTabBar*>();
|
||||
if (index < 0 || index >= tab->count())
|
||||
return;
|
||||
|
||||
@@ -982,7 +982,7 @@ void MainWindow::onWindowActivated(QMdiSubWindow* w)
|
||||
{
|
||||
if (!w)
|
||||
return;
|
||||
MDIView* view = dynamic_cast<MDIView*>(w->widget());
|
||||
auto view = dynamic_cast<MDIView*>(w->widget());
|
||||
|
||||
ParameterGrp::handle hGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/View");
|
||||
bool saveWB = hGrp->GetBool("SaveWBbyTab", false);
|
||||
@@ -1030,10 +1030,10 @@ void MainWindow::onWindowsMenuAboutToShow()
|
||||
if (firstShow) {
|
||||
firstShow = false;
|
||||
QAction* last = actions.isEmpty() ? 0 : actions.last();
|
||||
for (QList<QAction*>::Iterator it = actions.begin(); it != actions.end(); ++it) {
|
||||
if (*it == last)
|
||||
for (const auto & action : actions) {
|
||||
if (action == last)
|
||||
break; // this is a separator
|
||||
connect(*it, SIGNAL(triggered()), d->windowMapper, SLOT(map()));
|
||||
connect(action, SIGNAL(triggered()), d->windowMapper, SLOT(map()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1069,12 +1069,12 @@ void MainWindow::onWindowsMenuAboutToShow()
|
||||
|
||||
void MainWindow::onToolBarMenuAboutToShow()
|
||||
{
|
||||
QMenu* menu = static_cast<QMenu*>(sender());
|
||||
auto menu = static_cast<QMenu*>(sender());
|
||||
menu->clear();
|
||||
QList<QToolBar*> dock = this->findChildren<QToolBar*>();
|
||||
for (QList<QToolBar*>::Iterator it = dock.begin(); it != dock.end(); ++it) {
|
||||
if ((*it)->parentWidget() == this) {
|
||||
QAction* action = (*it)->toggleViewAction();
|
||||
for (const auto & it : dock) {
|
||||
if (it->parentWidget() == this) {
|
||||
QAction* action = it->toggleViewAction();
|
||||
action->setToolTip(tr("Toggles this toolbar"));
|
||||
action->setStatusTip(tr("Toggles this toolbar"));
|
||||
action->setWhatsThis(tr("Toggles this toolbar"));
|
||||
@@ -1085,11 +1085,11 @@ void MainWindow::onToolBarMenuAboutToShow()
|
||||
|
||||
void MainWindow::onDockWindowMenuAboutToShow()
|
||||
{
|
||||
QMenu* menu = static_cast<QMenu*>(sender());
|
||||
auto menu = static_cast<QMenu*>(sender());
|
||||
menu->clear();
|
||||
QList<QDockWidget*> dock = this->findChildren<QDockWidget*>();
|
||||
for (QList<QDockWidget*>::Iterator it = dock.begin(); it != dock.end(); ++it) {
|
||||
QAction* action = (*it)->toggleViewAction();
|
||||
for (auto & it : dock) {
|
||||
QAction* action = it->toggleViewAction();
|
||||
action->setToolTip(tr("Toggles this dockable window"));
|
||||
action->setStatusTip(tr("Toggles this dockable window"));
|
||||
action->setWhatsThis(tr("Toggles this dockable window"));
|
||||
@@ -1101,8 +1101,8 @@ QList<QWidget*> MainWindow::windows(QMdiArea::WindowOrder order) const
|
||||
{
|
||||
QList<QWidget*> mdis;
|
||||
QList<QMdiSubWindow*> wnds = d->mdiArea->subWindowList(order);
|
||||
for (QList<QMdiSubWindow*>::iterator it = wnds.begin(); it != wnds.end(); ++it) {
|
||||
mdis << (*it)->widget();
|
||||
for (const auto & wnd : wnds) {
|
||||
mdis << wnd->widget();
|
||||
}
|
||||
return mdis;
|
||||
}
|
||||
@@ -1122,18 +1122,18 @@ void MainWindow::closeEvent (QCloseEvent * e)
|
||||
// It is possible that closing a dialog internally closes further dialogs. Thus,
|
||||
// we have to check the pointer before.
|
||||
QVector< QPointer<QDialog> > dialogs_ptr;
|
||||
for (QList<QDialog*>::iterator it = dialogs.begin(); it != dialogs.end(); ++it) {
|
||||
dialogs_ptr.append(*it);
|
||||
for (const auto & dialog : dialogs) {
|
||||
dialogs_ptr.append(dialog);
|
||||
}
|
||||
for (QVector< QPointer<QDialog> >::iterator it = dialogs_ptr.begin(); it != dialogs_ptr.end(); ++it) {
|
||||
if (!(*it).isNull())
|
||||
(*it)->close();
|
||||
for (auto & it : dialogs_ptr) {
|
||||
if (!it.isNull())
|
||||
it->close();
|
||||
}
|
||||
QList<MDIView*> mdis = this->findChildren<MDIView*>();
|
||||
// Force to close any remaining (passive) MDI child views
|
||||
for (QList<MDIView*>::iterator it = mdis.begin(); it != mdis.end(); ++it) {
|
||||
(*it)->hide();
|
||||
(*it)->deleteLater();
|
||||
for (auto & mdi : mdis) {
|
||||
mdi->hide();
|
||||
mdi->deleteLater();
|
||||
}
|
||||
|
||||
if (Workbench* wb = WorkbenchManager::instance()->active())
|
||||
@@ -1186,13 +1186,13 @@ void MainWindow::processMessages(const QList<QByteArray> & msg)
|
||||
WaitCursor wc;
|
||||
std::list<std::string> files;
|
||||
QByteArray action("OpenFile:");
|
||||
for (QList<QByteArray>::const_iterator it = msg.begin(); it != msg.end(); ++it) {
|
||||
if (it->startsWith(action))
|
||||
files.emplace_back(it->mid(action.size()).constData());
|
||||
for (const auto & it : msg) {
|
||||
if (it.startsWith(action))
|
||||
files.emplace_back(it.mid(action.size()).constData());
|
||||
}
|
||||
files = App::Application::processFiles(files);
|
||||
for (std::list<std::string>::iterator it = files.begin(); it != files.end(); ++it) {
|
||||
QString filename = QString::fromUtf8(it->c_str(), it->size());
|
||||
for (const auto & file : files) {
|
||||
QString filename = QString::fromUtf8(file.c_str(), file.size());
|
||||
FileDialog::setWorkingDirectory(filename);
|
||||
}
|
||||
}
|
||||
@@ -1220,8 +1220,8 @@ void MainWindow::delayedStartup()
|
||||
try {
|
||||
std::list<std::string> files = App::Application::getCmdLineFiles();
|
||||
files = App::Application::processFiles(files);
|
||||
for (std::list<std::string>::iterator it = files.begin(); it != files.end(); ++it) {
|
||||
QString filename = QString::fromUtf8(it->c_str(), it->size());
|
||||
for (const auto & file : files) {
|
||||
QString filename = QString::fromUtf8(file.c_str(), file.size());
|
||||
FileDialog::setWorkingDirectory(filename);
|
||||
}
|
||||
}
|
||||
@@ -1230,7 +1230,7 @@ void MainWindow::delayedStartup()
|
||||
}
|
||||
|
||||
const std::map<std::string,std::string>& cfg = App::Application::Config();
|
||||
std::map<std::string,std::string>::const_iterator it = cfg.find("StartHidden");
|
||||
auto it = cfg.find("StartHidden");
|
||||
if (it != cfg.end()) {
|
||||
QApplication::quit();
|
||||
return;
|
||||
@@ -1253,7 +1253,7 @@ void MainWindow::delayedStartup()
|
||||
|
||||
void MainWindow::appendRecentFile(const QString& filename)
|
||||
{
|
||||
RecentFilesAction *recent = this->findChild<RecentFilesAction *>
|
||||
auto recent = this->findChild<RecentFilesAction *>
|
||||
(QString::fromLatin1("recentFiles"));
|
||||
if (recent) {
|
||||
recent->appendFile(filename);
|
||||
@@ -1262,7 +1262,7 @@ void MainWindow::appendRecentFile(const QString& filename)
|
||||
|
||||
void MainWindow::appendRecentMacro(const QString& filename)
|
||||
{
|
||||
RecentMacrosAction *recent = this->findChild<RecentMacrosAction *>
|
||||
auto recent = this->findChild<RecentMacrosAction *>
|
||||
(QString::fromLatin1("recentMacros"));
|
||||
if (recent) {
|
||||
recent->appendFile(filename);
|
||||
@@ -1330,14 +1330,14 @@ void MainWindow::updateEditorActions()
|
||||
void MainWindow::switchToTopLevelMode()
|
||||
{
|
||||
QList<QDockWidget*> dw = this->findChildren<QDockWidget*>();
|
||||
for (QList<QDockWidget*>::Iterator it = dw.begin(); it != dw.end(); ++it) {
|
||||
(*it)->setParent(nullptr, Qt::Window);
|
||||
(*it)->show();
|
||||
for (auto & it : dw) {
|
||||
it->setParent(nullptr, Qt::Window);
|
||||
it->show();
|
||||
}
|
||||
QList<QWidget*> mdi = getMainWindow()->windows();
|
||||
for (QList<QWidget*>::Iterator it = mdi.begin(); it != mdi.end(); ++it) {
|
||||
(*it)->setParent(nullptr, Qt::Window);
|
||||
(*it)->show();
|
||||
for (auto & it : mdi) {
|
||||
it->setParent(nullptr, Qt::Window);
|
||||
it->show();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1345,8 +1345,8 @@ void MainWindow::switchToDockedMode()
|
||||
{
|
||||
// Search for all top-level MDI views
|
||||
QWidgetList toplevel = QApplication::topLevelWidgets();
|
||||
for (QWidgetList::Iterator it = toplevel.begin(); it != toplevel.end(); ++it) {
|
||||
Gui::MDIView* view = qobject_cast<MDIView*>(*it);
|
||||
for (const auto & it : toplevel) {
|
||||
auto view = qobject_cast<MDIView*>(it);
|
||||
if (view)
|
||||
view->setCurrentViewMode(MDIView::Child);
|
||||
}
|
||||
@@ -1631,8 +1631,8 @@ QMimeData * MainWindow::createMimeDataFromSelection () const
|
||||
}
|
||||
|
||||
unsigned int memsize=1000; // ~ for the meta-information
|
||||
for (std::vector<App::DocumentObject*>::iterator it = sel.begin(); it != sel.end(); ++it)
|
||||
memsize += (*it)->getMemSize();
|
||||
for (const auto & it : sel)
|
||||
memsize += it->getMemSize();
|
||||
|
||||
// if less than ~10 MB
|
||||
bool use_buffer=(memsize < 0xA00000);
|
||||
@@ -1673,7 +1673,7 @@ QMimeData * MainWindow::createMimeDataFromSelection () const
|
||||
const_cast<MainWindow*>(this)->setProperty("x-documentobject-file", res);
|
||||
}
|
||||
|
||||
QMimeData *mimeData = new QMimeData();
|
||||
auto mimeData = new QMimeData();
|
||||
mimeData->setData(mime,res);
|
||||
return mimeData;
|
||||
}
|
||||
@@ -1772,15 +1772,15 @@ void MainWindow::unsetUrlHandler(const QString &scheme)
|
||||
void MainWindow::loadUrls(App::Document* doc, const QList<QUrl>& urls)
|
||||
{
|
||||
QStringList files;
|
||||
for (QList<QUrl>::ConstIterator it = urls.begin(); it != urls.end(); ++it) {
|
||||
QMap<QString, QPointer<UrlHandler> >::iterator jt = d->urlHandler.find(it->scheme());
|
||||
for (const auto & it : urls) {
|
||||
QMap<QString, QPointer<UrlHandler> >::iterator jt = d->urlHandler.find(it.scheme());
|
||||
if (jt != d->urlHandler.end() && !jt->isNull()) {
|
||||
// delegate the loading to the url handler
|
||||
(*jt)->openUrl(doc, *it);
|
||||
(*jt)->openUrl(doc, it);
|
||||
continue;
|
||||
}
|
||||
|
||||
QFileInfo info((*it).toLocalFile());
|
||||
QFileInfo info(it.toLocalFile());
|
||||
if (info.exists() && info.isFile()) {
|
||||
if (info.isSymLink())
|
||||
info.setFile(info.symLinkTarget());
|
||||
@@ -1799,13 +1799,13 @@ void MainWindow::loadUrls(App::Document* doc, const QList<QUrl>& urls)
|
||||
(const char*)info.absoluteFilePath().toUtf8());
|
||||
}
|
||||
}
|
||||
else if (it->scheme().toLower() == QLatin1String("http")) {
|
||||
else if (it.scheme().toLower() == QLatin1String("http")) {
|
||||
Gui::Dialog::DownloadManager* dm = Gui::Dialog::DownloadManager::getInstance();
|
||||
dm->download(dm->redirectUrl(*it));
|
||||
dm->download(dm->redirectUrl(it));
|
||||
}
|
||||
|
||||
else if (it->scheme().toLower() == QLatin1String("https")) {
|
||||
QUrl url = *it;
|
||||
else if (it.scheme().toLower() == QLatin1String("https")) {
|
||||
QUrl url = it;
|
||||
QUrlQuery urlq(url);
|
||||
if (urlq.hasQueryItem(QLatin1String("sid"))) {
|
||||
urlq.removeAllQueryItems(QLatin1String("sid"));
|
||||
@@ -1816,8 +1816,8 @@ void MainWindow::loadUrls(App::Document* doc, const QList<QUrl>& urls)
|
||||
dm->download(dm->redirectUrl(url));
|
||||
}
|
||||
|
||||
else if (it->scheme().toLower() == QLatin1String("ftp")) {
|
||||
Gui::Dialog::DownloadManager::getInstance()->download(*it);
|
||||
else if (it.scheme().toLower() == QLatin1String("ftp")) {
|
||||
Gui::Dialog::DownloadManager::getInstance()->download(it);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1837,8 +1837,8 @@ void MainWindow::changeEvent(QEvent *e)
|
||||
|
||||
CommandManager& rclMan = Application::Instance->commandManager();
|
||||
std::vector<Command*> cmd = rclMan.getAllCommands();
|
||||
for (std::vector<Command*>::iterator it = cmd.begin(); it != cmd.end(); ++it)
|
||||
(*it)->languageChange();
|
||||
for (auto & it : cmd)
|
||||
it->languageChange();
|
||||
|
||||
// reload current workbench to retranslate all actions and window titles
|
||||
Workbench* wb = WorkbenchManager::instance()->active();
|
||||
@@ -1848,7 +1848,7 @@ void MainWindow::changeEvent(QEvent *e)
|
||||
if (isActiveWindow()) {
|
||||
QMdiSubWindow* mdi = d->mdiArea->currentSubWindow();
|
||||
if (mdi) {
|
||||
MDIView* view = dynamic_cast<MDIView*>(mdi->widget());
|
||||
auto view = dynamic_cast<MDIView*>(mdi->widget());
|
||||
if (view && getMainWindow()->activeWindow() != view) {
|
||||
d->activeView = view;
|
||||
Application::Instance->viewActivated(view);
|
||||
@@ -1942,14 +1942,14 @@ void MainWindow::setPaneText(int i, QString text)
|
||||
void MainWindow::customEvent(QEvent* e)
|
||||
{
|
||||
if (e->type() == QEvent::User) {
|
||||
Gui::CustomMessageEvent* ce = static_cast<Gui::CustomMessageEvent*>(e);
|
||||
auto ce = static_cast<Gui::CustomMessageEvent*>(e);
|
||||
QString msg = ce->message();
|
||||
switch(ce->type()) {
|
||||
case MainWindow::Log: {
|
||||
if (msg.startsWith(QLatin1String("#Inventor V2.1 ascii "))) {
|
||||
Gui::Document *d = Application::Instance->activeDocument();
|
||||
if (d) {
|
||||
ViewProviderExtern *view = new ViewProviderExtern();
|
||||
auto view = new ViewProviderExtern();
|
||||
try {
|
||||
view->setModeByString("1",msg.toLatin1().constData());
|
||||
d->setAnnotationViewProvider("Vdbg",view);
|
||||
@@ -1970,13 +1970,13 @@ void MainWindow::customEvent(QEvent* e)
|
||||
else if (e->type() == ActionStyleEvent::EventType) {
|
||||
QList<TaskView::TaskView*> tasks = findChildren<TaskView::TaskView*>();
|
||||
if (static_cast<ActionStyleEvent*>(e)->getType() == ActionStyleEvent::Clear) {
|
||||
for (QList<TaskView::TaskView*>::iterator it = tasks.begin(); it != tasks.end(); ++it) {
|
||||
(*it)->clearActionStyle();
|
||||
for (auto & task : tasks) {
|
||||
task->clearActionStyle();
|
||||
}
|
||||
}
|
||||
else {
|
||||
for (QList<TaskView::TaskView*>::iterator it = tasks.begin(); it != tasks.end(); ++it) {
|
||||
(*it)->restoreActionStyle();
|
||||
for (auto & task : tasks) {
|
||||
task->restoreActionStyle();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2038,7 +2038,7 @@ void StatusBarObserver::SendLog(const std::string& msg, Base::LogStyle level)
|
||||
}
|
||||
|
||||
// Send the event to the main window to allow thread-safety. Qt will delete it when done.
|
||||
CustomMessageEvent* ev = new CustomMessageEvent(messageType, QString::fromUtf8(msg.c_str()));
|
||||
auto ev = new CustomMessageEvent(messageType, QString::fromUtf8(msg.c_str()));
|
||||
QApplication::postEvent(getMainWindow(), ev);
|
||||
}
|
||||
|
||||
|
||||
@@ -123,7 +123,7 @@ Py::Object MainWindowPy::getWindows(const Py::Tuple& args)
|
||||
if (_mw) {
|
||||
QList<QWidget*> windows = _mw->windows();
|
||||
for (auto it : windows) {
|
||||
MDIView* view = qobject_cast<MDIView*>(it);
|
||||
auto view = qobject_cast<MDIView*>(it);
|
||||
if (view) {
|
||||
mdis.append(Py::asObject(view->getPyObject()));
|
||||
}
|
||||
@@ -145,7 +145,7 @@ Py::Object MainWindowPy::getWindowsOfType(const Py::Tuple& args)
|
||||
if (_mw) {
|
||||
QList<QWidget*> windows = _mw->windows();
|
||||
for (auto it : windows) {
|
||||
MDIView* view = qobject_cast<MDIView*>(it);
|
||||
auto view = qobject_cast<MDIView*>(it);
|
||||
if (view && view->isDerivedFrom(typeId)) {
|
||||
mdis.append(Py::asObject(view->getPyObject()));
|
||||
}
|
||||
|
||||
+26
-26
@@ -77,7 +77,7 @@ void AlignmentGroup::addView(App::DocumentObject* pView)
|
||||
if (pView) {
|
||||
App::Document* rDoc = pView->getDocument();
|
||||
Gui::Document* pDoc = Gui::Application::Instance->getDocument(rDoc);
|
||||
Gui::ViewProviderDocumentObject* pProvider = static_cast<Gui::ViewProviderDocumentObject*>
|
||||
auto pProvider = static_cast<Gui::ViewProviderDocumentObject*>
|
||||
(pDoc->getViewProvider(pView));
|
||||
this->_views.push_back(pProvider);
|
||||
}
|
||||
@@ -149,7 +149,7 @@ void AlignmentGroup::setRandomColor()
|
||||
SoPath* selectionPath = searchAction.getPath();
|
||||
|
||||
if (selectionPath) {
|
||||
SoMaterial* material = static_cast<SoMaterial*>(selectionPath->getTail());
|
||||
auto material = static_cast<SoMaterial*>(selectionPath->getTail());
|
||||
material->diffuseColor.setValue(r, g, b);
|
||||
}
|
||||
}
|
||||
@@ -199,13 +199,13 @@ void AlignmentGroup::setAlignable(bool align)
|
||||
{
|
||||
std::vector<Gui::ViewProviderDocumentObject*>::iterator it;
|
||||
for (it = this->_views.begin(); it != this->_views.end(); ++it) {
|
||||
App::PropertyBool* pAlignMode = dynamic_cast<App::PropertyBool*>((*it)->getPropertyByName("AlignMode"));
|
||||
auto pAlignMode = dynamic_cast<App::PropertyBool*>((*it)->getPropertyByName("AlignMode"));
|
||||
if (pAlignMode) {
|
||||
pAlignMode->setValue(align);
|
||||
}
|
||||
// leaving alignment mode
|
||||
else if (!align){
|
||||
App::PropertyColor* pColor = dynamic_cast<App::PropertyColor*>((*it)->getPropertyByName("ShapeColor"));
|
||||
auto pColor = dynamic_cast<App::PropertyColor*>((*it)->getPropertyByName("ShapeColor"));
|
||||
if (pColor)
|
||||
pColor->touch(); // resets to color defined by property
|
||||
}
|
||||
@@ -243,7 +243,7 @@ Base::BoundBox3d AlignmentGroup::getBoundingBox() const
|
||||
std::vector<Gui::ViewProviderDocumentObject*>::const_iterator it;
|
||||
for (it = this->_views.begin(); it != this->_views.end(); ++it) {
|
||||
if ((*it)->isDerivedFrom(Gui::ViewProviderGeometryObject::getClassTypeId())) {
|
||||
App::GeoFeature* geo = static_cast<App::GeoFeature*>((*it)->getObject());
|
||||
auto geo = static_cast<App::GeoFeature*>((*it)->getObject());
|
||||
const App::PropertyComplexGeoData* prop = geo->getPropertyOfGeometry();
|
||||
if (prop)
|
||||
box.Add(prop->getBoundingBox());
|
||||
@@ -289,8 +289,8 @@ void MovableGroupModel::addGroup(const MovableGroup& grp)
|
||||
|
||||
void MovableGroupModel::addGroups(const std::map<int, MovableGroup>& grps)
|
||||
{
|
||||
for (std::map<int, MovableGroup>::const_iterator it = grps.begin(); it != grps.end(); ++it)
|
||||
this->_groups.push_back(it->second);
|
||||
for (const auto & grp : grps)
|
||||
this->_groups.push_back(grp.second);
|
||||
}
|
||||
|
||||
void MovableGroupModel::removeActiveGroup()
|
||||
@@ -392,8 +392,8 @@ public:
|
||||
_viewer.back()->setDocument(pcDocument);
|
||||
}
|
||||
|
||||
QFrame* vbox = new QFrame(this);
|
||||
QVBoxLayout* layout = new QVBoxLayout();
|
||||
auto vbox = new QFrame(this);
|
||||
auto layout = new QVBoxLayout();
|
||||
layout->setMargin(0);
|
||||
layout->setSpacing(0);
|
||||
vbox->setLayout(layout);
|
||||
@@ -420,8 +420,8 @@ public:
|
||||
setupSettings();
|
||||
|
||||
if (smoothing) {
|
||||
for (std::vector<int>::size_type i = 0; i != _viewer.size(); i++)
|
||||
_viewer[i]->getSoRenderManager()->getGLRenderAction()->setSmoothing(true);
|
||||
for (const auto & i : _viewer)
|
||||
i->getSoRenderManager()->getGLRenderAction()->setSmoothing(true);
|
||||
}
|
||||
|
||||
static_cast<SoGroup*>(getViewer(0)->getSoRenderManager()->getSceneGraph())->
|
||||
@@ -442,16 +442,16 @@ public:
|
||||
}
|
||||
SoNode* setupHeadUpDisplay(const QString& text) const
|
||||
{
|
||||
SoSeparator* hudRoot = new SoSeparator;
|
||||
auto hudRoot = new SoSeparator;
|
||||
hudRoot->ref();
|
||||
|
||||
SoOrthographicCamera* hudCam = new SoOrthographicCamera();
|
||||
auto hudCam = new SoOrthographicCamera();
|
||||
hudCam->viewportMapping = SoCamera::LEAVE_ALONE;
|
||||
|
||||
// Set the position in the window.
|
||||
// [0, 0] is in the center of the screen.
|
||||
//
|
||||
SoTranslation* hudTrans = new SoTranslation;
|
||||
auto hudTrans = new SoTranslation;
|
||||
hudTrans->translation.setValue(-0.95f, -0.95f, 0.0f);
|
||||
|
||||
QFont font = this->font();
|
||||
@@ -474,7 +474,7 @@ public:
|
||||
painter.end();
|
||||
SoSFImage sfimage;
|
||||
Gui::BitmapFactory().convert(image, sfimage);
|
||||
SoImage* hudImage = new SoImage();
|
||||
auto hudImage = new SoImage();
|
||||
hudImage->image = sfimage;
|
||||
|
||||
// Assemble the parts...
|
||||
@@ -575,14 +575,14 @@ public:
|
||||
static
|
||||
void syncCameraCB(void * data, SoSensor * s)
|
||||
{
|
||||
ManualAlignment* self = static_cast<ManualAlignment*>(data);
|
||||
auto self = static_cast<ManualAlignment*>(data);
|
||||
if (!self->myViewer)
|
||||
return; // already destroyed
|
||||
SoCamera* cam1 = self->myViewer->getViewer(0)->getSoRenderManager()->getCamera();
|
||||
SoCamera* cam2 = self->myViewer->getViewer(1)->getSoRenderManager()->getCamera();
|
||||
if (!cam1 || !cam2)
|
||||
return; // missing camera
|
||||
SoNodeSensor* sensor = static_cast<SoNodeSensor*>(s);
|
||||
auto sensor = static_cast<SoNodeSensor*>(s);
|
||||
SoNode* node = sensor->getAttachedNode();
|
||||
if (node && node->getTypeId().isDerivedFrom(SoCamera::getClassTypeId())) {
|
||||
if (node == cam1) {
|
||||
@@ -986,8 +986,8 @@ void ManualAlignment::align()
|
||||
if (ok && myDocument) {
|
||||
// Align views
|
||||
myDocument->openCommand(QT_TRANSLATE_NOOP("Command", "Align"));
|
||||
for (std::vector<App::DocumentObject*>::iterator it = pViews.begin(); it != pViews.end(); ++it)
|
||||
alignObject(*it);
|
||||
for (const auto & pView : pViews)
|
||||
alignObject(pView);
|
||||
myDocument->commitCommand();
|
||||
|
||||
// the alignment was successful so show it in the right view now
|
||||
@@ -1106,7 +1106,7 @@ bool ManualAlignment::computeAlignment(const std::vector<PickedPoint>& movPts,
|
||||
void ManualAlignment::alignObject(App::DocumentObject *obj)
|
||||
{
|
||||
if (obj->getTypeId().isDerivedFrom(App::GeoFeature::getClassTypeId())) {
|
||||
App::GeoFeature* geom = static_cast<App::GeoFeature*>(obj);
|
||||
auto geom = static_cast<App::GeoFeature*>(obj);
|
||||
geom->transformPlacement(this->myTransform);
|
||||
}
|
||||
}
|
||||
@@ -1131,7 +1131,7 @@ SoNode* ManualAlignment::pickedPointsSubGraph(const SbVec3f& p, const SbVec3f& n
|
||||
|
||||
int index = (id-1) % 10;
|
||||
|
||||
SoRegPoint* probe = new SoRegPoint();
|
||||
auto probe = new SoRegPoint();
|
||||
probe->base.setValue(p);
|
||||
probe->normal.setValue(n);
|
||||
probe->color.setValue(color_table[index][0],color_table[index][1],color_table[index][2]);
|
||||
@@ -1158,7 +1158,7 @@ void ManualAlignment::slotDeletedObject(const Gui::ViewProvider& Obj)
|
||||
if (Obj.getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) {
|
||||
// remove the view provider immediately from the split window
|
||||
bool found = false;
|
||||
Gui::ViewProviderDocumentObject* vp = const_cast<Gui::ViewProviderDocumentObject*>
|
||||
auto vp = const_cast<Gui::ViewProviderDocumentObject*>
|
||||
(static_cast<const Gui::ViewProviderDocumentObject*>(&Obj));
|
||||
if (myAlignModel.activeGroup().hasView(vp)) {
|
||||
myViewer->getViewer(0)->removeViewProvider(vp);
|
||||
@@ -1215,14 +1215,14 @@ void ManualAlignment::probePickedCallback(void * ud, SoEventCallback * n)
|
||||
{
|
||||
Q_UNUSED(ud);
|
||||
|
||||
Gui::View3DInventorViewer* view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
auto view = static_cast<Gui::View3DInventorViewer*>(n->getUserData());
|
||||
const SoEvent* ev = n->getEvent();
|
||||
if (ev->getTypeId() == SoMouseButtonEvent::getClassTypeId()) {
|
||||
// set as handled
|
||||
n->getAction()->setHandled();
|
||||
n->setHandled();
|
||||
|
||||
const SoMouseButtonEvent * mbe = static_cast<const SoMouseButtonEvent *>(ev);
|
||||
auto mbe = static_cast<const SoMouseButtonEvent *>(ev);
|
||||
if (mbe->getButton() == SoMouseButtonEvent::BUTTON1 && mbe->getState() == SoButtonEvent::DOWN) {
|
||||
// if we are in 'align' mode then handle the click event
|
||||
ManualAlignment* self = ManualAlignment::instance();
|
||||
@@ -1231,9 +1231,9 @@ void ManualAlignment::probePickedCallback(void * ud, SoEventCallback * n)
|
||||
Gui::WaitCursor wc;
|
||||
const SoPickedPoint * point = view->getPickedPoint(n);
|
||||
if (point) {
|
||||
Gui::ViewProvider* vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
|
||||
auto vp = static_cast<Gui::ViewProvider*>(view->getViewProviderByPath(point->getPath()));
|
||||
if (vp && vp->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) {
|
||||
Gui::ViewProviderDocumentObject* that = static_cast<Gui::ViewProviderDocumentObject*>(vp);
|
||||
auto that = static_cast<Gui::ViewProviderDocumentObject*>(vp);
|
||||
if (self->applyPickedProbe(that, point)) {
|
||||
const SbVec3f& vec = point->getPoint();
|
||||
Gui::getMainWindow()->showMessage(
|
||||
|
||||
@@ -185,7 +185,7 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
//before this block, mouse button states in NavigationStyle::buttonXdown reflected those before current event arrived.
|
||||
//track mouse button states
|
||||
if (evIsButton) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
auto const event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press //the button was pressed (if false -> released)
|
||||
= event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
@@ -226,7 +226,7 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
//track gestures
|
||||
if (evIsGesture) {
|
||||
const SoGestureEvent* gesture = static_cast<const SoGestureEvent*>(ev);
|
||||
auto gesture = static_cast<const SoGestureEvent*>(ev);
|
||||
switch(gesture->state) {
|
||||
case SoGestureEvent::SbGSStart:
|
||||
//assert(!inGesture);//start of another gesture before the first finished? Happens all the time for Pan gesture... No idea why! --DeepSOIC
|
||||
@@ -277,7 +277,7 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Mode-independent keyboard handling
|
||||
if (evIsKeyboard) {
|
||||
const SoKeyboardEvent * const event = (const SoKeyboardEvent *) ev;
|
||||
auto const event = (const SoKeyboardEvent *) ev;
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
switch (event->getKey()) {
|
||||
case SoKeyboardEvent::H:
|
||||
@@ -300,7 +300,7 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
//mode-independent spaceball/joystick handling
|
||||
if (evIsLoc3) {
|
||||
const SoMotion3Event * const event = static_cast<const SoMotion3Event *>(ev);
|
||||
auto const event = static_cast<const SoMotion3Event *>(ev);
|
||||
if (event)
|
||||
this->processMotionEvent(event);
|
||||
processed = true;
|
||||
@@ -317,7 +317,7 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
//keyboard
|
||||
if (evIsKeyboard) {
|
||||
const SoKeyboardEvent * const event = (const SoKeyboardEvent *) ev;
|
||||
auto const event = (const SoKeyboardEvent *) ev;
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
switch(event->getKey()){
|
||||
@@ -352,7 +352,7 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Mouse Button / Spaceball Button handling
|
||||
if (evIsButton) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
auto const event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press //the button was pressed (if false -> released)
|
||||
= event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
@@ -445,7 +445,7 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
//gesture start
|
||||
if (evIsGesture && /*!this->button1down &&*/ !this->button2down){//ignore gestures when mouse buttons are down. Button1down check was disabled because of wrong state after doubleclick on sketcher constraint to edit datum
|
||||
const SoGestureEvent* gesture = static_cast<const SoGestureEvent*>(ev);
|
||||
auto gesture = static_cast<const SoGestureEvent*>(ev);
|
||||
if (gesture->state == SoGestureEvent::SbGSStart
|
||||
|| gesture->state == SoGestureEvent::SbGSUpdate) {//even if we didn't get a start, assume the first update is a start (sort-of fail-safe).
|
||||
if (type.isDerivedFrom(SoGesturePanEvent::getClassTypeId())) {
|
||||
@@ -472,7 +472,7 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Mouse Button / Spaceball Button handling
|
||||
if (evIsButton) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
auto const event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
switch(button){
|
||||
case SoMouseButtonEvent::BUTTON1:
|
||||
@@ -520,14 +520,14 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
//the essence part 2!
|
||||
//gesture into camera motion
|
||||
if (evIsGesture){
|
||||
const SoGestureEvent* gesture = static_cast<const SoGestureEvent*>(ev);
|
||||
auto gesture = static_cast<const SoGestureEvent*>(ev);
|
||||
assert(gesture);
|
||||
if (gesture->state == SoGestureEvent::SbGSEnd) {
|
||||
setViewingMode(NavigationStyle::SELECTION);
|
||||
processed=true;
|
||||
} else if (gesture->state == SoGestureEvent::SbGSUpdate){
|
||||
if(type.isDerivedFrom(SoGesturePinchEvent::getClassTypeId())){
|
||||
const SoGesturePinchEvent* const event = static_cast<const SoGesturePinchEvent*>(ev);
|
||||
auto const event = static_cast<const SoGesturePinchEvent*>(ev);
|
||||
if (this->zoomAtCursor){
|
||||
//this is just dealing with the pan part of pinch gesture. Taking care of zooming to pos is done in doZoom.
|
||||
SbVec2f panDist = this->normalizePixelPos(event->deltaCenter.getValue());
|
||||
@@ -539,7 +539,7 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
processed = true;
|
||||
}
|
||||
if(type.isDerivedFrom(SoGesturePanEvent::getClassTypeId())){
|
||||
const SoGesturePanEvent* const event = static_cast<const SoGesturePanEvent*>(ev);
|
||||
auto const event = static_cast<const SoGesturePanEvent*>(ev);
|
||||
//this is just dealing with the pan part of pinch gesture. Taking care of zooming to pos is done in doZoom.
|
||||
SbVec2f panDist = this->normalizePixelPos(event->deltaOffset);
|
||||
NavigationStyle::panCamera(viewer->getSoRenderManager()->getCamera(), ratio, this->panningplane, panDist, SbVec2f(0,0));
|
||||
@@ -555,7 +555,7 @@ SbBool MayaGestureNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
} break;//end of actual navigation
|
||||
case NavigationStyle::SEEK_WAIT_MODE:{
|
||||
if (evIsButton) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
auto const event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
if (button == SoMouseButtonEvent::BUTTON1 && press) {
|
||||
|
||||
@@ -103,7 +103,7 @@ MenuItem* MenuItem::findParentOf(const std::string& name)
|
||||
|
||||
MenuItem* MenuItem::copy() const
|
||||
{
|
||||
MenuItem* root = new MenuItem;
|
||||
auto root = new MenuItem;
|
||||
root->setCommand(command());
|
||||
|
||||
QList<MenuItem*> items = getItems();
|
||||
@@ -161,7 +161,7 @@ void MenuItem::clear()
|
||||
|
||||
MenuItem& MenuItem::operator << (const std::string& command)
|
||||
{
|
||||
MenuItem* item = new MenuItem(this);
|
||||
auto item = new MenuItem(this);
|
||||
item->setCommand(command);
|
||||
return *this;
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ int AbstractMouseSelection::handleEvent(const SoEvent* const ev, const SbViewpor
|
||||
y = h-y; // the origin is at the left bottom corner (instead of left top corner)
|
||||
|
||||
if (ev->getTypeId().isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent* const event = (const SoMouseButtonEvent*) ev;
|
||||
const auto event = (const SoMouseButtonEvent*) ev;
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
if (press) {
|
||||
|
||||
+11
-11
@@ -420,7 +420,7 @@ GLuint NaviCubeImplementation::createCubeFaceTex(QtGLWidget* gl, float gap, cons
|
||||
|
||||
paint.end();
|
||||
Q_UNUSED(gl);
|
||||
QOpenGLTexture* texture = new QOpenGLTexture(image.mirrored());
|
||||
auto texture = new QOpenGLTexture(image.mirrored());
|
||||
m_glTextures.push_back(texture);
|
||||
texture->generateMipMaps();
|
||||
texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
|
||||
@@ -526,7 +526,7 @@ GLuint NaviCubeImplementation::createButtonTex(QtGLWidget* gl, int button) {
|
||||
//image.save(str(enum2str(button))+str(".png"));
|
||||
|
||||
Q_UNUSED(gl);
|
||||
QOpenGLTexture* texture = new QOpenGLTexture(image.mirrored());
|
||||
auto texture = new QOpenGLTexture(image.mirrored());
|
||||
m_glTextures.push_back(texture);
|
||||
texture->generateMipMaps();
|
||||
texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
|
||||
@@ -599,7 +599,7 @@ GLuint NaviCubeImplementation::createMenuTex(QtGLWidget* gl, bool forPicking) {
|
||||
}
|
||||
painter.end();
|
||||
Q_UNUSED(gl);
|
||||
QOpenGLTexture* texture = new QOpenGLTexture(image.mirrored());
|
||||
auto texture = new QOpenGLTexture(image.mirrored());
|
||||
m_glTextures.push_back(texture);
|
||||
texture->generateMipMaps();
|
||||
texture->setMinificationFilter(QOpenGLTexture::LinearMipMapLinear);
|
||||
@@ -852,8 +852,8 @@ void NaviCubeImplementation::createContextMenu(const std::vector<std::string>& c
|
||||
CommandManager& rcCmdMgr = Application::Instance->commandManager();
|
||||
m_Menu->clear();
|
||||
|
||||
for (vector<string>::const_iterator i = cmd.begin(); i != cmd.end(); i++) {
|
||||
Command* cmd = rcCmdMgr.getCommandByName(i->c_str());
|
||||
for (const auto & i : cmd) {
|
||||
Command* cmd = rcCmdMgr.getCommandByName(i.c_str());
|
||||
if (cmd)
|
||||
cmd->addTo(m_Menu);
|
||||
}
|
||||
@@ -902,7 +902,7 @@ void NaviCubeImplementation::drawNaviCube(bool pickMode) {
|
||||
// initializes stuff here when we actually have a context
|
||||
// FIXME actually now that we have Qt5, we could probably do this earlier (as we do not need the opengl context)
|
||||
if (!m_NaviCubeInitialised) {
|
||||
QtGLWidget* gl = static_cast<QtGLWidget*>(m_View3DInventorViewer->viewport());
|
||||
auto gl = static_cast<QtGLWidget*>(m_View3DInventorViewer->viewport());
|
||||
if (!gl)
|
||||
return;
|
||||
initNaviCube(gl);
|
||||
@@ -1662,7 +1662,7 @@ bool NaviCubeImplementation::processSoEvent(const SoEvent* ev) {
|
||||
// y += 4;
|
||||
// x -= 2;
|
||||
if (ev->getTypeId().isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent* mbev = static_cast<const SoMouseButtonEvent*>(ev);
|
||||
const auto mbev = static_cast<const SoMouseButtonEvent*>(ev);
|
||||
if (mbev->isButtonPressEvent(mbev, SoMouseButtonEvent::BUTTON1))
|
||||
return mousePressed(x, y);
|
||||
if (mbev->isButtonReleaseEvent(mbev, SoMouseButtonEvent::BUTTON1))
|
||||
@@ -1774,7 +1774,7 @@ void ViewZoomToFitCmd::activated(int iMsg)
|
||||
|
||||
|
||||
QMenu* NaviCubeImplementation::createNaviCubeMenu() {
|
||||
QMenu* menu = new QMenu(getMainWindow());
|
||||
auto menu = new QMenu(getMainWindow());
|
||||
menu->setObjectName(str("NaviCube_Menu"));
|
||||
|
||||
CommandManager& rcCmdMgr = Application::Instance->commandManager();
|
||||
@@ -1796,12 +1796,12 @@ QMenu* NaviCubeImplementation::createNaviCubeMenu() {
|
||||
commands.emplace_back("ViewZoomToFit");
|
||||
}
|
||||
|
||||
for (vector<string>::iterator i = commands.begin(); i != commands.end(); ++i) {
|
||||
if (*i == "Separator") {
|
||||
for (const auto & command : commands) {
|
||||
if (command == "Separator") {
|
||||
menu->addSeparator();
|
||||
}
|
||||
else {
|
||||
Command* cmd = rcCmdMgr.getCommandByName(i->c_str());
|
||||
Command* cmd = rcCmdMgr.getCommandByName(command.c_str());
|
||||
if (cmd)
|
||||
cmd->addTo(menu);
|
||||
}
|
||||
|
||||
+23
-23
@@ -282,13 +282,13 @@ int NavigationStyle::getInteractiveCount() const
|
||||
|
||||
void NavigationStyle::setOrbitStyle(NavigationStyle::OrbitStyle style)
|
||||
{
|
||||
FCSphereSheetProjector* projector = static_cast<FCSphereSheetProjector*>(this->spinprojector);
|
||||
auto projector = static_cast<FCSphereSheetProjector*>(this->spinprojector);
|
||||
projector->setOrbitStyle(FCSphereSheetProjector::OrbitStyle(style));
|
||||
}
|
||||
|
||||
NavigationStyle::OrbitStyle NavigationStyle::getOrbitStyle() const
|
||||
{
|
||||
FCSphereSheetProjector* projector = static_cast<FCSphereSheetProjector*>(this->spinprojector);
|
||||
auto projector = static_cast<FCSphereSheetProjector*>(this->spinprojector);
|
||||
return NavigationStyle::OrbitStyle(projector->getOrbitStyle());
|
||||
}
|
||||
|
||||
@@ -477,7 +477,7 @@ void NavigationStyle::setCameraOrientation(const SbRotation& rot, SbBool moveToC
|
||||
void NavigationStyleP::viewAnimationCB(void * data, SoSensor * sensor)
|
||||
{
|
||||
Q_UNUSED(sensor);
|
||||
NavigationStyle* that = static_cast<NavigationStyle*>(data);
|
||||
auto that = static_cast<NavigationStyle*>(data);
|
||||
if (PRIVATE(that)->animationsteps > 0) {
|
||||
// here the camera rotates from the current rotation to a given
|
||||
// rotation (e.g. the standard views). To get this movement animated
|
||||
@@ -584,7 +584,7 @@ void NavigationStyle::viewAll()
|
||||
float aspect = cam->aspectRatio.getValue();
|
||||
|
||||
if (cam->getTypeId() == SoOrthographicCamera::getClassTypeId()) {
|
||||
SoOrthographicCamera* ocam = (SoOrthographicCamera *)cam; // safe downward cast, knows the type
|
||||
auto ocam = (SoOrthographicCamera *)cam; // safe downward cast, knows the type
|
||||
if (aspect < 1.0f)
|
||||
ocam->height = cam_height / aspect;
|
||||
else
|
||||
@@ -684,7 +684,7 @@ void NavigationStyle::zoom(SoCamera * cam, float diffvalue)
|
||||
SbName tname = t.getName();
|
||||
|
||||
// This will be in the range of <0, ->>.
|
||||
float multiplicator = float(exp(diffvalue));
|
||||
auto multiplicator = float(exp(diffvalue));
|
||||
|
||||
if (t.isDerivedFrom(SoOrthographicCamera::getClassTypeId())) {
|
||||
|
||||
@@ -692,7 +692,7 @@ void NavigationStyle::zoom(SoCamera * cam, float diffvalue)
|
||||
// of the word won't have any visible effect. So we just increase
|
||||
// or decrease the field-of-view values of the camera instead, to
|
||||
// "shrink" the projection size of the model / scene.
|
||||
SoOrthographicCamera * oc = (SoOrthographicCamera *)cam;
|
||||
auto oc = (SoOrthographicCamera *)cam;
|
||||
oc->height = oc->height.getValue() * multiplicator;
|
||||
|
||||
}
|
||||
@@ -1072,8 +1072,8 @@ void NavigationStyle::saveCursorPosition(const SoEvent * const ev)
|
||||
SbViewVolume vv = cam->getViewVolume(ratio);
|
||||
vv.projectToScreen(boundingBoxCenter, boundingBoxCenter);
|
||||
SbVec2s size = vp.getViewportSizePixels();
|
||||
short tox = static_cast<short>(boundingBoxCenter[0] * size[0]);
|
||||
short toy = static_cast<short>(boundingBoxCenter[1] * size[1]);
|
||||
auto tox = static_cast<short>(boundingBoxCenter[0] * size[0]);
|
||||
auto toy = static_cast<short>(boundingBoxCenter[1] * size[1]);
|
||||
this->localPos.setValue(tox, toy);
|
||||
}
|
||||
}
|
||||
@@ -1479,7 +1479,7 @@ SbBool NavigationStyle::processEvent(const SoEvent * const ev)
|
||||
if ((curmode == NavigationStyle::SELECTION || curmode == NavigationStyle::IDLE)
|
||||
&& !processed) {
|
||||
if (ev->getTypeId().isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
SoMouseButtonEvent * const e = (SoMouseButtonEvent *) ev;
|
||||
auto const e = (SoMouseButtonEvent *) ev;
|
||||
if (SoMouseButtonEvent::isButtonReleaseEvent(e,SoMouseButtonEvent::BUTTON1)) {
|
||||
Gui::Selection().clearSelection();
|
||||
}
|
||||
@@ -1496,7 +1496,7 @@ SbBool NavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
//handle mouse wheel zoom
|
||||
if (ev->isOfType(SoMouseWheelEvent::getClassTypeId())) {
|
||||
const SoMouseWheelEvent * const event = static_cast<const SoMouseWheelEvent *>(ev);
|
||||
auto const event = static_cast<const SoMouseWheelEvent *>(ev);
|
||||
processed = processWheelEvent(event);
|
||||
viewer->processSoEventBase(ev);
|
||||
offeredtoViewerEventBase = true;
|
||||
@@ -1526,7 +1526,7 @@ void NavigationStyle::syncWithEvent(const SoEvent * const ev)
|
||||
|
||||
// Keyboard handling
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
const SoKeyboardEvent * const event = (const SoKeyboardEvent *) ev;
|
||||
auto const event = (const SoKeyboardEvent *) ev;
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
switch (event->getKey()) {
|
||||
case SoKeyboardEvent::LEFT_CONTROL:
|
||||
@@ -1548,7 +1548,7 @@ void NavigationStyle::syncWithEvent(const SoEvent * const ev)
|
||||
|
||||
// Mouse Button / Spaceball Button handling
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
auto const event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
@@ -1583,7 +1583,7 @@ SbBool NavigationStyle::processMotionEvent(const SoMotion3Event * const ev)
|
||||
SbVec3f dir = ev->getTranslation();
|
||||
|
||||
if (camera->getTypeId().isDerivedFrom(SoOrthographicCamera::getClassTypeId())){
|
||||
SoOrthographicCamera *oCam = static_cast<SoOrthographicCamera *>(camera);
|
||||
auto oCam = static_cast<SoOrthographicCamera *>(camera);
|
||||
oCam->scaleHeight(1.0 + (dir[2] * 0.0001));
|
||||
dir[2] = 0.0;//don't move the cam for z translation.
|
||||
}
|
||||
@@ -1713,7 +1713,7 @@ void NavigationStyle::openPopupMenu(const SbVec2s& position)
|
||||
{
|
||||
Q_UNUSED(position);
|
||||
// ask workbenches and view provider, ...
|
||||
MenuItem* view = new MenuItem;
|
||||
auto view = new MenuItem;
|
||||
Gui::Application::Instance->setupContextMenu("View", view);
|
||||
|
||||
QMenu contextMenu(viewer->getGLWidget());
|
||||
@@ -1727,14 +1727,14 @@ void NavigationStyle::openPopupMenu(const SbVec2s& position)
|
||||
|
||||
// add submenu at the end to select navigation style
|
||||
std::map<Base::Type, std::string> styles = UserNavigationStyle::getUserFriendlyNames();
|
||||
for (std::map<Base::Type, std::string>::iterator it = styles.begin(); it != styles.end(); ++it) {
|
||||
QByteArray data(it->first.getName());
|
||||
QString name = QApplication::translate(it->first.getName(), it->second.c_str());
|
||||
for (const auto & style : styles) {
|
||||
QByteArray data(style.first.getName());
|
||||
QString name = QApplication::translate(style.first.getName(), style.second.c_str());
|
||||
|
||||
QAction* item = subMenuGroup.addAction(name);
|
||||
item->setData(data);
|
||||
item->setCheckable(true);
|
||||
if (it->first == this->getTypeId())
|
||||
if (style.first == this->getTypeId())
|
||||
item->setChecked(true);
|
||||
subMenu.addAction(item);
|
||||
}
|
||||
@@ -1782,11 +1782,11 @@ std::map<Base::Type, std::string> UserNavigationStyle::getUserFriendlyNames()
|
||||
std::vector<Base::Type> types;
|
||||
Base::Type::getAllDerivedFrom(UserNavigationStyle::getClassTypeId(), types);
|
||||
|
||||
for (std::vector<Base::Type>::iterator it = types.begin(); it != types.end(); ++it) {
|
||||
if (*it != UserNavigationStyle::getClassTypeId()) {
|
||||
std::unique_ptr<UserNavigationStyle> inst(static_cast<UserNavigationStyle*>(it->createInstance()));
|
||||
if (inst.get()) {
|
||||
names[*it] = inst->userFriendlyName();
|
||||
for (auto & type : types) {
|
||||
if (type != UserNavigationStyle::getClassTypeId()) {
|
||||
std::unique_ptr<UserNavigationStyle> inst(static_cast<UserNavigationStyle*>(type.createInstance()));
|
||||
if (inst) {
|
||||
names[type] = inst->userFriendlyName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -287,7 +287,7 @@ void HttpServer::incomingConnection(qintptr socket)
|
||||
// communication with the client is done over this QTcpSocket. QTcpSocket
|
||||
// works asynchronously, this means that all the communication is done
|
||||
// in the two slots readClient() and discardClient().
|
||||
QTcpSocket* s = new QTcpSocket(this);
|
||||
auto s = new QTcpSocket(this);
|
||||
connect(s, SIGNAL(readyRead()), this, SLOT(readClient()));
|
||||
connect(s, SIGNAL(disconnected()), this, SLOT(discardClient()));
|
||||
s->setSocketDescriptor(socket);
|
||||
@@ -311,7 +311,7 @@ void HttpServer::readClient()
|
||||
// This slot is called when the client sent data to the server. The
|
||||
// server looks if it was a GET request and sends back the
|
||||
// corresponding HTML document from the ZIP file.
|
||||
QTcpSocket* socket = (QTcpSocket*)sender();
|
||||
auto socket = (QTcpSocket*)sender();
|
||||
if (socket->canReadLine()) {
|
||||
QString httpRequestHeader = QString::fromLatin1(socket->readLine());
|
||||
QStringList lst = httpRequestHeader.simplified().split(QLatin1String(" "));
|
||||
@@ -345,7 +345,7 @@ void HttpServer::readClient()
|
||||
|
||||
void HttpServer::discardClient()
|
||||
{
|
||||
QTcpSocket* socket = (QTcpSocket*)sender();
|
||||
auto socket = (QTcpSocket*)sender();
|
||||
socket->deleteLater();
|
||||
}
|
||||
|
||||
|
||||
@@ -105,13 +105,13 @@ SbBool OpenCascadeNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Keyboard handling
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
const SoKeyboardEvent * const event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
auto const event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
processed = processKeyboardEvent(event);
|
||||
}
|
||||
|
||||
// Mouse Button / Spaceball Button handling
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
const auto event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
@@ -206,7 +206,7 @@ SbBool OpenCascadeNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
// Mouse Movement handling
|
||||
if (type.isDerivedFrom(SoLocation2Event::getClassTypeId())) {
|
||||
this->lockrecenter = true;
|
||||
const SoLocation2Event * const event = (const SoLocation2Event *) ev;
|
||||
const auto event = (const SoLocation2Event *) ev;
|
||||
if (this->currentmode == NavigationStyle::ZOOMING) {
|
||||
// OCCT uses horizontal mouse position, not vertical
|
||||
// this->zoomByCursor(posn, prevnormalized);
|
||||
@@ -234,7 +234,7 @@ SbBool OpenCascadeNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Spaceball & Joystick handling
|
||||
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
|
||||
const SoMotion3Event * const event = static_cast<const SoMotion3Event *>(ev);
|
||||
const auto event = static_cast<const SoMotion3Event *>(ev);
|
||||
if (event)
|
||||
this->processMotionEvent(event);
|
||||
processed = true;
|
||||
|
||||
@@ -105,13 +105,13 @@ SbBool OpenSCADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Keyboard handling
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
const SoKeyboardEvent * const event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
const auto event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
processed = processKeyboardEvent(event);
|
||||
}
|
||||
|
||||
// Mouse Button / Spaceball Button handling
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
const auto event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
@@ -192,7 +192,7 @@ SbBool OpenSCADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
// Mouse Movement handling
|
||||
if (type.isDerivedFrom(SoLocation2Event::getClassTypeId())) {
|
||||
this->lockrecenter = true;
|
||||
const SoLocation2Event * const event = (const SoLocation2Event *) ev;
|
||||
const auto event = (const SoLocation2Event *) ev;
|
||||
if (curmode == NavigationStyle::SELECTION) {
|
||||
newmode = NavigationStyle::DRAGGING;
|
||||
saveCursorPosition(ev);
|
||||
@@ -222,7 +222,7 @@ SbBool OpenSCADNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Spaceball & Joystick handling
|
||||
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
|
||||
const SoMotion3Event * const event = static_cast<const SoMotion3Event *>(ev);
|
||||
const auto event = static_cast<const SoMotion3Event *>(ev);
|
||||
if (event)
|
||||
this->processMotionEvent(event);
|
||||
processed = true;
|
||||
|
||||
+31
-31
@@ -113,9 +113,9 @@ Placement::Placement(QWidget* parent, Qt::WindowFlags fl)
|
||||
|
||||
int id = 1;
|
||||
QList<Gui::QuantitySpinBox*> sb = this->findChildren<Gui::QuantitySpinBox*>();
|
||||
for (QList<Gui::QuantitySpinBox*>::iterator it = sb.begin(); it != sb.end(); ++it) {
|
||||
connect(*it, SIGNAL(valueChanged(double)), signalMapper, SLOT(map()));
|
||||
signalMapper->setMapping(*it, id++);
|
||||
for (const auto & it : sb) {
|
||||
connect(it, SIGNAL(valueChanged(double)), signalMapper, SLOT(map()));
|
||||
signalMapper->setMapping(it, id++);
|
||||
}
|
||||
|
||||
connect(signalMapper, SIGNAL(mapped(int)),
|
||||
@@ -178,33 +178,33 @@ void Placement::openTransaction()
|
||||
QWidget* Placement::getInvalidInput() const
|
||||
{
|
||||
QList<Gui::QuantitySpinBox*> sb = this->findChildren<Gui::QuantitySpinBox*>();
|
||||
for (QList<Gui::QuantitySpinBox*>::iterator it = sb.begin(); it != sb.end(); ++it) {
|
||||
if (!(*it)->hasValidInput())
|
||||
return (*it);
|
||||
for (const auto & it : sb) {
|
||||
if (!it->hasValidInput())
|
||||
return it;
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void Placement::revertTransformation()
|
||||
{
|
||||
for (std::set<std::string>::iterator it = documents.begin(); it != documents.end(); ++it) {
|
||||
Gui::Document* document = Application::Instance->getDocument(it->c_str());
|
||||
for (const auto & it : documents) {
|
||||
Gui::Document* document = Application::Instance->getDocument(it.c_str());
|
||||
if (!document) continue;
|
||||
|
||||
if (!changeProperty) {
|
||||
std::vector<App::DocumentObject*> obj = document->getDocument()->
|
||||
getObjectsOfType(App::DocumentObject::getClassTypeId());
|
||||
if (!obj.empty()) {
|
||||
for (std::vector<App::DocumentObject*>::iterator it=obj.begin();it!=obj.end();++it) {
|
||||
for (const auto & it : obj) {
|
||||
std::map<std::string,App::Property*> props;
|
||||
(*it)->getPropertyMap(props);
|
||||
it->getPropertyMap(props);
|
||||
// search for the placement property
|
||||
std::map<std::string,App::Property*>::iterator jt;
|
||||
jt = std::find_if(props.begin(), props.end(), find_placement(this->propertyName));
|
||||
if (jt != props.end()) {
|
||||
App::PropertyPlacement* property = static_cast<App::PropertyPlacement*>(jt->second);
|
||||
auto property = static_cast<App::PropertyPlacement*>(jt->second);
|
||||
Base::Placement cur = property->getValue();
|
||||
Gui::ViewProvider* vp = document->getViewProvider(*it);
|
||||
Gui::ViewProvider* vp = document->getViewProvider(it);
|
||||
if (vp) vp->setTransformation(cur.toMatrix());
|
||||
}
|
||||
}
|
||||
@@ -226,14 +226,14 @@ void Placement::applyPlacement(const Base::Placement& p, bool incremental)
|
||||
(App::DocumentObject::getClassTypeId(), document->getDocument()->getName());
|
||||
if (!sel.empty()) {
|
||||
// apply transformation only on view matrix not on placement property
|
||||
for (std::vector<App::DocumentObject*>::iterator it=sel.begin();it!=sel.end();++it) {
|
||||
for (const auto & it : sel) {
|
||||
std::map<std::string,App::Property*> props;
|
||||
(*it)->getPropertyMap(props);
|
||||
it->getPropertyMap(props);
|
||||
// search for the placement property
|
||||
std::map<std::string,App::Property*>::iterator jt;
|
||||
jt = std::find_if(props.begin(), props.end(), find_placement(this->propertyName));
|
||||
if (jt != props.end()) {
|
||||
App::PropertyPlacement* property = static_cast<App::PropertyPlacement*>(jt->second);
|
||||
auto property = static_cast<App::PropertyPlacement*>(jt->second);
|
||||
Base::Placement cur = property->getValue();
|
||||
if (incremental)
|
||||
cur = p * cur;
|
||||
@@ -241,7 +241,7 @@ void Placement::applyPlacement(const Base::Placement& p, bool incremental)
|
||||
cur = p;
|
||||
|
||||
if (!changeProperty) {
|
||||
Gui::ViewProvider* vp = document->getViewProvider(*it);
|
||||
Gui::ViewProvider* vp = document->getViewProvider(it);
|
||||
if (vp) vp->setTransformation(cur.toMatrix());
|
||||
}
|
||||
else {
|
||||
@@ -277,9 +277,9 @@ void Placement::applyPlacement(const QString& data, bool incremental)
|
||||
(App::DocumentObject::getClassTypeId(), document->getDocument()->getName());
|
||||
if (!sel.empty()) {
|
||||
document->openCommand(QT_TRANSLATE_NOOP("Command", "Placement"));
|
||||
for (std::vector<App::DocumentObject*>::iterator it=sel.begin();it!=sel.end();++it) {
|
||||
for (const auto & it : sel) {
|
||||
std::map<std::string,App::Property*> props;
|
||||
(*it)->getPropertyMap(props);
|
||||
it->getPropertyMap(props);
|
||||
// search for the placement property
|
||||
std::map<std::string,App::Property*>::iterator jt;
|
||||
jt = std::find_if(props.begin(), props.end(), find_placement(this->propertyName));
|
||||
@@ -288,15 +288,15 @@ void Placement::applyPlacement(const QString& data, bool incremental)
|
||||
if (incremental)
|
||||
cmd = QString::fromLatin1(
|
||||
"App.getDocument(\"%1\").%2.%3=%4.multiply(App.getDocument(\"%1\").%2.%3)")
|
||||
.arg(QString::fromLatin1((*it)->getDocument()->getName()),
|
||||
QString::fromLatin1((*it)->getNameInDocument()),
|
||||
.arg(QString::fromLatin1(it->getDocument()->getName()),
|
||||
QString::fromLatin1(it->getNameInDocument()),
|
||||
QString::fromLatin1(this->propertyName.c_str()),
|
||||
data);
|
||||
else {
|
||||
cmd = QString::fromLatin1(
|
||||
"App.getDocument(\"%1\").%2.%3=%4")
|
||||
.arg(QString::fromLatin1((*it)->getDocument()->getName()),
|
||||
QString::fromLatin1((*it)->getNameInDocument()),
|
||||
.arg(QString::fromLatin1(it->getDocument()->getName()),
|
||||
QString::fromLatin1(it->getNameInDocument()),
|
||||
QString::fromLatin1(this->propertyName.c_str()),
|
||||
data);
|
||||
}
|
||||
@@ -369,7 +369,7 @@ void Placement::on_selectedVertex_clicked()
|
||||
//combine all pickedpoints into single vector
|
||||
//even if points are from separate objects
|
||||
Base::Vector3d firstSelected; //first selected will be central point when 3 points picked
|
||||
for (std::vector<Gui::SelectionObject>::iterator it=selection.begin(); it!=selection.end(); ++it){
|
||||
for (auto it=selection.begin(); it!=selection.end(); ++it){
|
||||
std::vector<Base::Vector3d> points = it->getPickedPoints();
|
||||
if (it==selection.begin() && !points.empty()){
|
||||
firstSelected=points[0];
|
||||
@@ -615,10 +615,10 @@ bool Placement::onApply()
|
||||
|
||||
if (ui->applyIncrementalPlacement->isChecked()) {
|
||||
QList<Gui::QuantitySpinBox*> sb = this->findChildren<Gui::QuantitySpinBox*>();
|
||||
for (QList<Gui::QuantitySpinBox*>::iterator it = sb.begin(); it != sb.end(); ++it) {
|
||||
(*it)->blockSignals(true);
|
||||
(*it)->setValue(0);
|
||||
(*it)->blockSignals(false);
|
||||
for (auto & it : sb) {
|
||||
it->blockSignals(true);
|
||||
it->setValue(0);
|
||||
it->blockSignals(false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -631,10 +631,10 @@ bool Placement::onApply()
|
||||
void Placement::on_resetButton_clicked()
|
||||
{
|
||||
QList<Gui::QuantitySpinBox*> sb = this->findChildren<Gui::QuantitySpinBox*>();
|
||||
for (QList<Gui::QuantitySpinBox*>::iterator it = sb.begin(); it != sb.end(); ++it) {
|
||||
(*it)->blockSignals(true);
|
||||
(*it)->setValue(0);
|
||||
(*it)->blockSignals(false);
|
||||
for (auto & it : sb) {
|
||||
it->blockSignals(true);
|
||||
it->setValue(0);
|
||||
it->blockSignals(false);
|
||||
}
|
||||
|
||||
onPlacementChanged(0);
|
||||
|
||||
@@ -494,7 +494,7 @@ void PrefColorButton::restorePreferences()
|
||||
|
||||
unsigned int icol = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8);
|
||||
|
||||
unsigned long lcol = static_cast<unsigned long>(icol);
|
||||
auto lcol = static_cast<unsigned long>(icol);
|
||||
lcol = getWindowParameter()->GetUnsigned( entryName(), lcol );
|
||||
icol = static_cast<unsigned int>(lcol);
|
||||
int r = (icol >> 24)&0xff;
|
||||
@@ -515,7 +515,7 @@ void PrefColorButton::savePreferences()
|
||||
QColor col = color();
|
||||
// (r,g,b,a) with a = 255 (opaque)
|
||||
unsigned int icol = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8) | 255;
|
||||
unsigned long lcol = static_cast<unsigned long>(icol);
|
||||
auto lcol = static_cast<unsigned long>(icol);
|
||||
getWindowParameter()->SetUnsigned( entryName(), lcol );
|
||||
}
|
||||
|
||||
|
||||
@@ -70,10 +70,10 @@ struct ProgressBarPrivate
|
||||
parent = QWidget::find(window->winId());
|
||||
}
|
||||
while (parent) {
|
||||
QMessageBox* dlg = qobject_cast<QMessageBox*>(parent);
|
||||
auto* dlg = qobject_cast<QMessageBox*>(parent);
|
||||
if (dlg && dlg->isModal())
|
||||
return true;
|
||||
QProgressDialog* pd = qobject_cast<QProgressDialog*>(parent);
|
||||
auto* pd = qobject_cast<QProgressDialog*>(parent);
|
||||
if (pd)
|
||||
return true;
|
||||
parent = parent->parentWidget();
|
||||
@@ -558,7 +558,7 @@ bool ProgressBar::eventFilter(QObject* o, QEvent* e)
|
||||
QThread* thr = this->thread(); // this is the main thread
|
||||
if (thr != currentThread) {
|
||||
if (e->type() == QEvent::KeyPress) {
|
||||
QKeyEvent* ke = static_cast<QKeyEvent*>(e);
|
||||
auto ke = static_cast<QKeyEvent*>(e);
|
||||
if (ke->key() == Qt::Key_Escape) {
|
||||
// cancel the operation
|
||||
sequencer->tryToCancel();
|
||||
@@ -574,7 +574,7 @@ bool ProgressBar::eventFilter(QObject* o, QEvent* e)
|
||||
// check for ESC
|
||||
case QEvent::KeyPress:
|
||||
{
|
||||
QKeyEvent* ke = static_cast<QKeyEvent*>(e);
|
||||
auto ke = static_cast<QKeyEvent*>(e);
|
||||
if (ke->key() == Qt::Key_Escape) {
|
||||
// eventFilter() was called from the application 50 times without performing a new step (app could hang)
|
||||
if (d->observeEventFilter > 50) {
|
||||
|
||||
@@ -128,7 +128,7 @@ PreferenceUiForm::PreferenceUiForm(const QString& fn, QWidget* parent)
|
||||
file.close();
|
||||
if (form) {
|
||||
this->setWindowTitle(form->windowTitle());
|
||||
QVBoxLayout *layout = new QVBoxLayout;
|
||||
auto layout = new QVBoxLayout;
|
||||
layout->addWidget(form);
|
||||
setLayout(layout);
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ static ParameterGrp::handle _GetParam() {
|
||||
PropertyView::PropertyView(QWidget *parent)
|
||||
: QWidget(parent), SelectionObserver(false, ResolveMode::NoResolve)
|
||||
{
|
||||
QGridLayout* pLayout = new QGridLayout( this );
|
||||
auto pLayout = new QGridLayout( this );
|
||||
pLayout->setSpacing(0);
|
||||
pLayout->setMargin (0);
|
||||
|
||||
@@ -412,7 +412,7 @@ void PropertyView::onTimer() {
|
||||
nameType.propName = prop->getName();
|
||||
nameType.propId = prop->getTypeId().getKey();
|
||||
|
||||
std::vector<PropInfo>::iterator pi = std::find_if(propDataMap.begin(), propDataMap.end(), PropFind(nameType));
|
||||
auto pi = std::find_if(propDataMap.begin(), propDataMap.end(), PropFind(nameType));
|
||||
if (pi != propDataMap.end()) {
|
||||
pi->propList.push_back(prop);
|
||||
}
|
||||
@@ -433,7 +433,7 @@ void PropertyView::onTimer() {
|
||||
nameType.propName = pt->first;
|
||||
nameType.propId = pt->second->getTypeId().getKey();
|
||||
|
||||
std::vector<PropInfo>::iterator pi = std::find_if(propViewMap.begin(), propViewMap.end(), PropFind(nameType));
|
||||
auto pi = std::find_if(propViewMap.begin(), propViewMap.end(), PropFind(nameType));
|
||||
if (pi != propViewMap.end()) {
|
||||
pi->propList.push_back(pt->second);
|
||||
}
|
||||
@@ -548,8 +548,8 @@ PropertyDockView::PropertyDockView(Gui::Document* pcDocument, QWidget *parent)
|
||||
{
|
||||
setWindowTitle(tr("Property View"));
|
||||
|
||||
PropertyView* view = new PropertyView(this);
|
||||
QGridLayout* pLayout = new QGridLayout(this);
|
||||
auto view = new PropertyView(this);
|
||||
auto pLayout = new QGridLayout(this);
|
||||
pLayout->setSpacing(0);
|
||||
pLayout->setMargin (0);
|
||||
pLayout->addWidget(view, 0, 0);
|
||||
|
||||
+15
-15
@@ -511,7 +511,7 @@ void PythonConsole::OnChange(Base::Subject<const char*> &rCaller, const char* sR
|
||||
if (it != d->colormap.end()) {
|
||||
QColor color = it.value();
|
||||
unsigned int col = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
|
||||
unsigned long value = static_cast<unsigned long>(col);
|
||||
auto value = static_cast<unsigned long>(col);
|
||||
value = rGrp.GetUnsigned(sReason, value);
|
||||
col = static_cast<unsigned int>(value);
|
||||
color.setRgb((col>>24)&0xff, (col>>16)&0xff, (col>>8)&0xff);
|
||||
@@ -897,11 +897,11 @@ void PythonConsole::printStatement( const QString& cmd )
|
||||
|
||||
QTextCursor cursor = textCursor();
|
||||
QStringList statements = cmd.split(QLatin1String("\n"));
|
||||
for (QStringList::Iterator it = statements.begin(); it != statements.end(); ++it) {
|
||||
for (const auto & statement : statements) {
|
||||
// go to the end before inserting new text
|
||||
cursor.movePosition(QTextCursor::End);
|
||||
cursor.insertText( *it );
|
||||
d->history.append( *it );
|
||||
cursor.insertText( statement );
|
||||
d->history.append( statement );
|
||||
printPrompt(PythonConsole::Complete);
|
||||
}
|
||||
}
|
||||
@@ -925,7 +925,7 @@ void PythonConsole::visibilityChanged (bool visible)
|
||||
void PythonConsole::changeEvent(QEvent *e)
|
||||
{
|
||||
if (e->type() == QEvent::ParentChange) {
|
||||
QDockWidget* dw = qobject_cast<QDockWidget*>(this->parentWidget());
|
||||
auto dw = qobject_cast<QDockWidget*>(this->parentWidget());
|
||||
if (dw) {
|
||||
connect(dw, SIGNAL(visibilityChanged(bool)),
|
||||
this, SLOT(visibilityChanged(bool)));
|
||||
@@ -935,7 +935,7 @@ void PythonConsole::changeEvent(QEvent *e)
|
||||
QPalette pal = palette();
|
||||
QColor color = pal.windowText().color();
|
||||
unsigned int text = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
|
||||
unsigned long value = static_cast<unsigned long>(text);
|
||||
auto value = static_cast<unsigned long>(text);
|
||||
// if this parameter is not already set use the style's window text color
|
||||
value = getWindowParameter()->GetUnsigned("Text", value);
|
||||
getWindowParameter()->SetUnsigned("Text", value);
|
||||
@@ -1029,8 +1029,8 @@ bool PythonConsole::canInsertFromMimeData (const QMimeData * source) const
|
||||
return true;
|
||||
if (source->hasUrls()) {
|
||||
QList<QUrl> uri = source->urls();
|
||||
for (QList<QUrl>::Iterator it = uri.begin(); it != uri.end(); ++it) {
|
||||
QFileInfo info((*it).toLocalFile());
|
||||
for (const auto & it : uri) {
|
||||
QFileInfo info(it.toLocalFile());
|
||||
if (info.exists() && info.isFile()) {
|
||||
QString ext = info.suffix().toLower();
|
||||
if (ext == QLatin1String("py") || ext == QLatin1String("fcmacro"))
|
||||
@@ -1054,9 +1054,9 @@ void PythonConsole::insertFromMimeData (const QMimeData * source)
|
||||
bool existingFile = false;
|
||||
if (source->hasUrls()) {
|
||||
QList<QUrl> uri = source->urls();
|
||||
for (QList<QUrl>::Iterator it = uri.begin(); it != uri.end(); ++it) {
|
||||
for (const auto & it : uri) {
|
||||
// get the file name and check the extension
|
||||
QFileInfo info((*it).toLocalFile());
|
||||
QFileInfo info(it.toLocalFile());
|
||||
QString ext = info.suffix().toLower();
|
||||
if (info.exists()) {
|
||||
existingFile = true;
|
||||
@@ -1098,7 +1098,7 @@ QTextCursor PythonConsole::inputBegin() const
|
||||
|
||||
QMimeData * PythonConsole::createMimeDataFromSelection () const
|
||||
{
|
||||
QMimeData* mime = new QMimeData();
|
||||
auto mime = new QMimeData();
|
||||
|
||||
switch (d->type) {
|
||||
case PythonConsoleP::Normal:
|
||||
@@ -1321,8 +1321,8 @@ void PythonConsole::onSaveHistoryAs()
|
||||
if (f.open(QIODevice::WriteOnly)) {
|
||||
QTextStream t (&f);
|
||||
const QStringList& hist = d->history.values();
|
||||
for (QStringList::ConstIterator it = hist.begin(); it != hist.end(); ++it)
|
||||
t << *it << "\n";
|
||||
for (const auto & it : hist)
|
||||
t << it << "\n";
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
@@ -1420,8 +1420,8 @@ void PythonConsole::saveHistory() const
|
||||
// only save last 100 entries so we don't inflate forever...
|
||||
if (hist.length() > 100)
|
||||
hist = hist.mid(hist.length()-100);
|
||||
for (QStringList::ConstIterator it = hist.cbegin(); it != hist.cend(); ++it)
|
||||
t << *it << "\n";
|
||||
for (const auto & it : hist)
|
||||
t << it << "\n";
|
||||
f.close();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -531,14 +531,14 @@ void PythonDebugger::showDebugMarker(const QString& fn, int line)
|
||||
{
|
||||
PythonEditorView* edit = nullptr;
|
||||
QList<QWidget*> mdis = getMainWindow()->windows();
|
||||
for (QList<QWidget*>::iterator it = mdis.begin(); it != mdis.end(); ++it) {
|
||||
edit = qobject_cast<PythonEditorView*>(*it);
|
||||
for (const auto & mdi : mdis) {
|
||||
edit = qobject_cast<PythonEditorView*>(mdi);
|
||||
if (edit && edit->fileName() == fn)
|
||||
break;
|
||||
}
|
||||
|
||||
if (!edit) {
|
||||
PythonEditor* editor = new PythonEditor();
|
||||
auto editor = new PythonEditor();
|
||||
editor->setWindowIcon(Gui::BitmapFactory().iconFromTheme("applications-python"));
|
||||
edit = new PythonEditorView(editor, getMainWindow());
|
||||
edit->open(fn);
|
||||
@@ -554,8 +554,8 @@ void PythonDebugger::hideDebugMarker(const QString& fn)
|
||||
{
|
||||
PythonEditorView* edit = nullptr;
|
||||
QList<QWidget*> mdis = getMainWindow()->windows();
|
||||
for (QList<QWidget*>::iterator it = mdis.begin(); it != mdis.end(); ++it) {
|
||||
edit = qobject_cast<PythonEditorView*>(*it);
|
||||
for (const auto & mdi : mdis) {
|
||||
edit = qobject_cast<PythonEditorView*>(mdi);
|
||||
if (edit && edit->fileName() == fn) {
|
||||
edit->hideDebugMarker();
|
||||
break;
|
||||
@@ -577,7 +577,7 @@ static PyCodeObject* PyFrame_GetCode(PyFrameObject *frame)
|
||||
// http://stuff.mit.edu/afs/sipb/project/python/src/python2.2-2.2.2/Modules/_hotshot.c
|
||||
int PythonDebugger::tracer_callback(PyObject *obj, PyFrameObject *frame, int what, PyObject * /*arg*/)
|
||||
{
|
||||
PythonDebuggerPy* self = static_cast<PythonDebuggerPy*>(obj);
|
||||
auto self = static_cast<PythonDebuggerPy*>(obj);
|
||||
PythonDebugger* dbg = self->dbg;
|
||||
if (dbg->d->trystop)
|
||||
PyErr_SetInterrupt();
|
||||
|
||||
@@ -72,10 +72,10 @@ PythonEditor::PythonEditor(QWidget* parent)
|
||||
this->setSyntaxHighlighter(new PythonSyntaxHighlighter(this));
|
||||
|
||||
// set acelerators
|
||||
QShortcut* comment = new QShortcut(this);
|
||||
auto comment = new QShortcut(this);
|
||||
comment->setKey(QKeySequence(QString::fromLatin1("ALT+C")));
|
||||
|
||||
QShortcut* uncomment = new QShortcut(this);
|
||||
auto uncomment = new QShortcut(this);
|
||||
uncomment->setKey(QKeySequence(QString::fromLatin1("ALT+U")));
|
||||
|
||||
connect(comment, SIGNAL(activated()),
|
||||
|
||||
@@ -181,7 +181,7 @@ PythonToCppFunc isBaseQuantity_PythonToCpp_QVariantConvertible(PyObject* obj)
|
||||
#if defined (HAVE_PYSIDE)
|
||||
Base::Quantity convertWrapperToQuantity(const PySide::PyObjectWrapper &w)
|
||||
{
|
||||
PyObject* pyIn = static_cast<PyObject*>(w);
|
||||
auto pyIn = static_cast<PyObject*>(w);
|
||||
if (PyObject_TypeCheck(pyIn, &(Base::QuantityPy::Type))) {
|
||||
return *static_cast<Base::QuantityPy*>(pyIn)->getQuantityPtr();
|
||||
}
|
||||
@@ -351,7 +351,7 @@ QObject* PythonWrapper::toQObject(const Py::Object& pyobject)
|
||||
PyTypeObject * type = getPyTypeObjectForTypeName<QObject>();
|
||||
if (type) {
|
||||
if (Shiboken::Object::checkType(pyobject.ptr())) {
|
||||
SbkObject* sbkobject = reinterpret_cast<SbkObject *>(pyobject.ptr());
|
||||
auto sbkobject = reinterpret_cast<SbkObject *>(pyobject.ptr());
|
||||
void* cppobject = Shiboken::Object::cppPointer(sbkobject, type);
|
||||
return reinterpret_cast<QObject*>(cppobject);
|
||||
}
|
||||
@@ -377,7 +377,7 @@ QGraphicsItem* PythonWrapper::toQGraphicsItem(PyObject* pyPtr)
|
||||
PyTypeObject* type = getPyTypeObjectForTypeName<QGraphicsItem>();
|
||||
if (type) {
|
||||
if (Shiboken::Object::checkType(pyPtr)) {
|
||||
SbkObject* sbkobject = reinterpret_cast<SbkObject*>(pyPtr);
|
||||
auto sbkobject = reinterpret_cast<SbkObject*>(pyPtr);
|
||||
void* cppobject = Shiboken::Object::cppPointer(sbkobject, type);
|
||||
return reinterpret_cast<QGraphicsItem*>(cppobject);
|
||||
}
|
||||
@@ -397,7 +397,7 @@ QGraphicsObject* PythonWrapper::toQGraphicsObject(PyObject* pyPtr)
|
||||
PyTypeObject* type = getPyTypeObjectForTypeName<QGraphicsObject>();
|
||||
if (type) {
|
||||
if (Shiboken::Object::checkType(pyPtr)) {
|
||||
SbkObject* sbkobject = reinterpret_cast<SbkObject*>(pyPtr);
|
||||
auto sbkobject = reinterpret_cast<SbkObject*>(pyPtr);
|
||||
void* cppobject = Shiboken::Object::cppPointer(sbkobject, type);
|
||||
return reinterpret_cast<QGraphicsObject*>(cppobject);
|
||||
}
|
||||
@@ -433,7 +433,7 @@ QIcon *PythonWrapper::toQIcon(PyObject *pyobj)
|
||||
PyTypeObject * type = getPyTypeObjectForTypeName<QIcon>();
|
||||
if(type) {
|
||||
if (Shiboken::Object::checkType(pyobj)) {
|
||||
SbkObject* sbkobject = reinterpret_cast<SbkObject *>(pyobj);
|
||||
auto sbkobject = reinterpret_cast<SbkObject *>(pyobj);
|
||||
void* cppobject = Shiboken::Object::cppPointer(sbkobject, type);
|
||||
return reinterpret_cast<QIcon*>(cppobject);
|
||||
}
|
||||
@@ -464,7 +464,7 @@ QDir* PythonWrapper::toQDir(PyObject* pyobj)
|
||||
PyTypeObject* type = getPyTypeObjectForTypeName<QDir>();
|
||||
if (type) {
|
||||
if (Shiboken::Object::checkType(pyobj)) {
|
||||
SbkObject* sbkobject = reinterpret_cast<SbkObject*>(pyobj);
|
||||
auto sbkobject = reinterpret_cast<SbkObject*>(pyobj);
|
||||
void* cppobject = Shiboken::Object::cppPointer(sbkobject, type);
|
||||
return reinterpret_cast<QDir*>(cppobject);
|
||||
}
|
||||
@@ -484,7 +484,7 @@ Py::Object PythonWrapper::fromQObject(QObject* object, const char* className)
|
||||
//
|
||||
PyTypeObject * type = getPyTypeObjectForTypeName<QObject>();
|
||||
if (type) {
|
||||
SbkObjectType* sbk_type = reinterpret_cast<SbkObjectType*>(type);
|
||||
auto sbk_type = reinterpret_cast<SbkObjectType*>(type);
|
||||
std::string typeName;
|
||||
if (className)
|
||||
typeName = className;
|
||||
@@ -512,7 +512,7 @@ Py::Object PythonWrapper::fromQWidget(QWidget* widget, const char* className)
|
||||
//
|
||||
PyTypeObject * type = getPyTypeObjectForTypeName<QWidget>();
|
||||
if (type) {
|
||||
SbkObjectType* sbk_type = reinterpret_cast<SbkObjectType*>(type);
|
||||
auto sbk_type = reinterpret_cast<SbkObjectType*>(type);
|
||||
std::string typeName;
|
||||
if (className)
|
||||
typeName = className;
|
||||
|
||||
+12
-12
@@ -212,8 +212,8 @@ public:
|
||||
}
|
||||
else if (len > 1) {
|
||||
bool decOccurred = false;
|
||||
for (int i = 0; i<copy.size(); i++) {
|
||||
if (copy.at(i) == locale.decimalPoint()) {
|
||||
for (const auto & i : copy) {
|
||||
if (i == locale.decimalPoint()) {
|
||||
// Disallow multiple decimal points within the same numeric substring
|
||||
if (decOccurred) {
|
||||
state = QValidator::Invalid;
|
||||
@@ -222,7 +222,7 @@ public:
|
||||
decOccurred = true;
|
||||
}
|
||||
// Reset decOcurred if non-numeric character found
|
||||
else if (!(copy.at(i) == locale.groupSeparator() || copy.at(i).isDigit())) {
|
||||
else if (!(i == locale.groupSeparator() || i.isDigit())) {
|
||||
decOccurred = false;
|
||||
}
|
||||
}
|
||||
@@ -389,8 +389,8 @@ void QuantitySpinBox::setBoundToByName(const QString &name)
|
||||
path.setDocumentName(std::string(doc->getName()), true);
|
||||
path.setDocumentObjectName(std::string(obj->getNameInDocument()), true);
|
||||
|
||||
for (QStringList::iterator it = list.begin(); it != list.end(); ++it) {
|
||||
path << App::ObjectIdentifier::Component::SimpleComponent(it->toLatin1().constData());
|
||||
for (const auto & it : list) {
|
||||
path << App::ObjectIdentifier::Component::SimpleComponent(it.toLatin1().constData());
|
||||
}
|
||||
|
||||
if (path.getProperty())
|
||||
@@ -563,7 +563,7 @@ void QuantitySpinBox::openFormulaDialog()
|
||||
Q_ASSERT(isBound());
|
||||
|
||||
Q_D(const QuantitySpinBox);
|
||||
Gui::Dialog::DlgExpressionInput* box = new Gui::Dialog::DlgExpressionInput(getPath(), getExpression(), d->unit, this);
|
||||
auto box = new Gui::Dialog::DlgExpressionInput(getPath(), getExpression(), d->unit, this);
|
||||
QObject::connect(box, &Gui::Dialog::DlgExpressionInput::finished, [=]() {
|
||||
if (box->result() == QDialog::Accepted)
|
||||
setExpression(box->getExpression());
|
||||
@@ -904,7 +904,7 @@ void QuantitySpinBox::focusInEvent(QFocusEvent * event)
|
||||
event->reason() == Qt::ShortcutFocusReason) {
|
||||
|
||||
if (isBound() && getExpression() && lineEdit()->isReadOnly()) {
|
||||
QHelpEvent * helpEvent = new QHelpEvent(QEvent::ToolTip, QPoint( 0, rect().height() ), mapToGlobal( QPoint( 0, rect().height() ) ));
|
||||
auto helpEvent = new QHelpEvent(QEvent::ToolTip, QPoint( 0, rect().height() ), mapToGlobal( QPoint( 0, rect().height() ) ));
|
||||
QApplication::postEvent(this, helpEvent);
|
||||
lineEdit()->setSelection(0, 0);
|
||||
}
|
||||
@@ -937,14 +937,14 @@ void QuantitySpinBox::selectNumber()
|
||||
QChar g = locale().groupSeparator();
|
||||
QChar n = locale().negativeSign();
|
||||
|
||||
for (QString::const_iterator it = str.cbegin(); it != str.cend(); ++it) {
|
||||
if (it->isDigit())
|
||||
for (auto it : str) {
|
||||
if (it.isDigit())
|
||||
i++;
|
||||
else if (*it == d)
|
||||
else if (it == d)
|
||||
i++;
|
||||
else if (*it == g)
|
||||
else if (it == g)
|
||||
i++;
|
||||
else if (*it == n)
|
||||
else if (it == n)
|
||||
i++;
|
||||
else // any non-number character
|
||||
break;
|
||||
|
||||
+18
-18
@@ -58,7 +58,7 @@ ReportView::ReportView( QWidget* parent )
|
||||
setObjectName(QLatin1String("ReportOutput"));
|
||||
|
||||
resize( 529, 162 );
|
||||
QGridLayout* tabLayout = new QGridLayout( this );
|
||||
auto tabLayout = new QGridLayout( this );
|
||||
tabLayout->setSpacing( 0 );
|
||||
tabLayout->setMargin( 0 );
|
||||
|
||||
@@ -141,7 +141,7 @@ void ReportHighlighter::highlightBlock (const QString & text)
|
||||
{
|
||||
if (text.isEmpty())
|
||||
return;
|
||||
TextBlockData* ud = static_cast<TextBlockData*>(this->currentBlockUserData());
|
||||
auto ud = static_cast<TextBlockData*>(this->currentBlockUserData());
|
||||
if (!ud) {
|
||||
ud = new TextBlockData;
|
||||
this->setCurrentBlockUserData(ud);
|
||||
@@ -154,26 +154,26 @@ void ReportHighlighter::highlightBlock (const QString & text)
|
||||
|
||||
QVector<TextBlockData::State> block = ud->block;
|
||||
int start = 0;
|
||||
for (QVector<TextBlockData::State>::Iterator it = block.begin(); it != block.end(); ++it) {
|
||||
switch (it->type)
|
||||
for (const auto & it : block) {
|
||||
switch (it.type)
|
||||
{
|
||||
case Message:
|
||||
setFormat(start, it->length-start, txtCol);
|
||||
setFormat(start, it.length-start, txtCol);
|
||||
break;
|
||||
case Warning:
|
||||
setFormat(start, it->length-start, warnCol);
|
||||
setFormat(start, it.length-start, warnCol);
|
||||
break;
|
||||
case Error:
|
||||
setFormat(start, it->length-start, errCol);
|
||||
setFormat(start, it.length-start, errCol);
|
||||
break;
|
||||
case LogText:
|
||||
setFormat(start, it->length-start, logCol);
|
||||
setFormat(start, it.length-start, logCol);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
start = it->length;
|
||||
start = it.length;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,7 +305,7 @@ void ReportOutputObserver::showReportView()
|
||||
bool ReportOutputObserver::eventFilter(QObject *obj, QEvent *event)
|
||||
{
|
||||
if (event->type() == QEvent::User && obj == reportView.data()) {
|
||||
CustomReportEvent* cr = dynamic_cast<CustomReportEvent*>(event);
|
||||
auto cr = dynamic_cast<CustomReportEvent*>(event);
|
||||
if (cr) {
|
||||
ReportHighlighter::Paragraph msgType = cr->messageType();
|
||||
if (msgType == ReportHighlighter::Warning) {
|
||||
@@ -478,7 +478,7 @@ void ReportOutput::SendLog(const std::string& msg, Base::LogStyle level)
|
||||
}
|
||||
|
||||
// Send the event to itself to allow thread-safety. Qt will delete it when done.
|
||||
CustomReportEvent* ev = new CustomReportEvent(style, qMsg);
|
||||
auto ev = new CustomReportEvent(style, qMsg);
|
||||
QApplication::postEvent(this, ev);
|
||||
}
|
||||
|
||||
@@ -486,7 +486,7 @@ void ReportOutput::customEvent ( QEvent* ev )
|
||||
{
|
||||
// Appends the text stored in the event to the text view
|
||||
if ( ev->type() == QEvent::User ) {
|
||||
CustomReportEvent* ce = (CustomReportEvent*)ev;
|
||||
auto ce = (CustomReportEvent*)ev;
|
||||
reportHl->setParagraphType(ce->messageType());
|
||||
|
||||
bool showTimecode = getWindowParameter()->GetBool("checkShowReportTimecode", true);
|
||||
@@ -516,7 +516,7 @@ void ReportOutput::customEvent ( QEvent* ev )
|
||||
bool ReportOutput::event(QEvent* event)
|
||||
{
|
||||
if (event && event->type() == QEvent::ShortcutOverride) {
|
||||
QKeyEvent * kevent = static_cast<QKeyEvent*>(event);
|
||||
auto kevent = static_cast<QKeyEvent*>(event);
|
||||
if (kevent == QKeySequence::Copy)
|
||||
kevent->accept();
|
||||
}
|
||||
@@ -529,7 +529,7 @@ void ReportOutput::changeEvent(QEvent *ev)
|
||||
QPalette pal = palette();
|
||||
QColor color = pal.windowText().color();
|
||||
unsigned int text = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8);
|
||||
unsigned long value = static_cast<unsigned long>(text);
|
||||
auto value = static_cast<unsigned long>(text);
|
||||
// if this parameter is not already set use the style's window text color
|
||||
value = getWindowParameter()->GetUnsigned("colorText", value);
|
||||
getWindowParameter()->SetUnsigned("colorText", value);
|
||||
@@ -544,13 +544,13 @@ void ReportOutput::contextMenuEvent ( QContextMenuEvent * e )
|
||||
bool bShowOnWarn = ReportOutputParameter::showOnWarning();
|
||||
bool bShowOnError = ReportOutputParameter::showOnError();
|
||||
|
||||
QMenu* menu = new QMenu(this);
|
||||
QMenu* optionMenu = new QMenu( menu );
|
||||
auto menu = new QMenu(this);
|
||||
auto optionMenu = new QMenu( menu );
|
||||
optionMenu->setTitle(tr("Options"));
|
||||
menu->addMenu(optionMenu);
|
||||
menu->addSeparator();
|
||||
|
||||
QMenu* displayMenu = new QMenu(optionMenu);
|
||||
auto displayMenu = new QMenu(optionMenu);
|
||||
displayMenu->setTitle(tr("Display message types"));
|
||||
optionMenu->addMenu(displayMenu);
|
||||
|
||||
@@ -570,7 +570,7 @@ void ReportOutput::contextMenuEvent ( QContextMenuEvent * e )
|
||||
errAct->setCheckable(true);
|
||||
errAct->setChecked(bErr);
|
||||
|
||||
QMenu* showOnMenu = new QMenu (optionMenu);
|
||||
auto showOnMenu = new QMenu (optionMenu);
|
||||
showOnMenu->setTitle(tr("Show output window on"));
|
||||
optionMenu->addMenu(showOnMenu);
|
||||
|
||||
|
||||
@@ -105,13 +105,13 @@ SbBool RevitNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Keyboard handling
|
||||
if (type.isDerivedFrom(SoKeyboardEvent::getClassTypeId())) {
|
||||
const SoKeyboardEvent * const event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
const auto event = static_cast<const SoKeyboardEvent *>(ev);
|
||||
processed = processKeyboardEvent(event);
|
||||
}
|
||||
|
||||
// Mouse Button / Spaceball Button handling
|
||||
if (type.isDerivedFrom(SoMouseButtonEvent::getClassTypeId())) {
|
||||
const SoMouseButtonEvent * const event = (const SoMouseButtonEvent *) ev;
|
||||
const auto event = (const SoMouseButtonEvent *) ev;
|
||||
const int button = event->getButton();
|
||||
const SbBool press = event->getState() == SoButtonEvent::DOWN ? true : false;
|
||||
|
||||
@@ -196,7 +196,7 @@ SbBool RevitNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
// Mouse Movement handling
|
||||
if (type.isDerivedFrom(SoLocation2Event::getClassTypeId())) {
|
||||
this->lockrecenter = true;
|
||||
const SoLocation2Event * const event = (const SoLocation2Event *) ev;
|
||||
const auto event = (const SoLocation2Event *) ev;
|
||||
if (this->currentmode == NavigationStyle::ZOOMING) {
|
||||
this->zoomByCursor(posn, prevnormalized);
|
||||
processed = true;
|
||||
@@ -216,7 +216,7 @@ SbBool RevitNavigationStyle::processSoEvent(const SoEvent * const ev)
|
||||
|
||||
// Spaceball & Joystick handling
|
||||
if (type.isDerivedFrom(SoMotion3Event::getClassTypeId())) {
|
||||
const SoMotion3Event * const event = static_cast<const SoMotion3Event *>(ev);
|
||||
const auto event = static_cast<const SoMotion3Event *>(ev);
|
||||
if (event)
|
||||
this->processMotionEvent(event);
|
||||
processed = true;
|
||||
|
||||
+12
-12
@@ -93,7 +93,7 @@ void SceneModel::setNode(QModelIndex index, SoNode* node)
|
||||
{
|
||||
this->setData(index, QVariant(QString::fromLatin1(node->getTypeId().getName())));
|
||||
if (node->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) {
|
||||
SoGroup *group = static_cast<SoGroup*>(node);
|
||||
auto group = static_cast<SoGroup*>(node);
|
||||
// insert SoGroup icon
|
||||
this->insertColumns(0,2,index);
|
||||
this->insertRows(0,group->getNumChildren(), index);
|
||||
@@ -137,7 +137,7 @@ DlgInspector::DlgInspector(QWidget* parent, Qt::WindowFlags fl)
|
||||
ui->setupUi(this);
|
||||
setWindowTitle(tr("Scene Inspector"));
|
||||
|
||||
SceneModel* model = new SceneModel(this);
|
||||
auto model = new SceneModel(this);
|
||||
ui->treeView->setModel(model);
|
||||
ui->treeView->setRootIsDecorated(true);
|
||||
}
|
||||
@@ -155,7 +155,7 @@ void DlgInspector::setDocument(Gui::Document* doc)
|
||||
{
|
||||
setNodeNames(doc);
|
||||
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(doc->getActiveView());
|
||||
auto view = qobject_cast<View3DInventor*>(doc->getActiveView());
|
||||
if (view) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
setNode(viewer->getSceneGraph());
|
||||
@@ -165,7 +165,7 @@ void DlgInspector::setDocument(Gui::Document* doc)
|
||||
|
||||
void DlgInspector::setNode(SoNode* node)
|
||||
{
|
||||
SceneModel* model = static_cast<SceneModel*>(ui->treeView->model());
|
||||
auto model = static_cast<SceneModel*>(ui->treeView->model());
|
||||
model->setNode(node);
|
||||
|
||||
QHeaderView* header = ui->treeView->header();
|
||||
@@ -178,8 +178,8 @@ void DlgInspector::setNodeNames(Gui::Document* doc)
|
||||
std::vector<Gui::ViewProvider*> vps = doc->getViewProvidersOfType
|
||||
(Gui::ViewProviderDocumentObject::getClassTypeId());
|
||||
QHash<SoNode*, QString> nodeNames;
|
||||
for (std::vector<Gui::ViewProvider*>::iterator it = vps.begin(); it != vps.end(); ++it) {
|
||||
Gui::ViewProviderDocumentObject* vp = static_cast<Gui::ViewProviderDocumentObject*>(*it);
|
||||
for (const auto & it : vps) {
|
||||
auto vp = static_cast<Gui::ViewProviderDocumentObject*>(it);
|
||||
App::DocumentObject* obj = vp->getObject();
|
||||
if (obj) {
|
||||
QString label = QString::fromUtf8(obj->Label.getValue());
|
||||
@@ -187,15 +187,15 @@ void DlgInspector::setNodeNames(Gui::Document* doc)
|
||||
}
|
||||
|
||||
std::vector<std::string> modes = vp->getDisplayMaskModes();
|
||||
for (std::vector<std::string>::iterator jt = modes.begin(); jt != modes.end(); ++jt) {
|
||||
SoNode* node = vp->getDisplayMaskMode(jt->c_str());
|
||||
for (const auto & mode : modes) {
|
||||
SoNode* node = vp->getDisplayMaskMode(mode.c_str());
|
||||
if (node) {
|
||||
nodeNames[node] = QString::fromStdString(*jt);
|
||||
nodeNames[node] = QString::fromStdString(mode);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
SceneModel* model = static_cast<SceneModel*>(ui->treeView->model());
|
||||
auto model = static_cast<SceneModel*>(ui->treeView->model());
|
||||
model->setNodeNames(nodeNames);
|
||||
}
|
||||
|
||||
@@ -214,7 +214,7 @@ void DlgInspector::on_refreshButton_clicked()
|
||||
if (doc) {
|
||||
setNodeNames(doc);
|
||||
|
||||
View3DInventor* view = qobject_cast<View3DInventor*>(doc->getActiveView());
|
||||
auto view = qobject_cast<View3DInventor*>(doc->getActiveView());
|
||||
if (view) {
|
||||
View3DInventorViewer* viewer = view->getViewer();
|
||||
setNode(viewer->getSceneGraph());
|
||||
@@ -222,7 +222,7 @@ void DlgInspector::on_refreshButton_clicked()
|
||||
}
|
||||
}
|
||||
else {
|
||||
SceneModel* model = static_cast<SceneModel*>(ui->treeView->model());
|
||||
auto model = static_cast<SceneModel*>(ui->treeView->model());
|
||||
model->clear();
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user