diff --git a/src/Base/Handle.cpp b/src/Base/Handle.cpp index ff9c813f590a..9a1c1168bf4d 100644 --- a/src/Base/Handle.cpp +++ b/src/Base/Handle.cpp @@ -46,8 +46,13 @@ Handled::Handled() Handled::~Handled() { +#if QT_VERSION >= 0x050000 + if (_lRefCount->load() != 0) +#else if ((int)(*_lRefCount) != 0) +#endif throw Exception("Reference counter of deleted object is not zero!!!!!\n"); + delete _lRefCount; } @@ -66,7 +71,11 @@ void Handled::unref() const int Handled::getRefCount(void) const { +#if QT_VERSION >= 0x050000 + return _lRefCount->load(); +#else return (int)(*_lRefCount); +#endif } const Handled& Handled::operator = (const Handled&) diff --git a/src/Base/UnitsApi.cpp b/src/Base/UnitsApi.cpp index 7b95925aa56d..a0ca212938ae 100644 --- a/src/Base/UnitsApi.cpp +++ b/src/Base/UnitsApi.cpp @@ -135,7 +135,7 @@ QString UnitsApi::schemaTranslate(Base::Quantity quant,double &factor,QString &u double UnitsApi::toDbl(PyObject *ArgObj,const Base::Unit &u) { if (PyString_Check(ArgObj)) - QString str = QString::fromAscii(PyString_AsString(ArgObj)); + QString str = QString::fromLatin1(PyString_AsString(ArgObj)); else if (PyFloat_Check(ArgObj)) double d = PyFloat_AsDouble(ArgObj); else if (PyInt_Check(ArgObj)) diff --git a/src/Base/Uuid.cpp b/src/Base/Uuid.cpp index 1fac7ac94910..9661d86a90b6 100644 --- a/src/Base/Uuid.cpp +++ b/src/Base/Uuid.cpp @@ -68,21 +68,21 @@ std::string Uuid::createUuid(void) QString uuid = QUuid::createUuid().toString(); uuid = uuid.mid(1); uuid.chop(1); - Uuid = (const char*)uuid.toAscii(); + Uuid = (const char*)uuid.toLatin1(); return Uuid; } void Uuid::setValue(const char* sString) { if (sString) { - QUuid uuid(QString::fromAscii(sString)); + QUuid uuid(QString::fromLatin1(sString)); if (uuid.isNull()) throw std::runtime_error("invalid uuid"); // remove curly braces QString id = uuid.toString(); id = id.mid(1); id.chop(1); - _uuid = (const char*)id.toAscii(); + _uuid = (const char*)id.toLatin1(); } } diff --git a/src/Gui/Action.cpp b/src/Gui/Action.cpp index 4c6dd3d25ae4..3c973e2fc3a8 100644 --- a/src/Gui/Action.cpp +++ b/src/Gui/Action.cpp @@ -34,6 +34,7 @@ # include # include # include +# include #endif #include "Action.h" @@ -59,7 +60,7 @@ using namespace Gui::Dialog; Action::Action (Command* pcCmd, QObject * parent) : QObject(parent), _action(new QAction( this )), _pcCmd(pcCmd) { - _action->setObjectName(QString::fromAscii(_pcCmd->getName())); + _action->setObjectName(QString::fromLatin1(_pcCmd->getName())); connect(_action, SIGNAL(triggered(bool)), this, SLOT(onActivated())); } @@ -67,7 +68,7 @@ Action::Action (Command* pcCmd, QAction* action, QObject * parent) : QObject(parent), _action(action), _pcCmd(pcCmd) { _action->setParent(this); - _action->setObjectName(QString::fromAscii(_pcCmd->getName())); + _action->setObjectName(QString::fromLatin1(_pcCmd->getName())); connect(_action, SIGNAL(triggered(bool)), this, SLOT(onActivated())); } @@ -512,7 +513,7 @@ void WorkbenchGroup::addTo(QWidget *w) void WorkbenchGroup::refreshWorkbenchList() { - QString active = QString::fromAscii(WorkbenchManager::instance()->active()->name().c_str()); + QString active = QString::fromLatin1(WorkbenchManager::instance()->active()->name().c_str()); QStringList items = Application::Instance->workbenches(); QList workbenches = _group->actions(); @@ -568,7 +569,7 @@ void WorkbenchGroup::slotAddWorkbench(const char* name) QList workbenches = _group->actions(); for (QList::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) { if (!(*it)->isVisible()) { - QString wb = QString::fromAscii(name); + QString wb = QString::fromLatin1(name); QPixmap px = Application::Instance->workbenchIcon(wb); QString text = Application::Instance->workbenchMenuText(wb); QString tip = Application::Instance->workbenchToolTip(wb); @@ -585,7 +586,7 @@ void WorkbenchGroup::slotAddWorkbench(const char* name) void WorkbenchGroup::slotRemoveWorkbench(const char* name) { - QString workbench = QString::fromAscii(name); + QString workbench = QString::fromLatin1(name); QList workbenches = _group->actions(); for (QList::Iterator it = workbenches.begin(); it != workbenches.end(); ++it) { if ((*it)->objectName() == workbench) { @@ -638,7 +639,7 @@ void RecentFilesAction::setFiles(const QStringList& files) int numRecentFiles = std::min(recentFiles.count(), files.count()); for (int index = 0; index < numRecentFiles; index++) { QFileInfo fi(files[index]); - recentFiles[index]->setText(QString::fromAscii("&%1 %2").arg(index+1).arg(fi.fileName())); + recentFiles[index]->setText(QString::fromLatin1("&%1 %2").arg(index+1).arg(fi.fileName())); recentFiles[index]->setStatusTip(tr("Open file %1").arg(files[index])); recentFiles[index]->setToolTip(files[index]); // set the full name that we need later for saving recentFiles[index]->setData(QVariant(index)); @@ -689,7 +690,7 @@ void RecentFilesAction::activateFile(int id) // invokes appendFile() SelectModule::Dict dict = SelectModule::importHandler(filename); for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) { - Application::Instance->open(it.key().toUtf8(), it.value().toAscii()); + Application::Instance->open(it.key().toUtf8(), it.value().toLatin1()); break; } } @@ -739,11 +740,11 @@ void RecentFilesAction::save() QList recentFiles = _group->actions(); int num = std::min(count, recentFiles.count()); for (int index = 0; index < num; index++) { - QString key = QString::fromAscii("MRU%1").arg(index); + QString key = QString::fromLatin1("MRU%1").arg(index); QString value = recentFiles[index]->toolTip(); if (value.isEmpty()) break; - hGrp->SetASCII(key.toAscii(), value.toUtf8()); + hGrp->SetASCII(key.toLatin1(), value.toUtf8()); } } diff --git a/src/Gui/Application.cpp b/src/Gui/Application.cpp index 1963886e2a60..2f3a31800a4a 100644 --- a/src/Gui/Application.cpp +++ b/src/Gui/Application.cpp @@ -43,6 +43,7 @@ # include # include #endif +# include #include @@ -332,7 +333,7 @@ Application::Application(bool GUIenabled) ParameterGrp::handle hPGrp = App::GetApplication().GetUserParameter().GetGroup("BaseApp"); hPGrp = hPGrp->GetGroup("Preferences")->GetGroup("General"); QString lang = QLocale::languageToString(QLocale::system().language()); - Translator::instance()->activateLanguage(hPGrp->GetASCII("Language", (const char*)lang.toAscii()).c_str()); + Translator::instance()->activateLanguage(hPGrp->GetASCII("Language", (const char*)lang.toLatin1()).c_str()); GetWidgetFactorySupplier(); ParameterGrp::handle hUnits = App::GetApplication().GetParameterGroupByPath @@ -1005,7 +1006,7 @@ bool Application::activateWorkbench(const char* name) ok = true; // already active // now try to create and activate the matching workbench object else if (WorkbenchManager::instance()->activate(name, type)) { - getMainWindow()->activateWorkbench(QString::fromAscii(name)); + getMainWindow()->activateWorkbench(QString::fromLatin1(name)); this->signalActivateWorkbench(name); ok = true; } @@ -1050,7 +1051,7 @@ bool Application::activateWorkbench(const char* name) } catch (Py::Exception&) { Base::PyException e; // extract the Python error text - QString msg = QString::fromAscii(e.what()); + QString msg = QString::fromLatin1(e.what()); QRegExp rx; // ignore '' prefixes rx.setPattern(QLatin1String("^\\s*:\\s*")); @@ -1060,7 +1061,7 @@ bool Application::activateWorkbench(const char* name) pos = rx.indexIn(msg); } - Base::Console().Error("%s\n", (const char*)msg.toAscii()); + Base::Console().Error("%s\n", (const char*)msg.toLatin1()); Base::Console().Log("%s\n", e.getStackTrace().c_str()); if (!d->startingUp) { wc.restoreCursor(); @@ -1077,7 +1078,7 @@ QPixmap Application::workbenchIcon(const QString& wb) const { Base::PyGILStateLocker lock; // get the python workbench object from the dictionary - PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toAscii()); + PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toLatin1()); // test if the workbench exists if (pcWorkbench) { // make a unique icon name @@ -1150,7 +1151,7 @@ QString Application::workbenchToolTip(const QString& wb) const { // get the python workbench object from the dictionary Base::PyGILStateLocker lock; - PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toAscii()); + PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toLatin1()); // test if the workbench exists if (pcWorkbench) { // get its ToolTip member if possible @@ -1174,7 +1175,7 @@ QString Application::workbenchMenuText(const QString& wb) const { // get the python workbench object from the dictionary Base::PyGILStateLocker lock; - PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toAscii()); + PyObject* pcWorkbench = PyDict_GetItemString(_pcWorkbenchDictionary, wb.toLatin1()); // test if the workbench exists if (pcWorkbench) { // get its ToolTip member if possible @@ -1205,13 +1206,13 @@ QStringList Application::workbenches(void) const const char* start = (st != config.end() ? st->second.c_str() : ""); QStringList hidden, extra; if (ht != config.end()) { - QString items = QString::fromAscii(ht->second.c_str()); + QString items = QString::fromLatin1(ht->second.c_str()); hidden = items.split(QLatin1Char(';'), QString::SkipEmptyParts); if (hidden.isEmpty()) hidden.push_back(QLatin1String("")); } if (et != config.end()) { - QString items = QString::fromAscii(et->second.c_str()); + QString items = QString::fromLatin1(et->second.c_str()); extra = items.split(QLatin1Char(';'), QString::SkipEmptyParts); if (extra.isEmpty()) extra.push_back(QLatin1String("")); @@ -1227,18 +1228,18 @@ QStringList Application::workbenches(void) const // add only allowed workbenches bool ok = true; if (!extra.isEmpty()&&ok) { - ok = (extra.indexOf(QString::fromAscii(wbName)) != -1); + ok = (extra.indexOf(QString::fromLatin1(wbName)) != -1); } if (!hidden.isEmpty()&&ok) { - ok = (hidden.indexOf(QString::fromAscii(wbName)) == -1); + ok = (hidden.indexOf(QString::fromLatin1(wbName)) == -1); } // okay the item is visible if (ok) - wb.push_back(QString::fromAscii(wbName)); + wb.push_back(QString::fromLatin1(wbName)); // also allow start workbench in case it is hidden else if (strcmp(wbName, start) == 0) - wb.push_back(QString::fromAscii(wbName)); + wb.push_back(QString::fromLatin1(wbName)); } return wb; @@ -1383,7 +1384,7 @@ void messageHandler(QtMsgType type, const char *msg) Base::Console().Error("%s\n", msg); abort(); // deliberately core dump } -#ifdef FC_OS_WIN32 +#if defined(FC_OS_WIN32) && QT_VERSION < 0x050000 if (old_qtmsg_handler) (*old_qtmsg_handler)(type, msg); #endif @@ -1393,6 +1394,13 @@ void messageHandler(QtMsgType type, const char *msg) #endif } +#if QT_VERSION >= 0x050000 +void messageHandler(QtMsgType type, const QMessageLogContext &context, const QString &msg) +{ + messageHandler(type, msg.toLocal8Bit().constData()); +} +#endif + #ifdef FC_DEBUG // redirect Coin messages to FreeCAD void messageHandlerCoin(const SoError * error, void * userdata) { @@ -1411,7 +1419,7 @@ void messageHandlerCoin(const SoError * error, void * userdata) Base::Console().Error("%s\n", msg); break; } -#ifdef FC_OS_WIN32 +#if defined(FC_OS_WIN32) && QT_VERSION < 0x050000 if (old_qtmsg_handler) (*old_qtmsg_handler)(QtDebugMsg, msg); #endif @@ -1442,7 +1450,11 @@ void Application::initApplication(void) initTypes(); new Base::ScriptProducer( "FreeCADGuiInit", FreeCADGuiInit ); init_resources(); - old_qtmsg_handler = qInstallMsgHandler(messageHandler); +#if QT_VERSION >= 0x050000 + qInstallMessageHandler(messageHandler); +#else + old_qtmsg_handler = qInstallMsgHandler(messageHandler); +#endif } catch (...) { // force to flush the log @@ -1720,7 +1732,7 @@ void Application::runApplication(void) // if the auto workbench is not visible then force to use the default workbech // and replace the wrong entry in the parameters QStringList wb = app.workbenches(); - if (!wb.contains(QString::fromAscii(start.c_str()))) { + if (!wb.contains(QString::fromLatin1(start.c_str()))) { start = App::Application::Config()["StartWorkbench"]; App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/General")-> SetASCII("AutoloadModule", start.c_str()); @@ -1816,11 +1828,11 @@ void Application::runApplication(void) void Application::checkForPreviousCrashes() { QDir tmp = QDir::temp(); - tmp.setNameFilters(QStringList() << QString::fromAscii("*.lock")); + tmp.setNameFilters(QStringList() << QString::fromLatin1("*.lock")); tmp.setFilter(QDir::Files); QList restoreDocFiles; - QString exeName = QString::fromAscii(App::GetApplication().getExecutableName()); + QString exeName = QString::fromLatin1(App::GetApplication().getExecutableName()); QList locks = tmp.entryInfoList(); for (QList::iterator it = locks.begin(); it != locks.end(); ++it) { QString bn = it->baseName(); diff --git a/src/Gui/BitmapFactory.cpp b/src/Gui/BitmapFactory.cpp index 44f9656fb415..1ad7dd8f6e5e 100644 --- a/src/Gui/BitmapFactory.cpp +++ b/src/Gui/BitmapFactory.cpp @@ -85,8 +85,8 @@ BitmapFactoryInst& BitmapFactoryInst::instance(void) } _pcSingleton->addPath(path); } - _pcSingleton->addPath(QString::fromAscii("%1/icons").arg(QString::fromUtf8(App::GetApplication().GetHomePath()))); - _pcSingleton->addPath(QString::fromAscii("%1/icons").arg(QString::fromUtf8(App::GetApplication().Config()["UserAppData"].c_str()))); + _pcSingleton->addPath(QString::fromLatin1("%1/icons").arg(QString::fromUtf8(App::GetApplication().GetHomePath()))); + _pcSingleton->addPath(QString::fromLatin1("%1/icons").arg(QString::fromUtf8(App::GetApplication().Config()["UserAppData"].c_str()))); _pcSingleton->addPath(QLatin1String(":/icons/")); _pcSingleton->addPath(QLatin1String(":/Icons/")); @@ -150,7 +150,7 @@ QStringList BitmapFactoryInst::findIconFiles() const QStringList files, filters; QList formats = QImageReader::supportedImageFormats(); for (QList::iterator it = formats.begin(); it != formats.end(); ++it) - filters << QString::fromAscii("*.%1").arg(QString::fromAscii(*it).toLower()); + filters << QString::fromLatin1("*.%1").arg(QString::fromLatin1(*it).toLower()); QStringList paths = d->paths; #if QT_VERSION >= 0x040500 @@ -253,8 +253,8 @@ QPixmap BitmapFactoryInst::pixmap(const char* name) const else { // Go through supported file formats for (QList::iterator fm = formats.begin(); fm != formats.end(); ++fm) { - QString path = QString::fromAscii("%1.%2").arg(fileName). - arg(QString::fromAscii((*fm).toLower().constData())); + QString path = QString::fromLatin1("%1.%2").arg(fileName). + arg(QString::fromLatin1((*fm).toLower().constData())); if (loadPixmap(path, icon)) { found = true; break; @@ -318,8 +318,8 @@ QPixmap BitmapFactoryInst::pixmapFromSvg(const QByteArray& contents, const QSize QPalette pal = webView.palette(); pal.setColor(QPalette::Background, Qt::transparent); webView.setPalette(pal); - webView.setContent(contents, QString::fromAscii("image/svg+xml")); - QString node = QString::fromAscii("document.rootElement.nodeName"); + webView.setContent(contents, QString::fromLatin1("image/svg+xml")); + QString node = QString::fromLatin1("document.rootElement.nodeName"); QWebFrame* frame = webView.page()->mainFrame(); if (!frame) { return QPixmap(); @@ -330,8 +330,8 @@ QPixmap BitmapFactoryInst::pixmapFromSvg(const QByteArray& contents, const QSize return QPixmap(); } - QString w = QString::fromAscii("document.rootElement.width.baseVal.value"); - QString h = QString::fromAscii("document.rootElement.height.baseVal.value"); + QString w = QString::fromLatin1("document.rootElement.width.baseVal.value"); + QString h = QString::fromLatin1("document.rootElement.height.baseVal.value"); double ww = frame->evaluateJavaScript(w).toDouble(); double hh = frame->evaluateJavaScript(h).toDouble(); if (ww == 0.0 || hh == 0.0) @@ -545,8 +545,11 @@ void BitmapFactoryInst::convert(const QImage& p, SoSFImage& img) const SbVec2s size; size[0] = p.width(); size[1] = p.height(); - +#if QT_VERSION >= 0x050000 + int buffersize = p.byteCount(); +#else int buffersize = p.numBytes(); +#endif int numcomponents = buffersize / ( size[0] * size[1] ); // allocate image data diff --git a/src/Gui/CallTips.cpp b/src/Gui/CallTips.cpp index 70282ffa0cad..0d2a95a05e12 100644 --- a/src/Gui/CallTips.cpp +++ b/src/Gui/CallTips.cpp @@ -182,7 +182,7 @@ QString CallTipsList::extractContext(const QString& line) const int index = len-1; for (int i=0; i= 48 && ch <= 57) || // Numbers (ch >= 65 && ch <= 90) || // Uppercase letters (ch >= 97 && ch <= 122) || // Lowercase letters @@ -208,13 +208,13 @@ QMap CallTipsList::extractTips(const QString& context) const Py::Dict dict = module.getDict(); QString modname = items.front(); items.pop_front(); - if (!dict.hasKey(std::string(modname.toAscii()))) + if (!dict.hasKey(std::string(modname.toLatin1()))) return tips; // unknown object // get the Python object we need - Py::Object obj = dict.getItem(std::string(modname.toAscii())); + Py::Object obj = dict.getItem(std::string(modname.toLatin1())); while (!items.isEmpty()) { - QByteArray name = items.front().toAscii(); + QByteArray name = items.front().toLatin1(); std::string attr = name.constData(); items.pop_front(); if (obj.hasAttr(attr)) @@ -321,7 +321,7 @@ void CallTipsList::extractTipsFromObject(Py::Object& obj, Py::List& list, QMap::const_iterator It=Map.begin();It!=Map.end();++It) { CallTip tip; - QString str = QString::fromAscii(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)); @@ -639,7 +639,11 @@ void CallTipsList::callTipItemActivated(QListWidgetItem *item) cursor.insertText( text ); // get CallTip from item's UserRole-data +#if QT_VERSION >= 0x050000 + const CallTip &callTip = item->data(Qt::UserRole).value(); +#else const CallTip &callTip = qVariantValue( item->data(Qt::UserRole) ); +#endif // if call completion enabled and we've something callable (method or class constructor) ... if (this->doCallCompletion diff --git a/src/Gui/CombiView.cpp b/src/Gui/CombiView.cpp index 8df9c34c49a0..7f0ded0413d5 100644 --- a/src/Gui/CombiView.cpp +++ b/src/Gui/CombiView.cpp @@ -23,6 +23,8 @@ #include "PreCompiled.h" +#include + /// Here the FreeCAD includes sorted by Base,App,Gui...... #include "CombiView.h" @@ -76,11 +78,11 @@ CombiView::CombiView(Gui::Document* pcDocument, QWidget *parent) // task panel taskPanel = new Gui::TaskView::TaskView(this); - tabs->addTab(taskPanel, trUtf8("Tasks")); - + tabs->addTab(taskPanel, trUtf8("Tasks")); + // task panel //projectView = new Gui::ProjectWidget(this); - //tabs->addTab(projectView, trUtf8("Project")); + //tabs->addTab(projectView, trUtf8("Project")); } CombiView::~CombiView() diff --git a/src/Gui/Command.cpp b/src/Gui/Command.cpp index f1c4439d2898..ac79a9b0a5bb 100644 --- a/src/Gui/Command.cpp +++ b/src/Gui/Command.cpp @@ -491,14 +491,14 @@ std::string Command::getPythonTuple(const std::string& name, const std::vector::const_iterator last = --subnames.end(); - str << "(App.ActiveDocument." << name << ",["; - for (std::vector::const_iterator it = subnames.begin();it!=subnames.end();++it){ - str << "\"" << *it << "\""; - if (it != last) - str << ","; - } - str << "])"; - return str.str(); + str << "(App.ActiveDocument." << name << ",["; + for (std::vector::const_iterator it = subnames.begin();it!=subnames.end();++it){ + str << "\"" << *it << "\""; + if (it != last) + str << ","; + } + str << "])"; + return str.str(); } const std::string Command::strToPython(const char* Str) @@ -559,6 +559,18 @@ const char * Command::endCmdHelp(void) void Command::applyCommandData(Action* action) { +#if QT_VERSION >= 0x050000 + action->setText(QObject::tr(sMenuText)); + action->setToolTip(QObject::tr(sToolTipText)); + if (sStatusTip) + action->setStatusTip(QObject::tr(sStatusTip)); + else + action->setStatusTip(QObject::tr(sToolTipText)); + if (sWhatsThis) + action->setWhatsThis(QObject::tr(sWhatsThis)); + else + action->setWhatsThis(QObject::tr(sToolTipText)); +#else action->setText(QCoreApplication::translate( this->className(), sMenuText, 0, QCoreApplication::UnicodeUTF8)); @@ -581,9 +593,10 @@ void Command::applyCommandData(Action* action) action->setWhatsThis(QCoreApplication::translate( this->className(), sToolTipText, 0, QCoreApplication::UnicodeUTF8)); +#endif QString accel = action->shortcut().toString(); if (!accel.isEmpty()) { - QString tip = QString::fromAscii("(%1)\t%2") + QString tip = QString::fromLatin1("(%1)\t%2") .arg(accel).arg(action->statusTip()); action->setStatusTip(tip); } @@ -594,7 +607,7 @@ const char* Command::keySequenceToAccel(int sk) const QKeySequence::StandardKey type = (QKeySequence::StandardKey)sk; QKeySequence ks(type); QString qs = ks.toString(); - QByteArray data = qs.toAscii(); + QByteArray data = qs.toLatin1(); #if defined (_MSC_VER) return _strdup((const char*)data); #else @@ -650,7 +663,7 @@ Action * Command::createAction(void) applyCommandData(pcAction); if (sPixmap) pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap)); - pcAction->setShortcut(QString::fromAscii(sAccel)); + pcAction->setShortcut(QString::fromLatin1(sAccel)); return pcAction; } @@ -702,7 +715,7 @@ Action * MacroCommand::createAction(void) pcAction->setWhatsThis(QString::fromUtf8(sWhatsThis)); if ( sPixmap ) pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap)); - pcAction->setShortcut(QString::fromAscii(sAccel)); + pcAction->setShortcut(QString::fromLatin1(sAccel)); return pcAction; } @@ -872,7 +885,7 @@ Action * PythonCommand::createAction(void) pcAction->setStatusTip(qApp->translate(getName(), getToolTipText())); if (strcmp(getResource("Pixmap"),"") != 0) pcAction->setIcon(Gui::BitmapFactory().pixmap(getResource("Pixmap"))); - pcAction->setShortcut (QString::fromAscii(getAccel())); + pcAction->setShortcut (QString::fromLatin1(getAccel())); return pcAction; } diff --git a/src/Gui/CommandDoc.cpp b/src/Gui/CommandDoc.cpp index 83eb70ee60db..a659f447da42 100644 --- a/src/Gui/CommandDoc.cpp +++ b/src/Gui/CommandDoc.cpp @@ -136,7 +136,7 @@ void StdCmdOpen::activated(int iMsg) // load the files with the associated modules SelectModule::Dict dict = SelectModule::importHandler(fileList, selectedFilter); for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) { - getGuiApplication()->open(it.key().toUtf8(), it.value().toAscii()); + getGuiApplication()->open(it.key().toUtf8(), it.value().toLatin1()); } } @@ -199,7 +199,7 @@ void StdCmdImport::activated(int iMsg) for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) { getGuiApplication()->importFrom(it.key().toUtf8(), getActiveGuiDocument()->getDocument()->getName(), - it.value().toAscii()); + it.value().toLatin1()); } std::list views = getActiveGuiDocument()->getMDIViewsOfType(Gui::View3DInventor::getClassTypeId()); @@ -264,7 +264,7 @@ void StdCmdExport::activated(int iMsg) for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) { getGuiApplication()->exportTo(it.key().toUtf8(), getActiveGuiDocument()->getDocument()->getName(), - it.value().toAscii()); + it.value().toLatin1()); } } } @@ -378,9 +378,9 @@ void StdCmdExportGraphviz::activated(int iMsg) #endif bool pathChanged = false; #ifdef FC_OS_WIN32 - QString exe = QString::fromAscii("\"%1/dot\"").arg(path); + QString exe = QString::fromLatin1("\"%1/dot\"").arg(path); #else - QString exe = QString::fromAscii("%1/dot").arg(path); + QString exe = QString::fromLatin1("%1/dot").arg(path); #endif proc.setEnvironment(QProcess::systemEnvironment()); do { @@ -399,9 +399,9 @@ void StdCmdExportGraphviz::activated(int iMsg) return; pathChanged = true; #ifdef FC_OS_WIN32 - exe = QString::fromAscii("\"%1/dot\"").arg(path); + exe = QString::fromLatin1("\"%1/dot\"").arg(path); #else - exe = QString::fromAscii("%1/dot").arg(path); + exe = QString::fromLatin1("%1/dot").arg(path); #endif } else { @@ -745,7 +745,7 @@ Action * StdCmdUndo::createAction(void) applyCommandData(pcAction); if (sPixmap) pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap)); - pcAction->setShortcut(QString::fromAscii(sAccel)); + pcAction->setShortcut(QString::fromLatin1(sAccel)); return pcAction; } @@ -788,7 +788,7 @@ Action * StdCmdRedo::createAction(void) applyCommandData(pcAction); if (sPixmap) pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap)); - pcAction->setShortcut(QString::fromAscii(sAccel)); + pcAction->setShortcut(QString::fromLatin1(sAccel)); return pcAction; } diff --git a/src/Gui/CommandStd.cpp b/src/Gui/CommandStd.cpp index 23a4166b8a07..d35a9df3d13d 100644 --- a/src/Gui/CommandStd.cpp +++ b/src/Gui/CommandStd.cpp @@ -91,7 +91,7 @@ void StdCmdWorkbench::activated(int i) try { Workbench* w = WorkbenchManager::instance()->active(); QList items = static_cast(_pcAction)->actions(); - std::string switch_to = (const char*)items[i]->objectName().toAscii(); + std::string switch_to = (const char*)items[i]->objectName().toLatin1(); if (w) { std::string current_w = w->name(); if (switch_to == current_w) @@ -128,7 +128,7 @@ Action * StdCmdWorkbench::createAction(void) applyCommandData(pcAction); if (sPixmap) pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap)); - pcAction->setShortcut(QString::fromAscii(sAccel)); + pcAction->setShortcut(QString::fromLatin1(sAccel)); return pcAction; } @@ -196,6 +196,11 @@ Action * StdCmdAbout::createAction(void) QString exe = qApp->applicationName(); pcAction = new Action(this,getMainWindow()); +#if QT_VERSION >= 0x050000 + pcAction->setText(QObject::tr(sMenuText).arg(exe)); + pcAction->setToolTip(QObject::tr(sToolTipText).arg(exe)); + pcAction->setStatusTip(QObject::tr(sStatusTip).arg(exe)); +#else pcAction->setText(QCoreApplication::translate( this->className(), sMenuText, 0, QCoreApplication::CodecForTr).arg(exe)); @@ -205,9 +210,10 @@ Action * StdCmdAbout::createAction(void) pcAction->setStatusTip(QCoreApplication::translate( this->className(), sStatusTip, 0, QCoreApplication::CodecForTr).arg(exe)); +#endif pcAction->setWhatsThis(QLatin1String(sWhatsThis)); pcAction->setIcon(QApplication::windowIcon()); - pcAction->setShortcut(QString::fromAscii(sAccel)); + pcAction->setShortcut(QString::fromLatin1(sAccel)); return pcAction; } @@ -231,16 +237,21 @@ void StdCmdAbout::languageChange() { if (_pcAction) { QString exe = qApp->applicationName(); - _pcAction->setText(QCoreApplication::translate( - this->className(), sMenuText, 0, - QCoreApplication::CodecForTr).arg(exe)); - _pcAction->setToolTip(QCoreApplication::translate( - this->className(), sToolTipText, 0, - QCoreApplication::CodecForTr).arg(exe)); - _pcAction->setStatusTip(QCoreApplication::translate( - this->className(), sStatusTip, 0, - QCoreApplication::CodecForTr).arg(exe)); - _pcAction->setWhatsThis(QLatin1String(sWhatsThis)); +#if QT_VERSION >= 0x050000 + _pcAction->setText(QObject::tr(sMenuText).arg(exe)); + _pcAction->setToolTip(QObject::tr(sToolTipText).arg(exe)); + _pcAction->setStatusTip(QObject::tr(sStatusTip).arg(exe)); +#else + _pcAction->setText(QCoreApplication::translate( + this->className(), sMenuText, 0, + QCoreApplication::CodecForTr).arg(exe)); + _pcAction->setToolTip(QCoreApplication::translate( + this->className(), sToolTipText, 0, + QCoreApplication::CodecForTr).arg(exe)); + _pcAction->setStatusTip(QCoreApplication::translate( + this->className(), sStatusTip, 0, + QCoreApplication::CodecForTr).arg(exe)); +#endif } } diff --git a/src/Gui/CommandTest.cpp b/src/Gui/CommandTest.cpp index a02a7d8e8d2f..befd2b51c32b 100644 --- a/src/Gui/CommandTest.cpp +++ b/src/Gui/CommandTest.cpp @@ -67,8 +67,8 @@ Std_TestQM::Std_TestQM() void Std_TestQM::activated(int iMsg) { QStringList files = QFileDialog::getOpenFileNames(getMainWindow(), - QString::fromAscii("Test translation"), QString(), - QString::fromAscii("Translation (*.qm)")); + QString::fromLatin1("Test translation"), QString(), + QString::fromLatin1("Translation (*.qm)")); if (!files.empty()) { Translator::instance()->activateLanguage("English"); QList i18n = qApp->findChildren(); diff --git a/src/Gui/CommandView.cpp b/src/Gui/CommandView.cpp index ca5027dc0b57..44795c1dbd00 100644 --- a/src/Gui/CommandView.cpp +++ b/src/Gui/CommandView.cpp @@ -229,17 +229,17 @@ Action * StdCmdFreezeViews::createAction(void) // add the action items saveView = pcAction->addAction(QObject::tr("Save views...")); pcAction->addAction(QObject::tr("Load views...")); - pcAction->addAction(QString::fromAscii(""))->setSeparator(true); + pcAction->addAction(QString::fromLatin1(""))->setSeparator(true); freezeView = pcAction->addAction(QObject::tr("Freeze view")); - freezeView->setShortcut(QString::fromAscii(sAccel)); + freezeView->setShortcut(QString::fromLatin1(sAccel)); clearView = pcAction->addAction(QObject::tr("Clear views")); - separator = pcAction->addAction(QString::fromAscii("")); + separator = pcAction->addAction(QString::fromLatin1("")); separator->setSeparator(true); offset = pcAction->actions().count(); // allow up to 50 views for (int i=0; iaddAction(QString::fromAscii(""))->setVisible(false); + pcAction->addAction(QString::fromLatin1(""))->setVisible(false); return pcAction; } @@ -266,7 +266,7 @@ void StdCmdFreezeViews::activated(int iMsg) savedViews++; QString viewnr = QString(QObject::tr("Restore view &%1")).arg(index+1); (*it)->setText(viewnr); - (*it)->setToolTip(QString::fromAscii(ppReturn)); + (*it)->setToolTip(QString::fromLatin1(ppReturn)); (*it)->setVisible(true); if (index < 9) { int accel = Qt::CTRL+Qt::Key_1; @@ -286,8 +286,8 @@ void StdCmdFreezeViews::activated(int iMsg) // Activate a view QList acts = pcAction->actions(); QString data = acts[iMsg]->toolTip(); - QString send = QString::fromAscii("SetCamera %1").arg(data); - getGuiApplication()->sendMsgToActiveView(send.toAscii()); + QString send = QString::fromLatin1("SetCamera %1").arg(data); + getGuiApplication()->sendMsgToActiveView(send.toLatin1()); } } @@ -316,14 +316,14 @@ void StdCmdFreezeViews::onSaveViews() // remove the first line because it's a comment like '#Inventor V2.1 ascii' QString viewPos; if ( !data.isEmpty() ) { - QStringList lines = data.split(QString::fromAscii("\n")); + QStringList lines = data.split(QString::fromLatin1("\n")); if ( lines.size() > 1 ) { lines.pop_front(); - viewPos = lines.join(QString::fromAscii(" ")); + viewPos = lines.join(QString::fromLatin1(" ")); } } - str << " " << endl; + str << " " << endl; } str << " " << endl; @@ -364,7 +364,7 @@ void StdCmdFreezeViews::onRestoreViews() if (!xmlDocument.setContent(&file, true, &errorStr, &errorLine, &errorColumn)) { std::cerr << "Parse error in XML content at line " << errorLine << ", column " << errorColumn << ": " - << (const char*)errorStr.toAscii() << std::endl; + << (const char*)errorStr.toLatin1() << std::endl; return; } @@ -376,18 +376,18 @@ void StdCmdFreezeViews::onRestoreViews() } bool ok; - int scheme = root.attribute(QString::fromAscii("SchemaVersion")).toInt(&ok); + int scheme = root.attribute(QString::fromLatin1("SchemaVersion")).toInt(&ok); if (!ok) return; // SchemeVersion "1" if (scheme == 1) { // read the views, ignore the attribute 'Count' - QDomElement child = root.firstChildElement(QString::fromAscii("Views")); - QDomElement views = child.firstChildElement(QString::fromAscii("Camera")); + QDomElement child = root.firstChildElement(QString::fromLatin1("Views")); + QDomElement views = child.firstChildElement(QString::fromLatin1("Camera")); QStringList cameras; while (!views.isNull()) { - QString setting = views.attribute(QString::fromAscii("settings")); + QString setting = views.attribute(QString::fromLatin1("settings")); cameras << setting; - views = views.nextSiblingElement(QString::fromAscii("Camera")); + views = views.nextSiblingElement(QString::fromLatin1("Camera")); } // use this rather than the attribute 'Count' because it could be @@ -592,7 +592,23 @@ void StdCmdDrawStyle::languageChange() return; Gui::ActionGroup* pcAction = qobject_cast(_pcAction); QList a = pcAction->actions(); - + +#if QT_VERSION >= 0x050000 + a[0]->setText(QObject::tr("As is")); + a[0]->setToolTip(QObject::tr("Normal mode")); + + a[1]->setText(QObject::tr("Flat lines")); + a[1]->setToolTip(QObject::tr("Flat lines mode")); + + a[2]->setText(QObject::tr("Shaded")); + a[2]->setToolTip(QObject::tr("Shaded mode")); + + a[3]->setText(QObject::tr("Wireframe")); + a[3]->setToolTip(QObject::tr("Wireframe mode")); + + a[4]->setText(QObject::tr("Points")); + a[4]->setToolTip(QObject::tr("Points mode")); +#else a[0]->setText(QCoreApplication::translate( "Std_DrawStyle", "As is", 0, QCoreApplication::CodecForTr)); @@ -627,6 +643,7 @@ void StdCmdDrawStyle::languageChange() a[4]->setToolTip(QCoreApplication::translate( "Std_DrawStyle", "Points mode", 0, QCoreApplication::CodecForTr)); +#endif } void StdCmdDrawStyle::updateIcon(const MDIView *view) @@ -1322,6 +1339,28 @@ Action * StdViewDockUndockFullscreen::createAction(void) { ActionGroup* pcAction = new ActionGroup(this, getMainWindow()); pcAction->setDropDownMenu(true); +#if QT_VERSION >= 0x050000 + pcAction->setText(QObject::tr(sMenuText)); + + QAction* docked = pcAction->addAction(QObject::tr(QT_TR_NOOP("Docked"))); + docked->setToolTip(QObject::tr(sToolTipText)); + docked->setStatusTip(QObject::tr(sStatusTip)); + docked->setWhatsThis(QObject::tr(sWhatsThis)); + docked->setShortcut(Qt::Key_D); + docked->setCheckable(true); + + QAction* undocked = pcAction->addAction(QObject::tr(QT_TR_NOOP("Undocked"))); + undocked->setToolTip(QObject::tr(sToolTipText)); + undocked->setStatusTip(QObject::tr(sStatusTip)); + undocked->setWhatsThis(QObject::tr(sWhatsThis)); + undocked->setShortcut(Qt::Key_U); + undocked->setCheckable(true); + + QAction* fullscr = pcAction->addAction(QObject::tr(QT_TR_NOOP("Fullscreen"))); + fullscr->setToolTip(QObject::tr(sToolTipText)); + fullscr->setStatusTip(QObject::tr(sStatusTip)); + fullscr->setWhatsThis(QObject::tr(sWhatsThis)); +#else pcAction->setText(QCoreApplication::translate( this->className(), sMenuText, 0, QCoreApplication::CodecForTr)); @@ -1362,6 +1401,7 @@ Action * StdViewDockUndockFullscreen::createAction(void) fullscr->setWhatsThis(QCoreApplication::translate( this->className(), sWhatsThis, 0, QCoreApplication::CodecForTr)); +#endif fullscr->setShortcut(Qt::Key_F11); fullscr->setCheckable(true); fullscr->setIcon(Gui::BitmapFactory().pixmap("view-fullscreen")); @@ -1438,12 +1478,12 @@ void StdViewScreenShot::activated(int iMsg) Base::Reference hExt = App::GetApplication().GetUserParameter().GetGroup("BaseApp") ->GetGroup("Preferences")->GetGroup("General"); - QString ext = QString::fromAscii(hExt->GetASCII("OffscreenImageFormat").c_str()); + QString ext = QString::fromLatin1(hExt->GetASCII("OffscreenImageFormat").c_str()); QStringList filter; QString selFilter; for (QStringList::Iterator it = formats.begin(); it != formats.end(); ++it) { - filter << QString::fromAscii("%1 %2 (*.%3)").arg((*it).toUpper()). + filter << QString::fromLatin1("%1 %2 (*.%3)").arg((*it).toUpper()). arg(QObject::tr("files")).arg((*it).toLower()); if (ext == *it) selFilter = filter.last(); @@ -1453,7 +1493,7 @@ void StdViewScreenShot::activated(int iMsg) fd.setFileMode(QFileDialog::AnyFile); fd.setAcceptMode(QFileDialog::AcceptSave); fd.setWindowTitle(QObject::tr("Save picture")); - fd.setFilters(filter); + fd.setNameFilters(filter); if (!selFilter.isEmpty()) fd.selectNameFilter(selFilter); @@ -1464,7 +1504,7 @@ void StdViewScreenShot::activated(int iMsg) fd.setOptionsWidget(FileOptionsDialog::ExtensionRight, opt); fd.setConfirmOverwrite(true); - opt->onSelectedFilter(fd.selectedFilter()); + opt->onSelectedFilter(fd.selectedNameFilter()); QObject::connect(&fd, SIGNAL(filterSelected(const QString&)), opt, SLOT(onSelectedFilter(const QString&))); @@ -1490,7 +1530,7 @@ void StdViewScreenShot::activated(int iMsg) } } - hExt->SetASCII("OffscreenImageFormat", (const char*)format.toAscii()); + hExt->SetASCII("OffscreenImageFormat", (const char*)format.toLatin1()); // which background chosen const char* background; diff --git a/src/Gui/CommandWindow.cpp b/src/Gui/CommandWindow.cpp index 7411359993cb..a8702d0044f4 100644 --- a/src/Gui/CommandWindow.cpp +++ b/src/Gui/CommandWindow.cpp @@ -382,7 +382,7 @@ Action * StdCmdStatusBar::createAction(void) void StdCmdStatusBar::activated(int iMsg) { - getMainWindow()->statusBar()->setShown(iMsg != 0); + getMainWindow()->statusBar()->setVisible(iMsg != 0); } bool StdCmdStatusBar::isActive() @@ -434,6 +434,11 @@ Action * StdCmdWindowsMenu::createAction(void) for ( int i=0; i<10; i++ ) { QAction* window = pcAction->addAction(QObject::tr(sToolTipText)); window->setCheckable(true); +#if QT_VERSION >= 0x050000 + window->setToolTip(QObject::tr(sToolTipText)); + window->setStatusTip(QObject::tr(sStatusTip)); + window->setWhatsThis(QObject::tr(sWhatsThis)); +#else window->setToolTip(QCoreApplication::translate( this->className(), sToolTipText, 0, QCoreApplication::CodecForTr)); @@ -443,6 +448,7 @@ Action * StdCmdWindowsMenu::createAction(void) window->setWhatsThis(QCoreApplication::translate( this->className(), sWhatsThis, 0, QCoreApplication::CodecForTr)); +#endif } QAction* sep = pcAction->addAction(QLatin1String("")); diff --git a/src/Gui/Control.cpp b/src/Gui/Control.cpp index f5ca988cca06..de9d84617abf 100644 --- a/src/Gui/Control.cpp +++ b/src/Gui/Control.cpp @@ -26,6 +26,8 @@ #ifndef _PreComp_ # include # include +# include +# include #endif /// Here the FreeCAD includes sorted by Base,App,Gui...... diff --git a/src/Gui/Control.h b/src/Gui/Control.h index a6ec1009966f..f2a64e73d833 100644 --- a/src/Gui/Control.h +++ b/src/Gui/Control.h @@ -32,6 +32,8 @@ #include +class QTabWidget; + namespace App { class DocumentObject; diff --git a/src/Gui/DemoMode.cpp b/src/Gui/DemoMode.cpp index 50217352e3fe..ea5691e6cdd7 100644 --- a/src/Gui/DemoMode.cpp +++ b/src/Gui/DemoMode.cpp @@ -45,7 +45,7 @@ using namespace Gui::Dialog; /* TRANSLATOR Gui::Dialog::DemoMode */ -DemoMode::DemoMode(QWidget* parent, Qt::WFlags fl) +DemoMode::DemoMode(QWidget* parent, Qt::WindowFlags fl) : QDialog(0, fl|Qt::WindowStaysOnTopHint), viewAxis(0,0,-1), ui(new Ui_DemoMode) { // create widgets diff --git a/src/Gui/DemoMode.h b/src/Gui/DemoMode.h index 1f4fb67ead17..e08c91926eb0 100644 --- a/src/Gui/DemoMode.h +++ b/src/Gui/DemoMode.h @@ -44,7 +44,7 @@ class GuiExport DemoMode : public QDialog Q_OBJECT public: - DemoMode(QWidget* parent = 0, Qt::WFlags fl = 0); + DemoMode(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DemoMode(); void accept(); diff --git a/src/Gui/DlgActionsImp.cpp b/src/Gui/DlgActionsImp.cpp index 664277bcbb37..e48a2f5b3974 100644 --- a/src/Gui/DlgActionsImp.cpp +++ b/src/Gui/DlgActionsImp.cpp @@ -67,7 +67,11 @@ DlgCustomActionsImp::DlgCustomActionsImp( QWidget* parent ) actionListWidget->setHeaderLabels(labels); actionListWidget->header()->hide(); actionListWidget->setIconSize(QSize(32, 32)); - actionListWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents); +#if QT_VERSION >= 0x050000 + actionListWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); +#else + actionListWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents); +#endif showActions(); } @@ -194,7 +198,7 @@ void DlgCustomActionsImp::on_actionListWidget_itemActivated(QTreeWidgetItem *ite actionMenu -> setText(QString::fromUtf8(pScript->getMenuText())); actionToolTip -> setText(QString::fromUtf8(pScript->getToolTipText())); actionStatus -> setText(QString::fromUtf8(pScript->getStatusTip())); - actionAccel -> setText(QString::fromAscii(pScript->getAccel())); + actionAccel -> setText(QString::fromLatin1(pScript->getAccel())); pixmapLabel->clear(); m_sPixmap = QString::null; const char* name = pScript->getPixmap(); @@ -222,7 +226,7 @@ void DlgCustomActionsImp::on_buttonAddAction_clicked() } // search for the command in the manager - QByteArray actionName = newActionName().toAscii(); + QByteArray actionName = newActionName().toLatin1(); CommandManager& rclMan = Application::Instance->commandManager(); MacroCommand* macro = new MacroCommand(actionName); rclMan.addCommand( macro ); @@ -256,12 +260,12 @@ void DlgCustomActionsImp::on_buttonAddAction_clicked() actionStatus->clear(); if (!m_sPixmap.isEmpty()) - macro->setPixmap(m_sPixmap.toAscii()); + macro->setPixmap(m_sPixmap.toLatin1()); pixmapLabel->clear(); m_sPixmap = QString::null; if (!actionAccel->text().isEmpty()) { - macro->setAccel(actionAccel->text().toAscii()); + macro->setAccel(actionAccel->text().toLatin1()); } actionAccel->clear(); @@ -311,12 +315,12 @@ void DlgCustomActionsImp::on_buttonReplaceAction_clicked() actionStatus->clear(); if (!m_sPixmap.isEmpty()) - macro->setPixmap(m_sPixmap.toAscii()); + macro->setPixmap(m_sPixmap.toLatin1()); pixmapLabel->clear(); m_sPixmap = QString::null; if (!actionAccel->text().isEmpty()) { - macro->setAccel(actionAccel->text().toAscii()); + macro->setAccel(actionAccel->text().toLatin1()); } actionAccel->clear(); @@ -331,7 +335,7 @@ void DlgCustomActionsImp::on_buttonReplaceAction_clicked() action->setStatusTip(QString::fromUtf8(macro->getStatusTip())); if( macro->getPixmap() ) action->setIcon(Gui::BitmapFactory().pixmap(macro->getPixmap())); - action->setShortcut(QString::fromAscii(macro->getAccel())); + action->setShortcut(QString::fromLatin1(macro->getAccel())); } // emit signal to notify the container widget @@ -413,7 +417,7 @@ void IconDialog::onAddIconPath() QStringList filters; QList formats = QImageReader::supportedImageFormats(); for (QList::iterator it = formats.begin(); it != formats.end(); ++it) - filters << QString::fromAscii("*.%1").arg(QString::fromAscii(*it).toLower()); + filters << QString::fromLatin1("*.%1").arg(QString::fromLatin1(*it).toLower()); QDir d(dir); d.setNameFilters(filters); QFileInfoList fi = d.entryInfoList(); @@ -461,7 +465,7 @@ QString DlgCustomActionsImp::newActionName() do { bUsed = false; - sName = QString::fromAscii("Std_Macro_%1").arg( id++ ); + sName = QString::fromLatin1("Std_Macro_%1").arg( id++ ); std::vector::iterator it; for ( it = aclCurMacros.begin(); it!= aclCurMacros.end(); ++it ) diff --git a/src/Gui/DlgActivateWindowImp.cpp b/src/Gui/DlgActivateWindowImp.cpp index 1bde7c2bc5cb..1df85543c028 100644 --- a/src/Gui/DlgActivateWindowImp.cpp +++ b/src/Gui/DlgActivateWindowImp.cpp @@ -41,7 +41,7 @@ using namespace Gui::Dialog; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgActivateWindowImp::DlgActivateWindowImp( QWidget* parent, Qt::WFlags fl ) +DlgActivateWindowImp::DlgActivateWindowImp( QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl ) { // create widgets diff --git a/src/Gui/DlgActivateWindowImp.h b/src/Gui/DlgActivateWindowImp.h index fcd90c72444e..723cf85e543f 100644 --- a/src/Gui/DlgActivateWindowImp.h +++ b/src/Gui/DlgActivateWindowImp.h @@ -40,7 +40,7 @@ class DlgActivateWindowImp : public QDialog, public Ui_DlgActivateWindow Q_OBJECT public: - DlgActivateWindowImp( QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgActivateWindowImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~DlgActivateWindowImp(); protected: diff --git a/src/Gui/DlgCommandsImp.cpp b/src/Gui/DlgCommandsImp.cpp index 4697e9f3f059..5afa93a7f069 100644 --- a/src/Gui/DlgCommandsImp.cpp +++ b/src/Gui/DlgCommandsImp.cpp @@ -113,7 +113,11 @@ DlgCustomCommandsImp::DlgCustomCommandsImp( QWidget* parent ) commandTreeWidget->setHeaderLabels(labels); commandTreeWidget->header()->hide(); commandTreeWidget->setIconSize(QSize(32, 32)); +#if QT_VERSION >= 0x050000 + commandTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); +#else commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents); +#endif categoryTreeWidget->setCurrentItem(categoryTreeWidget->topLevelItem(0)); } @@ -143,7 +147,7 @@ void DlgCustomCommandsImp::onGroupActivated(QTreeWidgetItem* item) commandTreeWidget->clear(); CommandManager & cCmdMgr = Application::Instance->commandManager(); - std::vector aCmds = cCmdMgr.getGroupCommands(group.toAscii()); + std::vector aCmds = cCmdMgr.getGroupCommands(group.toLatin1()); for (std::vector::iterator it = aCmds.begin(); it != aCmds.end(); ++it) { QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget); item->setText(1, qApp->translate((*it)->className(), (*it)->getMenuText())); diff --git a/src/Gui/DlgCustomizeImp.cpp b/src/Gui/DlgCustomizeImp.cpp index 4659c5d22cd1..51cd81acc4b1 100644 --- a/src/Gui/DlgCustomizeImp.cpp +++ b/src/Gui/DlgCustomizeImp.cpp @@ -40,7 +40,7 @@ QList DlgCustomizeImp::_pages; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgCustomizeImp::DlgCustomizeImp(QWidget* parent, Qt::WFlags fl) +DlgCustomizeImp::DlgCustomizeImp(QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl) { setModal(false); diff --git a/src/Gui/DlgCustomizeImp.h b/src/Gui/DlgCustomizeImp.h index 41a04752dc67..a5e2454037e8 100644 --- a/src/Gui/DlgCustomizeImp.h +++ b/src/Gui/DlgCustomizeImp.h @@ -51,7 +51,7 @@ class DlgCustomizeImp : public QDialog Q_OBJECT public: - DlgCustomizeImp(QWidget* parent = 0, Qt::WFlags fl = 0); + DlgCustomizeImp(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DlgCustomizeImp(); static void addPage(const char* className); diff --git a/src/Gui/DlgCustomizeSpaceball.cpp b/src/Gui/DlgCustomizeSpaceball.cpp index dc89ce9fcc01..5053e5d23347 100644 --- a/src/Gui/DlgCustomizeSpaceball.cpp +++ b/src/Gui/DlgCustomizeSpaceball.cpp @@ -116,7 +116,7 @@ void ButtonModel::insertRows(int number) { QString groupName; groupName.setNum(index); - Base::Reference newGroup = spaceballButtonGroup()->GetGroup(groupName.toAscii());//builds the group. + Base::Reference newGroup = spaceballButtonGroup()->GetGroup(groupName.toLatin1());//builds the group. newGroup->SetASCII("Command", ""); } endInsertRows(); @@ -126,14 +126,14 @@ void ButtonModel::insertRows(int number) void ButtonModel::setCommand(int row, QString command) { GroupVector groupVector = spaceballButtonGroup()->GetGroups(); - groupVector.at(row)->SetASCII("Command", command.toAscii()); + groupVector.at(row)->SetASCII("Command", command.toLatin1()); } void ButtonModel::goButtonPress(int number) { QString numberString; numberString.setNum(number); - if (!spaceballButtonGroup()->HasGroup(numberString.toAscii())) + if (!spaceballButtonGroup()->HasGroup(numberString.toLatin1())) insertRows(number); } @@ -314,19 +314,19 @@ QVariant CommandModel::data(const QModelIndex &index, int role) const if (role == Qt::UserRole) { if (node->nodeType == CommandNode::CommandType) - return QVariant(QString::fromAscii(node->aCommand->getName())); + return QVariant(QString::fromLatin1(node->aCommand->getName())); if (node->nodeType == CommandNode::GroupType) { if (node->children.size() < 1) return QVariant(); CommandNode *childNode = node->children.at(0); - return QVariant(QString::fromAscii(childNode->aCommand->getGroupName())); + return QVariant(QString::fromLatin1(childNode->aCommand->getGroupName())); } return QVariant(); } if (role == Qt::ToolTipRole) if (node->nodeType == CommandNode::CommandType) - return QVariant(QString::fromAscii(node->aCommand->getToolTipText())); + return QVariant(QString::fromLatin1(node->aCommand->getToolTipText())); return QVariant(); } @@ -358,7 +358,7 @@ CommandNode* CommandModel::nodeFromIndex(const QModelIndex &index) const void CommandModel::goAddMacro(const QByteArray ¯oName) { - QModelIndexList indexList(this->match(this->index(0,0), Qt::UserRole, QVariant(QString::fromAscii("Macros")), + QModelIndexList indexList(this->match(this->index(0,0), Qt::UserRole, QVariant(QString::fromLatin1("Macros")), 1, Qt::MatchWrap | Qt::MatchRecursive)); QModelIndex macrosIndex; if (indexList.size() < 1) @@ -366,7 +366,7 @@ void CommandModel::goAddMacro(const QByteArray ¯oName) //this is the first macro and we have to add the Macros item. //figure out where to insert it. Should be in the command groups now. QStringList groups = orderedGroups(); - int location(groups.indexOf(QString::fromAscii("Macros"))); + int location(groups.indexOf(QString::fromLatin1("Macros"))); if (location == -1) location = groups.size(); //add row @@ -399,7 +399,7 @@ void CommandModel::goAddMacro(const QByteArray ¯oName) void CommandModel::goRemoveMacro(const QByteArray ¯oName) { - QModelIndexList macroList(this->match(this->index(0,0), Qt::UserRole, QVariant(QString::fromAscii(macroName.data())), + QModelIndexList macroList(this->match(this->index(0,0), Qt::UserRole, QVariant(QString::fromLatin1(macroName.data())), 1, Qt::MatchWrap | Qt::MatchRecursive)); if (macroList.isEmpty()) return; @@ -439,7 +439,7 @@ void CommandModel::groupCommands(const QString& groupName) CommandNode *parentNode = new CommandNode(CommandNode::GroupType); parentNode->parent = rootNode; rootNode->children.push_back(parentNode); - std::vector commands = Application::Instance->commandManager().getGroupCommands(groupName.toAscii()); + std::vector commands = Application::Instance->commandManager().getGroupCommands(groupName.toLatin1()); for (std::vector ::iterator it = commands.begin(); it != commands.end(); ++it) { CommandNode *childNode = new CommandNode(CommandNode::CommandType); @@ -455,7 +455,7 @@ QStringList CommandModel::orderedGroups() std::vector commands = Application::Instance->commandManager().getAllCommands(); for (std::vector ::iterator it = commands.begin(); it != commands.end(); ++it) { - QString groupName(QString::fromAscii((*it)->getGroupName())); + QString groupName(QString::fromLatin1((*it)->getGroupName())); if (!groups.contains(groupName)) groups << groupName; } @@ -628,7 +628,11 @@ void DlgCustomizeSpaceball::goPrint() { QTableView *view = new QTableView(this); PrintModel *model = new PrintModel(this, buttonModel, commandModel); - view->horizontalHeader()->setResizeMode(QHeaderView::Fixed); +#if QT_VERSION >= 0x050000 + view->horizontalHeader()->setSectionResizeMode(QHeaderView::Fixed); +#else + view->horizontalHeader()->setResizeMode(QHeaderView::Fixed); +#endif view->setModel(model); view->horizontalHeader()->resizeSection(0, 150); view->horizontalHeader()->resizeSection(1, 300); diff --git a/src/Gui/DlgDisplayPropertiesImp.cpp b/src/Gui/DlgDisplayPropertiesImp.cpp index 7493bddf5030..211102825e9c 100644 --- a/src/Gui/DlgDisplayPropertiesImp.cpp +++ b/src/Gui/DlgDisplayPropertiesImp.cpp @@ -64,7 +64,7 @@ using namespace std; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgDisplayPropertiesImp::DlgDisplayPropertiesImp( QWidget* parent, Qt::WFlags fl ) +DlgDisplayPropertiesImp::DlgDisplayPropertiesImp( QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl ) { this->setupUi(this); @@ -273,14 +273,14 @@ void DlgDisplayPropertiesImp::on_changeMode_activated(const QString& s) App::Property* prop = (*It)->getPropertyByName("DisplayMode"); if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) { App::PropertyEnumeration* Display = (App::PropertyEnumeration*)prop; - Display->setValue((const char*)s.toAscii()); + Display->setValue((const char*)s.toLatin1()); } } } void DlgDisplayPropertiesImp::on_changePlot_activated(const QString&s) { - Base::Console().Log("Plot = %s\n",(const char*)s.toAscii()); + Base::Console().Log("Plot = %s\n",(const char*)s.toLatin1()); } /** @@ -405,7 +405,7 @@ void DlgDisplayPropertiesImp::setDisplayModes(const std::vectorgetPropertyByName("DisplayMode"); if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) { App::PropertyEnumeration* display = static_cast(prop); - QString activeMode = QString::fromAscii(display->getValueAsString()); + QString activeMode = QString::fromLatin1(display->getValueAsString()); int index = changeMode->findText(activeMode); if (index != -1) { changeMode->setCurrentIndex(index); diff --git a/src/Gui/DlgDisplayPropertiesImp.h b/src/Gui/DlgDisplayPropertiesImp.h index 1f9e07517315..b49d8fe2366b 100644 --- a/src/Gui/DlgDisplayPropertiesImp.h +++ b/src/Gui/DlgDisplayPropertiesImp.h @@ -55,7 +55,7 @@ class DlgDisplayPropertiesImp : public QDialog, public Ui_DlgDisplayProperties, Q_OBJECT public: - DlgDisplayPropertiesImp( QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgDisplayPropertiesImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~DlgDisplayPropertiesImp(); /// Observer message from the Selection void OnChange(Gui::SelectionSingleton::SubjectType &rCaller, diff --git a/src/Gui/DlgEditFileIncludeProptertyExternal.cpp b/src/Gui/DlgEditFileIncludeProptertyExternal.cpp index 860bd66a9112..e4946cae4db5 100644 --- a/src/Gui/DlgEditFileIncludeProptertyExternal.cpp +++ b/src/Gui/DlgEditFileIncludeProptertyExternal.cpp @@ -45,7 +45,7 @@ using namespace Gui::Dialog; */ DlgEditFileIncludePropertyExternal:: DlgEditFileIncludePropertyExternal(App::PropertyFileIncluded& Prop, - QWidget* parent, Qt::WFlags fl) + QWidget* parent, Qt::WindowFlags fl) : DlgRunExternal(parent, fl), Prop(Prop) { @@ -65,7 +65,7 @@ int DlgEditFileIncludePropertyExternal::Do(void) QFileInfo file = QString::fromUtf8(Prop.getValue()); assert(file.exists()); - QString TempFile = QDir::temp().absolutePath() + QString::fromAscii("/") + file.fileName(); + QString TempFile = QDir::temp().absolutePath() + QString::fromLatin1("/") + file.fileName(); QFile::remove(TempFile); QFile::copy(file.absoluteFilePath(),TempFile); diff --git a/src/Gui/DlgEditFileIncludeProptertyExternal.h b/src/Gui/DlgEditFileIncludeProptertyExternal.h index ac3a7b0e634c..4c82c3a0cb59 100644 --- a/src/Gui/DlgEditFileIncludeProptertyExternal.h +++ b/src/Gui/DlgEditFileIncludeProptertyExternal.h @@ -39,7 +39,7 @@ class GuiExport DlgEditFileIncludePropertyExternal : public DlgRunExternal Q_OBJECT public: - DlgEditFileIncludePropertyExternal( App::PropertyFileIncluded& Prop, QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgEditFileIncludePropertyExternal( App::PropertyFileIncluded& Prop, QWidget* parent = 0, Qt::WindowFlags fl = 0 ); virtual ~DlgEditFileIncludePropertyExternal(); int Do(void); diff --git a/src/Gui/DlgEditorImp.cpp b/src/Gui/DlgEditorImp.cpp index c4d1d283dfd4..5e97b2ff9699 100644 --- a/src/Gui/DlgEditorImp.cpp +++ b/src/Gui/DlgEditorImp.cpp @@ -62,70 +62,70 @@ DlgSettingsEditorImp::DlgSettingsEditorImp( QWidget* parent ) col = Qt::black; unsigned long lText = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Text")), lText)); + (QString::fromLatin1(QT_TR_NOOP("Text")), lText)); col = Qt::cyan; unsigned long lBookmarks = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Bookmark")), lBookmarks)); + (QString::fromLatin1(QT_TR_NOOP("Bookmark")), lBookmarks)); col = Qt::red; unsigned long lBreakpnts = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Breakpoint")), lBreakpnts)); + (QString::fromLatin1(QT_TR_NOOP("Breakpoint")), lBreakpnts)); col = Qt::blue; unsigned long lKeywords = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Keyword")), lKeywords)); + (QString::fromLatin1(QT_TR_NOOP("Keyword")), lKeywords)); col.setRgb(0, 170, 0); unsigned long lComments = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Comment")), lComments)); + (QString::fromLatin1(QT_TR_NOOP("Comment")), lComments)); col.setRgb(160, 160, 164); unsigned long lBlockCom = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Block comment")), lBlockCom)); + (QString::fromLatin1(QT_TR_NOOP("Block comment")), lBlockCom)); col = Qt::blue; unsigned long lNumbers = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Number")), lNumbers)); + (QString::fromLatin1(QT_TR_NOOP("Number")), lNumbers)); col = Qt::red; unsigned long lStrings = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("String")), lStrings)); + (QString::fromLatin1(QT_TR_NOOP("String")), lStrings)); col = Qt::red; unsigned long lCharacter = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Character")), lCharacter)); + (QString::fromLatin1(QT_TR_NOOP("Character")), lCharacter)); col.setRgb(255, 170, 0); unsigned long lClass = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Class name")), lClass)); + (QString::fromLatin1(QT_TR_NOOP("Class name")), lClass)); col.setRgb(255, 170, 0); unsigned long lDefine = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Define name")), lDefine)); + (QString::fromLatin1(QT_TR_NOOP("Define name")), lDefine)); col.setRgb(160, 160, 164); unsigned long lOperat = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Operator")), lOperat)); + (QString::fromLatin1(QT_TR_NOOP("Operator")), lOperat)); col.setRgb(170, 170, 127); unsigned long lPyOutput = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Python output")), lPyOutput)); + (QString::fromLatin1(QT_TR_NOOP("Python output")), lPyOutput)); col = Qt::red; unsigned long lPyError = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Python error")), lPyError)); + (QString::fromLatin1(QT_TR_NOOP("Python error")), lPyError)); col.setRgb(224, 224, 224); unsigned long lCLine = (col.red() << 24) | (col.green() << 16) | (col.blue() << 8); d->colormap.push_back(QPair - (QString::fromAscii(QT_TR_NOOP("Current line highlight")), lCLine)); + (QString::fromLatin1(QT_TR_NOOP("Current line highlight")), lCLine)); QStringList labels; labels << tr("Items"); this->displayItems->setHeaderLabels(labels); this->displayItems->header()->hide(); for (QVector >::ConstIterator it = d->colormap.begin(); it != d->colormap.end(); ++it) { QTreeWidgetItem* item = new QTreeWidgetItem(this->displayItems); - item->setText(0, tr((*it).first.toAscii())); + item->setText(0, tr((*it).first.toLatin1())); } pythonSyntax = new PythonSyntaxHighlighter(textEdit1); pythonSyntax->setDocument(textEdit1->document()); @@ -173,10 +173,10 @@ void DlgSettingsEditorImp::saveSettings() // Saves the color map ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Editor"); for (QVector >::ConstIterator it = d->colormap.begin(); it != d->colormap.end(); ++it) - hGrp->SetUnsigned((*it).first.toAscii(), (*it).second); + hGrp->SetUnsigned((*it).first.toLatin1(), (*it).second); hGrp->SetInt( "FontSize", fontSize->value() ); - hGrp->SetASCII( "Font", fontFamily->currentText().toAscii() ); + hGrp->SetASCII( "Font", fontFamily->currentText().toLatin1() ); } void DlgSettingsEditorImp::loadSettings() @@ -188,7 +188,7 @@ void DlgSettingsEditorImp::loadSettings() radioTabs->onRestore(); radioSpaces->onRestore(); - textEdit1->setPlainText(QString::fromAscii( + textEdit1->setPlainText(QString::fromLatin1( "# Short Python sample\n" "import sys\n" "def foo(begin, end):\n" @@ -203,7 +203,7 @@ void DlgSettingsEditorImp::loadSettings() // Restores the color map ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Editor"); for (QVector >::Iterator it = d->colormap.begin(); it != d->colormap.end(); ++it){ - unsigned long col = hGrp->GetUnsigned((*it).first.toAscii(), (*it).second); + unsigned long col = hGrp->GetUnsigned((*it).first.toLatin1(), (*it).second); (*it).second = col; QColor color; color.setRgb((col >> 24) & 0xff, (col >> 16) & 0xff, (col >> 8) & 0xff); @@ -218,7 +218,7 @@ void DlgSettingsEditorImp::loadSettings() QFontDatabase fdb; QStringList familyNames = fdb.families( QFontDatabase::Any ); fontFamily->addItems(familyNames); - int index = familyNames.indexOf(QString::fromAscii(hGrp->GetASCII("Font", "Courier").c_str())); + int index = familyNames.indexOf(QString::fromLatin1(hGrp->GetASCII("Font", "Courier").c_str())); if (index < 0) index = 0; fontFamily->setCurrentIndex(index); on_fontFamily_activated(); @@ -234,7 +234,7 @@ void DlgSettingsEditorImp::changeEvent(QEvent *e) if (e->type() == QEvent::LanguageChange) { int index = 0; for (QVector >::ConstIterator it = d->colormap.begin(); it != d->colormap.end(); ++it) - this->displayItems->topLevelItem(index++)->setText(0, tr((*it).first.toAscii())); + this->displayItems->topLevelItem(index++)->setText(0, tr((*it).first.toLatin1())); this->retranslateUi(this); } else { QWidget::changeEvent(e); diff --git a/src/Gui/DlgGeneralImp.cpp b/src/Gui/DlgGeneralImp.cpp index 70e70dbee455..ee81f51c58b9 100644 --- a/src/Gui/DlgGeneralImp.cpp +++ b/src/Gui/DlgGeneralImp.cpp @@ -121,7 +121,7 @@ void DlgGeneralImp::saveSettings() QVariant data = AutoloadModuleCombo->itemData(index); QString startWbName = data.toString(); App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/General")-> - SetASCII("AutoloadModule", startWbName.toAscii()); + SetASCII("AutoloadModule", startWbName.toLatin1()); AutoloadTabCombo->onSave(); RecentFiles->onSave(); @@ -133,7 +133,7 @@ void DlgGeneralImp::saveSettings() setRecentFileSize(); ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("General"); QString lang = QLocale::languageToString(QLocale::system().language()); - QByteArray language = hGrp->GetASCII("Language", (const char*)lang.toAscii()).c_str(); + QByteArray language = hGrp->GetASCII("Language", (const char*)lang.toLatin1()).c_str(); QByteArray current = Languages->itemData(Languages->currentIndex()).toByteArray(); if (current != language) { @@ -209,14 +209,14 @@ void DlgGeneralImp::loadSettings() // search for the language files ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("General"); QString lang = QLocale::languageToString(QLocale::system().language()); - QByteArray language = hGrp->GetASCII("Language", (const char*)lang.toAscii()).c_str(); + QByteArray language = hGrp->GetASCII("Language", (const char*)lang.toLatin1()).c_str(); int index = 1; - Languages->addItem(QString::fromAscii("English"), QByteArray("English")); + Languages->addItem(QString::fromLatin1("English"), QByteArray("English")); TStringMap list = Translator::instance()->supportedLocales(); for (TStringMap::iterator it = list.begin(); it != list.end(); ++it, index++) { - QLocale locale(QString::fromAscii(it->second.c_str())); + QLocale locale(QString::fromLatin1(it->second.c_str())); QByteArray lang = it->first.c_str(); - QString langname = QString::fromAscii(lang.constData()); + QString langname = QString::fromLatin1(lang.constData()); #if QT_VERSION >= 0x040800 QString native = locale.nativeLanguageName(); if (!native.isEmpty()) { @@ -246,7 +246,7 @@ void DlgGeneralImp::loadSettings() // List all .css files QMap cssFiles; QDir dir; - QString filter = QString::fromAscii("*.css"); + QString filter = QString::fromLatin1("*.css"); QFileInfoList fileNames; // read from user directory @@ -270,7 +270,7 @@ void DlgGeneralImp::loadSettings() // read from the built-in directory dir.setPath(QLatin1String(":/stylesheets")); fileNames = dir.entryInfoList(QStringList(filter), QDir::Files, QDir::Name); - this->StyleSheets->addItem(tr("No style sheet"), QString::fromAscii("")); + this->StyleSheets->addItem(tr("No style sheet"), QString::fromLatin1("")); for (QFileInfoList::iterator it = fileNames.begin(); it != fileNames.end(); ++it) { if (cssFiles.find(it->baseName()) == cssFiles.end()) { cssFiles[it->baseName()] = it->absoluteFilePath(); @@ -282,7 +282,7 @@ void DlgGeneralImp::loadSettings() this->StyleSheets->addItem(it.key(), it.value()); } - this->selectedStyleSheet = QString::fromAscii(hGrp->GetASCII("StyleSheet").c_str()); + this->selectedStyleSheet = QString::fromLatin1(hGrp->GetASCII("StyleSheet").c_str()); index = this->StyleSheets->findData(this->selectedStyleSheet); if (index > -1) this->StyleSheets->setCurrentIndex(index); } diff --git a/src/Gui/DlgInputDialogImp.cpp b/src/Gui/DlgInputDialogImp.cpp index 18493a2daac8..739dd7f6d1b7 100644 --- a/src/Gui/DlgInputDialogImp.cpp +++ b/src/Gui/DlgInputDialogImp.cpp @@ -67,7 +67,7 @@ DlgInputDialogImp::~DlgInputDialogImp() void DlgInputDialogImp::textChanged( const QString &s ) { - bool on = TRUE; + bool on = true; if (lineEdit->validator()) { QString str = lineEdit->text(); diff --git a/src/Gui/DlgInputDialogImp.h b/src/Gui/DlgInputDialogImp.h index 4dfcc298de72..58d69441cd56 100644 --- a/src/Gui/DlgInputDialogImp.h +++ b/src/Gui/DlgInputDialogImp.h @@ -43,7 +43,7 @@ class GuiExport DlgInputDialogImp : public QDialog, public Ui_DlgInputDialog public: enum Type { LineEdit, SpinBox, UIntBox, FloatSpinBox, ComboBox }; - DlgInputDialogImp( const QString& label, QWidget* parent = 0, bool modal = TRUE, Type = LineEdit ); + DlgInputDialogImp( const QString& label, QWidget* parent = 0, bool modal = true, Type = LineEdit ); ~DlgInputDialogImp(); void setType( Type t ); diff --git a/src/Gui/DlgKeyboardImp.cpp b/src/Gui/DlgKeyboardImp.cpp index e36d3bdf9983..dd19d20b1fd9 100644 --- a/src/Gui/DlgKeyboardImp.cpp +++ b/src/Gui/DlgKeyboardImp.cpp @@ -102,7 +102,11 @@ DlgCustomKeyboardImp::DlgCustomKeyboardImp( QWidget* parent ) commandTreeWidget->setHeaderLabels(labels); commandTreeWidget->header()->hide(); commandTreeWidget->setIconSize(QSize(32, 32)); - commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents); +#if QT_VERSION >= 0x050000 + commandTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); +#else + commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents); +#endif assignedTreeWidget->setHeaderLabels(labels); assignedTreeWidget->header()->hide(); @@ -137,22 +141,22 @@ void DlgCustomKeyboardImp::on_commandTreeWidget_currentItemChanged(QTreeWidgetIt if (cmd) { if (cmd->getAction()) { QKeySequence ks = cmd->getAction()->shortcut(); - QKeySequence ks2 = QString::fromAscii(cmd->getAccel()); + QKeySequence ks2 = QString::fromLatin1(cmd->getAccel()); QKeySequence ks3 = editShortcut->text(); if (ks.isEmpty()) accelLineEditShortcut->setText( tr("none") ); else - accelLineEditShortcut->setText(ks); + accelLineEditShortcut->setText(ks.toString()); buttonAssign->setEnabled(!editShortcut->text().isEmpty() && (ks != ks3)); buttonReset->setEnabled((ks != ks2)); } else { - QKeySequence ks = QString::fromAscii(cmd->getAccel()); + QKeySequence ks = QString::fromLatin1(cmd->getAccel()); if (ks.isEmpty()) accelLineEditShortcut->setText( tr("none") ); else - accelLineEditShortcut->setText(ks); + accelLineEditShortcut->setText(ks.toString()); buttonAssign->setEnabled(false); buttonReset->setEnabled(false); } @@ -173,7 +177,7 @@ void DlgCustomKeyboardImp::on_categoryBox_activated(int index) editShortcut->clear(); CommandManager & cCmdMgr = Application::Instance->commandManager(); - std::vector aCmds = cCmdMgr.getGroupCommands( group.toAscii() ); + std::vector aCmds = cCmdMgr.getGroupCommands( group.toLatin1() ); for (std::vector::iterator it = aCmds.begin(); it != aCmds.end(); ++it) { QTreeWidgetItem* item = new QTreeWidgetItem(commandTreeWidget); item->setText(1, qApp->translate((*it)->className(), (*it)->getMenuText())); @@ -199,7 +203,7 @@ void DlgCustomKeyboardImp::on_buttonAssign_clicked() Command* cmd = cCmdMgr.getCommandByName(name.constData()); if (cmd && cmd->getAction()) { QKeySequence shortcut = editShortcut->text(); - cmd->getAction()->setShortcut(shortcut); + cmd->getAction()->setShortcut(shortcut.toString()); accelLineEditShortcut->setText(editShortcut->text()); editShortcut->clear(); @@ -223,8 +227,8 @@ void DlgCustomKeyboardImp::on_buttonReset_clicked() CommandManager & cCmdMgr = Application::Instance->commandManager(); Command* cmd = cCmdMgr.getCommandByName(name.constData()); if (cmd && cmd->getAction()) { - cmd->getAction()->setShortcut(QString::fromAscii(cmd->getAccel())); - QString txt = cmd->getAction()->shortcut(); + cmd->getAction()->setShortcut(QString::fromLatin1(cmd->getAccel())); + QString txt = cmd->getAction()->shortcut().toString(); accelLineEditShortcut->setText((txt.isEmpty() ? tr("none") : txt)); ParameterGrp::handle hGrp = WindowParameter::getDefaultParameter()->GetGroup("Shortcut"); hGrp->RemoveASCII(name.constData()); @@ -240,7 +244,7 @@ void DlgCustomKeyboardImp::on_buttonResetAll_clicked() std::vector cmds = cCmdMgr.getAllCommands(); for (std::vector::iterator it = cmds.begin(); it != cmds.end(); ++it) { if ((*it)->getAction()) { - (*it)->getAction()->setShortcut(QKeySequence(QString::fromAscii((*it)->getAccel()))); + (*it)->getAction()->setShortcut(QKeySequence(QString::fromLatin1((*it)->getAccel())).toString()); } } @@ -277,7 +281,7 @@ void DlgCustomKeyboardImp::on_editShortcut_textChanged(const QString& sc) for (std::vector::iterator it = cmds.begin(); it != cmds.end(); ++it) { if ((*it)->getAction() && (*it)->getAction()->shortcut() == ks) { ++countAmbiguous; - ambiguousCommand = QString::fromAscii((*it)->getName()); // store the last one + ambiguousCommand = QString::fromLatin1((*it)->getName()); // store the last one ambiguousMenu = qApp->translate((*it)->className(), (*it)->getMenuText()); QTreeWidgetItem* item = new QTreeWidgetItem(assignedTreeWidget); diff --git a/src/Gui/DlgMacroExecuteImp.cpp b/src/Gui/DlgMacroExecuteImp.cpp index 3da6fc9c246f..ca1825738426 100644 --- a/src/Gui/DlgMacroExecuteImp.cpp +++ b/src/Gui/DlgMacroExecuteImp.cpp @@ -53,7 +53,7 @@ using namespace Gui::Dialog; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgMacroExecuteImp::DlgMacroExecuteImp( QWidget* parent, Qt::WFlags fl ) +DlgMacroExecuteImp::DlgMacroExecuteImp( QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl ), WindowParameter( "Macro" ) { this->setupUi(this); @@ -148,7 +148,7 @@ void DlgMacroExecuteImp::on_editButton_clicked() if (!item) return; QDir dir(this->macroPath); - QString file = QString::fromAscii("%1/%2").arg(dir.absolutePath()).arg(item->text(0)); + QString file = QString::fromLatin1("%1/%2").arg(dir.absolutePath()).arg(item->text(0)); Application::Instance->open(file.toUtf8(), "FreeCADGui"); close(); diff --git a/src/Gui/DlgMacroExecuteImp.h b/src/Gui/DlgMacroExecuteImp.h index 7ac3c7a5e87a..707dffc3e737 100644 --- a/src/Gui/DlgMacroExecuteImp.h +++ b/src/Gui/DlgMacroExecuteImp.h @@ -40,7 +40,7 @@ class DlgMacroExecuteImp : public QDialog, public Ui_DlgMacroExecute, public Gui Q_OBJECT public: - DlgMacroExecuteImp( QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgMacroExecuteImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~DlgMacroExecuteImp(); void accept(); diff --git a/src/Gui/DlgMacroRecordImp.cpp b/src/Gui/DlgMacroRecordImp.cpp index d0b1571cc360..b2b1e8c86dcc 100644 --- a/src/Gui/DlgMacroRecordImp.cpp +++ b/src/Gui/DlgMacroRecordImp.cpp @@ -47,7 +47,7 @@ using namespace Gui::Dialog; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgMacroRecordImp::DlgMacroRecordImp( QWidget* parent, Qt::WFlags fl ) +DlgMacroRecordImp::DlgMacroRecordImp( QWidget* parent, Qt::WindowFlags fl ) : QDialog(parent, fl), WindowParameter("Macro") { this->setupUi(this); diff --git a/src/Gui/DlgMacroRecordImp.h b/src/Gui/DlgMacroRecordImp.h index 17c56dcd3d65..fb4ca08f0093 100644 --- a/src/Gui/DlgMacroRecordImp.h +++ b/src/Gui/DlgMacroRecordImp.h @@ -41,7 +41,7 @@ class DlgMacroRecordImp : public QDialog, public Ui_DlgMacroRecord, public Gui:: Q_OBJECT public: - DlgMacroRecordImp( QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgMacroRecordImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); virtual ~DlgMacroRecordImp(); protected Q_SLOTS: diff --git a/src/Gui/DlgMaterialPropertiesImp.cpp b/src/Gui/DlgMaterialPropertiesImp.cpp index 839f417bc183..a5bdce4eea6c 100644 --- a/src/Gui/DlgMaterialPropertiesImp.cpp +++ b/src/Gui/DlgMaterialPropertiesImp.cpp @@ -43,7 +43,7 @@ using namespace Gui::Dialog; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgMaterialPropertiesImp::DlgMaterialPropertiesImp(const std::string& mat, QWidget* parent, Qt::WFlags fl) +DlgMaterialPropertiesImp::DlgMaterialPropertiesImp(const std::string& mat, QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl), material(mat) { this->setupUi(this); diff --git a/src/Gui/DlgMaterialPropertiesImp.h b/src/Gui/DlgMaterialPropertiesImp.h index 9d921b652a7f..f4413602d2fc 100644 --- a/src/Gui/DlgMaterialPropertiesImp.h +++ b/src/Gui/DlgMaterialPropertiesImp.h @@ -37,7 +37,7 @@ class DlgMaterialPropertiesImp : public QDialog, public Ui_DlgMaterialProperties Q_OBJECT public: - DlgMaterialPropertiesImp(const std::string& mat, QWidget* parent = 0, Qt::WFlags fl = 0); + DlgMaterialPropertiesImp(const std::string& mat, QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DlgMaterialPropertiesImp(); void setViewProviders(const std::vector&); diff --git a/src/Gui/DlgParameterImp.cpp b/src/Gui/DlgParameterImp.cpp index ee2ab82b86f2..f1b031930401 100644 --- a/src/Gui/DlgParameterImp.cpp +++ b/src/Gui/DlgParameterImp.cpp @@ -56,7 +56,7 @@ using namespace Gui::Dialog; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgParameterImp::DlgParameterImp( QWidget* parent, Qt::WFlags fl ) +DlgParameterImp::DlgParameterImp( QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl|Qt::WindowMinMaxButtonsHint ) { this->setupUi(this); @@ -71,8 +71,11 @@ DlgParameterImp::DlgParameterImp( QWidget* parent, Qt::WFlags fl ) paramValue = new ParameterValue(splitter3); paramValue->setHeaderLabels(valueLabels); paramValue->setRootIsDecorated(false); +#if QT_VERSION >= 0x050000 + paramValue->header()->setSectionResizeMode(0, QHeaderView::Stretch); +#else paramValue->header()->setResizeMode(0, QHeaderView::Stretch); - +#endif QSizePolicy policy = paramValue->sizePolicy(); policy.setHorizontalStretch(3); paramValue->setSizePolicy(policy); @@ -313,7 +316,7 @@ bool validateInput(QWidget* parent, const QString& input) if (input.isEmpty()) return false; for (int i=0; i '9') && // Numbers (c < 'A' || c > 'Z') && // Uppercase letters (c < 'a' || c > 'z') && // Lowercase letters @@ -393,7 +396,7 @@ void ParameterGroup::onDeleteSelectedItem() int index = parent->indexOfChild(sel); parent->takeChild(index); ParameterGroupItem* para = static_cast(parent); - para->_hcGrp->RemoveGrp(sel->text(0).toAscii()); + para->_hcGrp->RemoveGrp(sel->text(0).toLatin1()); delete sel; } } @@ -425,14 +428,14 @@ void ParameterGroup::onCreateSubgroup() ParameterGroupItem* para = static_cast(item); Base::Reference hGrp = para->_hcGrp; - if ( hGrp->HasGroup( name.toAscii() ) ) + if ( hGrp->HasGroup( name.toLatin1() ) ) { QMessageBox::critical( this, tr("Existing sub-group"), tr("The sub-group '%1' already exists.").arg( name ) ); return; } - hGrp = hGrp->GetGroup( name.toAscii() ); + hGrp = hGrp->GetGroup( name.toLatin1() ); (void)new ParameterGroupItem(para,hGrp); expandItem(para); } @@ -662,7 +665,7 @@ void ParameterValue::onCreateIntItem() } } - int val = QInputDialog::getInteger(this, QObject::tr("New integer item"), QObject::tr("Enter your number:"), + int val = QInputDialog::getInt(this, QObject::tr("New integer item"), QObject::tr("Enter your number:"), 0, -2147483647, 2147483647, 1, &ok); if ( ok ) @@ -757,8 +760,8 @@ void ParameterValue::onCreateBoolItem() } } - QStringList list; list << QString::fromAscii("true") - << QString::fromAscii("false"); + QStringList list; list << QString::fromLatin1("true") + << QString::fromLatin1("false"); QString val = QInputDialog::getItem (this, QObject::tr("New boolean item"), QObject::tr("Choose an item:"), list, 0, false, &ok); if ( ok ) @@ -822,7 +825,7 @@ void ParameterGroupItem::setData ( int column, int role, const QVariant & value QObject::tr("The group '%1' cannot be renamed.").arg( oldName ) ); return; } - if ( item->_hcGrp->HasGroup( newName.toAscii() ) ) + if ( item->_hcGrp->HasGroup( newName.toLatin1() ) ) { QMessageBox::critical( treeWidget(), QObject::tr("Existing group"), QObject::tr("The group '%1' already exists.").arg( newName ) ); @@ -831,10 +834,10 @@ void ParameterGroupItem::setData ( int column, int role, const QVariant & value else { // rename the group by adding a new group, copy the content and remove the old group - Base::Reference hOldGrp = item->_hcGrp->GetGroup( oldName.toAscii() ); - Base::Reference hNewGrp = item->_hcGrp->GetGroup( newName.toAscii() ); + Base::Reference hOldGrp = item->_hcGrp->GetGroup( oldName.toLatin1() ); + Base::Reference hNewGrp = item->_hcGrp->GetGroup( newName.toLatin1() ); hOldGrp->copyTo( hNewGrp ); - item->_hcGrp->RemoveGrp( oldName.toAscii() ); + item->_hcGrp->RemoveGrp( oldName.toLatin1() ); } } @@ -891,7 +894,7 @@ ParameterText::ParameterText ( QTreeWidget * parent, QString label, const char* { setIcon(0,BitmapFactory().pixmap("Param_Text") ); setText(0, label); - setText(1, QString::fromAscii("Text")); + setText(1, QString::fromLatin1("Text")); setText(2, QString::fromUtf8(value)); } @@ -907,25 +910,25 @@ void ParameterText::changeValue() if ( ok ) { setText( 2, txt ); - _hcGrp->SetASCII(text(0).toAscii(), txt.toUtf8()); + _hcGrp->SetASCII(text(0).toLatin1(), txt.toUtf8()); } } void ParameterText::removeFromGroup () { - _hcGrp->RemoveASCII(text(0).toAscii()); + _hcGrp->RemoveASCII(text(0).toLatin1()); } void ParameterText::replace( const QString& oldName, const QString& newName ) { - std::string val = _hcGrp->GetASCII(oldName.toAscii()); - _hcGrp->RemoveASCII(oldName.toAscii()); - _hcGrp->SetASCII(newName.toAscii(), val.c_str()); + std::string val = _hcGrp->GetASCII(oldName.toLatin1()); + _hcGrp->RemoveASCII(oldName.toLatin1()); + _hcGrp->SetASCII(newName.toLatin1(), val.c_str()); } void ParameterText::appendToGroup() { - _hcGrp->SetASCII(text(0).toAscii(), text(2).toUtf8()); + _hcGrp->SetASCII(text(0).toLatin1(), text(2).toUtf8()); } // -------------------------------------------------------------------- @@ -935,8 +938,8 @@ ParameterInt::ParameterInt ( QTreeWidget * parent, QString label, long value, co { setIcon(0,BitmapFactory().pixmap("Param_Int") ); setText(0, label); - setText(1, QString::fromAscii("Integer")); - setText(2, QString::fromAscii("%1").arg(value)); + setText(1, QString::fromLatin1("Integer")); + setText(2, QString::fromLatin1("%1").arg(value)); } ParameterInt::~ParameterInt() @@ -946,30 +949,30 @@ ParameterInt::~ParameterInt() void ParameterInt::changeValue() { bool ok; - int num = QInputDialog::getInteger(treeWidget(), QObject::tr("Change value"), QObject::tr("Enter your number:"), + int num = QInputDialog::getInt(treeWidget(), QObject::tr("Change value"), QObject::tr("Enter your number:"), text(2).toInt(), -2147483647, 2147483647, 1, &ok); if ( ok ) { - setText(2, QString::fromAscii("%1").arg(num)); - _hcGrp->SetInt(text(0).toAscii(), (long)num); + setText(2, QString::fromLatin1("%1").arg(num)); + _hcGrp->SetInt(text(0).toLatin1(), (long)num); } } void ParameterInt::removeFromGroup () { - _hcGrp->RemoveInt(text(0).toAscii()); + _hcGrp->RemoveInt(text(0).toLatin1()); } void ParameterInt::replace( const QString& oldName, const QString& newName ) { - long val = _hcGrp->GetInt(oldName.toAscii()); - _hcGrp->RemoveInt(oldName.toAscii()); - _hcGrp->SetInt(newName.toAscii(), val); + long val = _hcGrp->GetInt(oldName.toLatin1()); + _hcGrp->RemoveInt(oldName.toLatin1()); + _hcGrp->SetInt(newName.toLatin1(), val); } void ParameterInt::appendToGroup() { - _hcGrp->SetInt(text(0).toAscii(), text(2).toLong()); + _hcGrp->SetInt(text(0).toLatin1(), text(2).toLong()); } // -------------------------------------------------------------------- @@ -979,8 +982,8 @@ ParameterUInt::ParameterUInt ( QTreeWidget * parent, QString label, unsigned lon { setIcon(0,BitmapFactory().pixmap("Param_UInt") ); setText(0, label); - setText(1, QString::fromAscii("Unsigned")); - setText(2, QString::fromAscii("%1").arg(value)); + setText(1, QString::fromLatin1("Unsigned")); + setText(2, QString::fromLatin1("%1").arg(value)); } ParameterUInt::~ParameterUInt() @@ -1002,27 +1005,27 @@ void ParameterUInt::changeValue() if ( ok ) { - setText(2, QString::fromAscii("%1").arg(num)); - _hcGrp->SetUnsigned(text(0).toAscii(), (unsigned long)num); + setText(2, QString::fromLatin1("%1").arg(num)); + _hcGrp->SetUnsigned(text(0).toLatin1(), (unsigned long)num); } } } void ParameterUInt::removeFromGroup () { - _hcGrp->RemoveUnsigned(text(0).toAscii()); + _hcGrp->RemoveUnsigned(text(0).toLatin1()); } void ParameterUInt::replace( const QString& oldName, const QString& newName ) { - unsigned long val = _hcGrp->GetUnsigned(oldName.toAscii()); - _hcGrp->RemoveUnsigned(oldName.toAscii()); - _hcGrp->SetUnsigned(newName.toAscii(), val); + unsigned long val = _hcGrp->GetUnsigned(oldName.toLatin1()); + _hcGrp->RemoveUnsigned(oldName.toLatin1()); + _hcGrp->SetUnsigned(newName.toLatin1(), val); } void ParameterUInt::appendToGroup() { - _hcGrp->SetUnsigned(text(0).toAscii(), text(2).toULong()); + _hcGrp->SetUnsigned(text(0).toLatin1(), text(2).toULong()); } // -------------------------------------------------------------------- @@ -1032,8 +1035,8 @@ ParameterFloat::ParameterFloat ( QTreeWidget * parent, QString label, double val { setIcon(0,BitmapFactory().pixmap("Param_Float") ); setText(0, label); - setText(1, QString::fromAscii("Float")); - setText(2, QString::fromAscii("%1").arg(value)); + setText(1, QString::fromLatin1("Float")); + setText(2, QString::fromLatin1("%1").arg(value)); } ParameterFloat::~ParameterFloat() @@ -1047,26 +1050,26 @@ void ParameterFloat::changeValue() text(2).toDouble(), -2147483647, 2147483647, 12, &ok); if ( ok ) { - setText(2, QString::fromAscii("%1").arg(num)); - _hcGrp->SetFloat(text(0).toAscii(), num); + setText(2, QString::fromLatin1("%1").arg(num)); + _hcGrp->SetFloat(text(0).toLatin1(), num); } } void ParameterFloat::removeFromGroup () { - _hcGrp->RemoveFloat(text(0).toAscii()); + _hcGrp->RemoveFloat(text(0).toLatin1()); } void ParameterFloat::replace( const QString& oldName, const QString& newName ) { - double val = _hcGrp->GetFloat(oldName.toAscii()); - _hcGrp->RemoveFloat(oldName.toAscii()); - _hcGrp->SetFloat(newName.toAscii(), val); + double val = _hcGrp->GetFloat(oldName.toLatin1()); + _hcGrp->RemoveFloat(oldName.toLatin1()); + _hcGrp->SetFloat(newName.toLatin1(), val); } void ParameterFloat::appendToGroup() { - _hcGrp->SetFloat(text(0).toAscii(), text(2).toDouble()); + _hcGrp->SetFloat(text(0).toLatin1(), text(2).toDouble()); } // -------------------------------------------------------------------- @@ -1076,8 +1079,8 @@ ParameterBool::ParameterBool ( QTreeWidget * parent, QString label, bool value, { setIcon(0,BitmapFactory().pixmap("Param_Bool") ); setText(0, label); - setText(1, QString::fromAscii("Boolean")); - setText(2, QString::fromAscii((value ? "true" : "false"))); + setText(1, QString::fromLatin1("Boolean")); + setText(2, QString::fromLatin1((value ? "true" : "false"))); } ParameterBool::~ParameterBool() @@ -1087,8 +1090,8 @@ ParameterBool::~ParameterBool() void ParameterBool::changeValue() { bool ok; - QStringList list; list << QString::fromAscii("true") - << QString::fromAscii("false"); + QStringList list; list << QString::fromLatin1("true") + << QString::fromLatin1("false"); int pos = (text(2) == list[0] ? 0 : 1); QString txt = QInputDialog::getItem (treeWidget(), QObject::tr("Change value"), QObject::tr("Choose an item:"), @@ -1096,26 +1099,26 @@ void ParameterBool::changeValue() if ( ok ) { setText( 2, txt ); - _hcGrp->SetBool(text(0).toAscii(), (txt == list[0] ? true : false) ); + _hcGrp->SetBool(text(0).toLatin1(), (txt == list[0] ? true : false) ); } } void ParameterBool::removeFromGroup () { - _hcGrp->RemoveBool(text(0).toAscii()); + _hcGrp->RemoveBool(text(0).toLatin1()); } void ParameterBool::replace( const QString& oldName, const QString& newName ) { - bool val = _hcGrp->GetBool(oldName.toAscii()); - _hcGrp->RemoveBool(oldName.toAscii()); - _hcGrp->SetBool(newName.toAscii(), val); + bool val = _hcGrp->GetBool(oldName.toLatin1()); + _hcGrp->RemoveBool(oldName.toLatin1()); + _hcGrp->SetBool(newName.toLatin1(), val); } void ParameterBool::appendToGroup() { bool val = (text(2) == QLatin1String("true") ? true : false); - _hcGrp->SetBool(text(0).toAscii(), val); + _hcGrp->SetBool(text(0).toLatin1(), val); } #include "moc_DlgParameterImp.cpp" diff --git a/src/Gui/DlgParameterImp.h b/src/Gui/DlgParameterImp.h index d040fcd99b8e..0d1778d0296e 100644 --- a/src/Gui/DlgParameterImp.h +++ b/src/Gui/DlgParameterImp.h @@ -42,7 +42,7 @@ class DlgParameterImp : public QDialog, public Ui_DlgParameter Q_OBJECT public: - DlgParameterImp( QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgParameterImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~DlgParameterImp(); void accept(); diff --git a/src/Gui/DlgPreferencesImp.cpp b/src/Gui/DlgPreferencesImp.cpp index e841e9b1863f..ba69dfda6533 100644 --- a/src/Gui/DlgPreferencesImp.cpp +++ b/src/Gui/DlgPreferencesImp.cpp @@ -52,7 +52,7 @@ std::list DlgPreferencesImp::_pages; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgPreferencesImp::DlgPreferencesImp( QWidget* parent, Qt::WFlags fl ) +DlgPreferencesImp::DlgPreferencesImp( QWidget* parent, Qt::WindowFlags fl ) : QDialog(parent, fl) { this->setupUi(this); @@ -209,7 +209,7 @@ void DlgPreferencesImp::on_buttonApply_clicked() } catch (const Base::Exception& e) { listBox->setCurrentRow(i); tabWidget->setCurrentIndex(j); - QMessageBox::warning(this, tr("Wrong parameter"), QString::fromAscii(e.what())); + QMessageBox::warning(this, tr("Wrong parameter"), QString::fromLatin1(e.what())); throw; } } diff --git a/src/Gui/DlgPreferencesImp.h b/src/Gui/DlgPreferencesImp.h index 020a82bdadd7..9cd609433bf8 100644 --- a/src/Gui/DlgPreferencesImp.h +++ b/src/Gui/DlgPreferencesImp.h @@ -109,7 +109,7 @@ class GuiExport DlgPreferencesImp : public QDialog,public Ui_DlgPreferences static void addPage(const std::string& className, const std::string& group); static void removePage(const std::string& className, const std::string& group); - DlgPreferencesImp( QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgPreferencesImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~DlgPreferencesImp(); void accept(); diff --git a/src/Gui/DlgProjectInformationImp.cpp b/src/Gui/DlgProjectInformationImp.cpp index fd58c674d297..eba3620832bd 100644 --- a/src/Gui/DlgProjectInformationImp.cpp +++ b/src/Gui/DlgProjectInformationImp.cpp @@ -42,7 +42,7 @@ using namespace Gui::Dialog; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgProjectInformationImp::DlgProjectInformationImp( App::Document* doc, QWidget* parent, Qt::WFlags fl ) +DlgProjectInformationImp::DlgProjectInformationImp( App::Document* doc, QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl ), _doc(doc) { this->setupUi(this); diff --git a/src/Gui/DlgProjectInformationImp.h b/src/Gui/DlgProjectInformationImp.h index cda120e7ca3e..e06eb517b1ed 100644 --- a/src/Gui/DlgProjectInformationImp.h +++ b/src/Gui/DlgProjectInformationImp.h @@ -37,7 +37,7 @@ namespace Dialog { class DlgProjectInformationImp : public QDialog, public Ui_DlgProjectInformation { public: - DlgProjectInformationImp( App::Document* doc, QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgProjectInformationImp( App::Document* doc, QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~DlgProjectInformationImp(); protected: diff --git a/src/Gui/DlgProjectUtility.cpp b/src/Gui/DlgProjectUtility.cpp index d3a414a486f5..b737c7439355 100644 --- a/src/Gui/DlgProjectUtility.cpp +++ b/src/Gui/DlgProjectUtility.cpp @@ -107,7 +107,7 @@ const char* doctools = /* TRANSLATOR Gui::Dialog::DlgProjectUtility */ -DlgProjectUtility::DlgProjectUtility(QWidget* parent, Qt::WFlags fl) +DlgProjectUtility::DlgProjectUtility(QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl), ui(new Ui_DlgProjectUtility) { ui->setupUi(this); diff --git a/src/Gui/DlgProjectUtility.h b/src/Gui/DlgProjectUtility.h index c68abb632d0e..b90a06939f5c 100644 --- a/src/Gui/DlgProjectUtility.h +++ b/src/Gui/DlgProjectUtility.h @@ -34,7 +34,7 @@ class DlgProjectUtility : public QDialog Q_OBJECT public: - DlgProjectUtility(QWidget* parent = 0, Qt::WFlags fl = 0); + DlgProjectUtility(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DlgProjectUtility(); private Q_SLOTS: diff --git a/src/Gui/DlgRunExternal.cpp b/src/Gui/DlgRunExternal.cpp index 7291aff65941..c63522640493 100644 --- a/src/Gui/DlgRunExternal.cpp +++ b/src/Gui/DlgRunExternal.cpp @@ -46,7 +46,7 @@ using namespace Gui::Dialog; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgRunExternal::DlgRunExternal( QWidget* parent, Qt::WFlags fl ) +DlgRunExternal::DlgRunExternal( QWidget* parent, Qt::WindowFlags fl ) : QDialog(parent, fl),process(this),advancedHidden(true) { ui = new Ui_DlgRunExternal(); diff --git a/src/Gui/DlgRunExternal.h b/src/Gui/DlgRunExternal.h index 4a08f5cceca1..41fb04d6c5df 100644 --- a/src/Gui/DlgRunExternal.h +++ b/src/Gui/DlgRunExternal.h @@ -41,7 +41,7 @@ class GuiExport DlgRunExternal : public QDialog Q_OBJECT public: - DlgRunExternal(QWidget* parent = 0, Qt::WFlags fl = 0); + DlgRunExternal(QWidget* parent = 0, Qt::WindowFlags fl = 0); virtual ~DlgRunExternal(); int Do(void); diff --git a/src/Gui/DlgSettings3DViewImp.cpp b/src/Gui/DlgSettings3DViewImp.cpp index a6b5bd9bbfd3..959df661c867 100644 --- a/src/Gui/DlgSettings3DViewImp.cpp +++ b/src/Gui/DlgSettings3DViewImp.cpp @@ -123,16 +123,16 @@ void DlgSettings3DViewImp::on_mouseButton_clicked() QVariant data = comboNavigationStyle->itemData(comboNavigationStyle->currentIndex(), Qt::UserRole); void* instance = Base::Type::createInstanceByName((const char*)data.toByteArray()); std::auto_ptr ns(static_cast(instance)); - ui.groupBox->setTitle(ui.groupBox->title()+QString::fromAscii(" ")+comboNavigationStyle->currentText()); + ui.groupBox->setTitle(ui.groupBox->title()+QString::fromLatin1(" ")+comboNavigationStyle->currentText()); QString descr; descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::SELECTION)); - ui.selectionLabel->setText(QString::fromAscii("%1").arg(descr)); + ui.selectionLabel->setText(QString::fromLatin1("%1").arg(descr)); descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::PANNING)); - ui.panningLabel->setText(QString::fromAscii("%1").arg(descr)); + ui.panningLabel->setText(QString::fromLatin1("%1").arg(descr)); descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::DRAGGING)); - ui.rotationLabel->setText(QString::fromAscii("%1").arg(descr)); + ui.rotationLabel->setText(QString::fromLatin1("%1").arg(descr)); descr = qApp->translate((const char*)data.toByteArray(),ns->mouseButtons(NavigationStyle::ZOOMING)); - ui.zoomingLabel->setText(QString::fromAscii("%1").arg(descr)); + ui.zoomingLabel->setText(QString::fromLatin1("%1").arg(descr)); dlg.exec(); } @@ -160,10 +160,10 @@ void DlgSettings3DViewImp::retranslate() Base::Type::getAllDerivedFrom(UserNavigationStyle::getClassTypeId(), types); comboNavigationStyle->clear(); - QRegExp rx(QString::fromAscii("^\\w+::(\\w+)Navigation\\w+$")); + QRegExp rx(QString::fromLatin1("^\\w+::(\\w+)Navigation\\w+$")); for (std::vector::iterator it = types.begin(); it != types.end(); ++it) { if (*it != UserNavigationStyle::getClassTypeId()) { - QString data = QString::fromAscii(it->getName()); + QString data = QString::fromLatin1(it->getName()); QString name = data.mid(data.indexOf(QLatin1String("::"))+2); if (rx.indexIn(data) > -1) { name = tr("%1 navigation").arg(rx.cap(1)); diff --git a/src/Gui/DlgSettingsColorGradientImp.cpp b/src/Gui/DlgSettingsColorGradientImp.cpp index bf272fda6365..166565286972 100644 --- a/src/Gui/DlgSettingsColorGradientImp.cpp +++ b/src/Gui/DlgSettingsColorGradientImp.cpp @@ -43,7 +43,7 @@ using namespace Gui::Dialog; * Constructs a DlgSettingsColorGradientImp as a child of 'parent', with the * name 'name' and widget flags set to 'f'. */ -DlgSettingsColorGradientImp::DlgSettingsColorGradientImp( QWidget* parent, Qt::WFlags fl ) +DlgSettingsColorGradientImp::DlgSettingsColorGradientImp( QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl ) { this->setupUi(this); diff --git a/src/Gui/DlgSettingsColorGradientImp.h b/src/Gui/DlgSettingsColorGradientImp.h index 10f0ee875ad6..562a1dbdcfd1 100644 --- a/src/Gui/DlgSettingsColorGradientImp.h +++ b/src/Gui/DlgSettingsColorGradientImp.h @@ -41,7 +41,7 @@ class DlgSettingsColorGradientImp : public QDialog, public Ui_DlgSettingsColorGr Q_OBJECT public: - DlgSettingsColorGradientImp( QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgSettingsColorGradientImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~DlgSettingsColorGradientImp(); void accept(); diff --git a/src/Gui/DlgTipOfTheDayImp.cpp b/src/Gui/DlgTipOfTheDayImp.cpp index 5a4b8d164353..919945a93e6a 100644 --- a/src/Gui/DlgTipOfTheDayImp.cpp +++ b/src/Gui/DlgTipOfTheDayImp.cpp @@ -50,7 +50,7 @@ using namespace Gui::Dialog; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgTipOfTheDayImp::DlgTipOfTheDayImp( QWidget* parent, Qt::WFlags fl ) +DlgTipOfTheDayImp::DlgTipOfTheDayImp( QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl | Qt::WindowTitleHint | Qt::WindowSystemMenuHint ), WindowParameter("General") { @@ -104,7 +104,7 @@ void DlgTipOfTheDayImp::onResponseHeaderReceived(const QHttpResponseHeader & res { if (responseHeader.statusCode() != 200) { QString msg = tr("Download failed: %1\n").arg(responseHeader.reasonPhrase()); - Base::Console().Log(msg.toAscii()); + Base::Console().Log(msg.toLatin1()); _http->abort(); } } @@ -115,7 +115,7 @@ void DlgTipOfTheDayImp::onDone(bool err) return; // get the page and search for the tips section - QString text = QString::fromAscii(_http->readAll()); + QString text = QString::fromLatin1(_http->readAll()); QRegExp rx(QLatin1String("

You find the latest information.+

")); if (rx.indexIn(text) > -1) { // the text of interest @@ -143,7 +143,7 @@ void DlgTipOfTheDayImp::onStateChanged (int state) break; case QHttp::Closing: case QHttp::Unconnected: - Base::Console().Log("%s\n",(const char*)_http->errorString().toAscii()); + Base::Console().Log("%s\n",(const char*)_http->errorString().toLatin1()); break; default: break; diff --git a/src/Gui/DlgTipOfTheDayImp.h b/src/Gui/DlgTipOfTheDayImp.h index 83290697330a..70860fba0393 100644 --- a/src/Gui/DlgTipOfTheDayImp.h +++ b/src/Gui/DlgTipOfTheDayImp.h @@ -55,7 +55,7 @@ class DlgTipOfTheDayImp : public QDialog, public Ui_DlgTipOfTheDay, public Windo Q_OBJECT public: - DlgTipOfTheDayImp( QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgTipOfTheDayImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~DlgTipOfTheDayImp(); void reload(); diff --git a/src/Gui/DlgToolbarsImp.cpp b/src/Gui/DlgToolbarsImp.cpp index 31827df5e518..f3d2e42fce0b 100644 --- a/src/Gui/DlgToolbarsImp.cpp +++ b/src/Gui/DlgToolbarsImp.cpp @@ -118,7 +118,11 @@ DlgCustomToolbars::DlgCustomToolbars(DlgCustomToolbars::Type t, QWidget* parent) commandTreeWidget->setHeaderLabels(labels); commandTreeWidget->header()->hide(); commandTreeWidget->setIconSize(QSize(32, 32)); - commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents); +#if QT_VERSION >= 0x050000 + commandTreeWidget->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); +#else + commandTreeWidget->header()->setResizeMode(0, QHeaderView::ResizeToContents); +#endif labels.clear(); labels << tr("Command"); toolbarTreeWidget->setHeaderLabels(labels); @@ -127,7 +131,7 @@ DlgCustomToolbars::DlgCustomToolbars(DlgCustomToolbars::Type t, QWidget* parent) on_categoryBox_activated(categoryBox->currentIndex()); Workbench* w = WorkbenchManager::instance()->active(); if (w) { - QString name = QString::fromAscii(w->name().c_str()); + QString name = QString::fromLatin1(w->name().c_str()); int index = workbenchBox->findData(name); workbenchBox->setCurrentIndex(index); } @@ -171,7 +175,7 @@ void DlgCustomToolbars::hideEvent(QHideEvent * event) { QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole); QString workbench = data.toString(); - exportCustomToolbars(workbench.toAscii()); + exportCustomToolbars(workbench.toLatin1()); CustomizeActionPage::hideEvent(event); } @@ -183,7 +187,7 @@ void DlgCustomToolbars::on_categoryBox_activated(int index) commandTreeWidget->clear(); CommandManager & cCmdMgr = Application::Instance->commandManager(); - std::vector aCmds = cCmdMgr.getGroupCommands(group.toAscii()); + std::vector aCmds = cCmdMgr.getGroupCommands(group.toLatin1()); // Create a separator item QTreeWidgetItem* sepitem = new QTreeWidgetItem(commandTreeWidget); @@ -207,7 +211,7 @@ void DlgCustomToolbars::on_workbenchBox_activated(int index) QString workbench = data.toString(); toolbarTreeWidget->clear(); - QByteArray workbenchname = workbench.toAscii(); + QByteArray workbenchname = workbench.toLatin1(); importCustomToolbars(workbenchname); } @@ -262,9 +266,9 @@ void DlgCustomToolbars::exportCustomToolbars(const QByteArray& workbench) CommandManager& rMgr = Application::Instance->commandManager(); for (int i=0; itopLevelItemCount(); i++) { QTreeWidgetItem* toplevel = toolbarTreeWidget->topLevelItem(i); - QString groupName = QString::fromAscii("Custom_%1").arg(i+1); + QString groupName = QString::fromLatin1("Custom_%1").arg(i+1); QByteArray toolbarName = toplevel->text(0).toUtf8(); - ParameterGrp::handle hToolGrp = hGrp->GetGroup(groupName.toAscii()); + ParameterGrp::handle hToolGrp = hGrp->GetGroup(groupName.toLatin1()); hToolGrp->SetASCII("Name", toolbarName.constData()); hToolGrp->SetBool("Active", toplevel->checkState(0) == Qt::Checked); for (int j=0; jchildCount(); j++) { @@ -305,7 +309,7 @@ void DlgCustomToolbars::on_moveActionRightButton_clicked() QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole); QString workbench = data.toString(); - exportCustomToolbars(workbench.toAscii()); + exportCustomToolbars(workbench.toLatin1()); } /** Removes an action */ @@ -323,7 +327,7 @@ void DlgCustomToolbars::on_moveActionLeftButton_clicked() QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole); QString workbench = data.toString(); - exportCustomToolbars(workbench.toAscii()); + exportCustomToolbars(workbench.toLatin1()); } /** Noves up an action */ @@ -344,7 +348,7 @@ void DlgCustomToolbars::on_moveActionUpButton_clicked() QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole); QString workbench = data.toString(); - exportCustomToolbars(workbench.toAscii()); + exportCustomToolbars(workbench.toLatin1()); } /** Moves down an action */ @@ -365,13 +369,13 @@ void DlgCustomToolbars::on_moveActionDownButton_clicked() QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole); QString workbench = data.toString(); - exportCustomToolbars(workbench.toAscii()); + exportCustomToolbars(workbench.toLatin1()); } void DlgCustomToolbars::on_newButton_clicked() { bool ok; - QString text = QString::fromAscii("Custom%1").arg(toolbarTreeWidget->topLevelItemCount()+1); + QString text = QString::fromLatin1("Custom%1").arg(toolbarTreeWidget->topLevelItemCount()+1); text = QInputDialog::getText(this, tr("New toolbar"), tr("Toolbar name:"), QLineEdit::Normal, text, &ok); if (ok) { // Check for duplicated name @@ -391,7 +395,7 @@ void DlgCustomToolbars::on_newButton_clicked() QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole); QString workbench = data.toString(); - exportCustomToolbars(workbench.toAscii()); + exportCustomToolbars(workbench.toLatin1()); addCustomToolbar(text); } } @@ -408,7 +412,7 @@ void DlgCustomToolbars::on_deleteButton_clicked() QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole); QString workbench = data.toString(); - exportCustomToolbars(workbench.toAscii()); + exportCustomToolbars(workbench.toLatin1()); } void DlgCustomToolbars::on_renameButton_clicked() @@ -440,7 +444,7 @@ void DlgCustomToolbars::on_renameButton_clicked() if (renamed) { QVariant data = workbenchBox->itemData(workbenchBox->currentIndex(), Qt::UserRole); QString workbench = data.toString(); - exportCustomToolbars(workbench.toAscii()); + exportCustomToolbars(workbench.toLatin1()); } } diff --git a/src/Gui/DlgUnitsCalculatorImp.cpp b/src/Gui/DlgUnitsCalculatorImp.cpp index c1d216ed9c2d..d7b6c6b50c1b 100644 --- a/src/Gui/DlgUnitsCalculatorImp.cpp +++ b/src/Gui/DlgUnitsCalculatorImp.cpp @@ -42,7 +42,7 @@ using namespace Gui::Dialog; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WFlags fl ) +DlgUnitsCalculator::DlgUnitsCalculator( QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl ) { // create widgets @@ -95,7 +95,7 @@ void DlgUnitsCalculator::valueChanged(const Base::Quantity& quant) } else { double value = quant.getValue()/actUnit.getValue(); QString val = QLocale::system().toString(value, 'f', Base::UnitsApi::getDecimals()); - QString out = QString::fromAscii("%1 %2").arg(val).arg(this->UnitInput->text()); + QString out = QString::fromLatin1("%1 %2").arg(val).arg(this->UnitInput->text()); this->ValueOutput->setText(out); this->pushButton_Copy->setEnabled(true); } @@ -128,7 +128,7 @@ void DlgUnitsCalculator::help(void) void DlgUnitsCalculator::returnPressed(void) { if (this->pushButton_Copy->isEnabled()) { - this->textEdit->append(this->ValueInput->text() + QString::fromAscii(" = ") + this->ValueOutput->text()); + this->textEdit->append(this->ValueInput->text() + QString::fromLatin1(" = ") + this->ValueOutput->text()); this->ValueInput->pushToHistory(); } } diff --git a/src/Gui/DlgUnitsCalculatorImp.h b/src/Gui/DlgUnitsCalculatorImp.h index 70090bd8c693..34f448e43c6e 100644 --- a/src/Gui/DlgUnitsCalculatorImp.h +++ b/src/Gui/DlgUnitsCalculatorImp.h @@ -38,7 +38,7 @@ class DlgUnitsCalculator : public QDialog, public Ui_DlgUnitCalculator Q_OBJECT public: - DlgUnitsCalculator( QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgUnitsCalculator( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~DlgUnitsCalculator(); protected: diff --git a/src/Gui/DockWindowManager.cpp b/src/Gui/DockWindowManager.cpp index 919abf84f5d6..608d85689801 100644 --- a/src/Gui/DockWindowManager.cpp +++ b/src/Gui/DockWindowManager.cpp @@ -46,7 +46,7 @@ DockWindowItems::~DockWindowItems() void DockWindowItems::addDockWidget(const char* name, Qt::DockWidgetArea pos, bool visibility, bool tabbed) { DockWindowItem item; - item.name = QString::fromAscii(name); + item.name = QString::fromLatin1(name); item.pos = pos; item.visibility = visibility; item.tabbed = tabbed; @@ -243,7 +243,7 @@ void DockWindowManager::removeDockWindow(QWidget* widget) void DockWindowManager::retranslate() { for (QList::Iterator it = d->_dockedWindows.begin(); it != d->_dockedWindows.end(); ++it) { - (*it)->setWindowTitle(QDockWidget::tr((*it)->objectName().toAscii())); + (*it)->setWindowTitle(QDockWidget::tr((*it)->objectName().toLatin1())); } } @@ -290,7 +290,7 @@ void DockWindowManager::setup(DockWindowItems* items) QList areas[4]; for (QList::ConstIterator it = dws.begin(); it != dws.end(); ++it) { QDockWidget* dw = findDockWidget(docked, it->name); - QByteArray dockName = it->name.toAscii(); + QByteArray dockName = it->name.toLatin1(); bool visible = hPref->GetBool(dockName.constData(), it->visibility); if (!dw) { diff --git a/src/Gui/Document.cpp b/src/Gui/Document.cpp index 3732f082fa2b..18128fd7dd12 100644 --- a/src/Gui/Document.cpp +++ b/src/Gui/Document.cpp @@ -790,7 +790,7 @@ void Document::SaveDocFile (Base::Writer &writer) const d->_pcAppWnd->sendMsgToActiveView("GetCamera",&ppReturn); // remove the first line because it's a comment like '#Inventor V2.1 ascii' - QStringList lines = QString(QString::fromAscii(ppReturn)).split(QLatin1String("\n")); + QStringList lines = QString(QString::fromLatin1(ppReturn)).split(QLatin1String("\n")); if (lines.size() > 1) { lines.pop_front(); viewPos = lines.join(QLatin1String(" ")); @@ -799,7 +799,7 @@ void Document::SaveDocFile (Base::Writer &writer) const writer.incInd(); // indentation for camera settings writer.Stream() << writer.ind() << "" << std::endl; + << (const char*)viewPos.toLatin1() <<"\"/>" << std::endl; writer.decInd(); // indentation for camera settings writer.Stream() << "" << std::endl; } @@ -916,7 +916,7 @@ void Document::createView(const char* sType) const char* name = getDocument()->Label.getValue(); - QString title = QString::fromAscii("%1 : %2[*]") + QString title = QString::fromLatin1("%1 : %2[*]") .arg(QString::fromUtf8(name)).arg(d->_iWinCount++); view3D->setWindowTitle(title); diff --git a/src/Gui/DownloadDialog.cpp b/src/Gui/DownloadDialog.cpp index 1c20d829d460..c09c475a63f0 100644 --- a/src/Gui/DownloadDialog.cpp +++ b/src/Gui/DownloadDialog.cpp @@ -116,7 +116,7 @@ void DownloadDialog::downloadFile() QByteArray path = QUrl::toPercentEncoding(url.path(), "!$&'()*+,;=:@/"); if (path.isEmpty()) path = "/"; - httpGetId = http->get(QString::fromAscii(path), file); + httpGetId = http->get(QString::fromLatin1(path), file); statusLabel->setText(tr("Downloading %1.").arg(fileName)); downloadButton->setEnabled(false); diff --git a/src/Gui/DownloadDialog.h b/src/Gui/DownloadDialog.h index 36bcb9b33831..7f7a6cad04ac 100644 --- a/src/Gui/DownloadDialog.h +++ b/src/Gui/DownloadDialog.h @@ -81,4 +81,4 @@ private Q_SLOTS: } // namespace Gui -#endif // GUI_DOWNLOADDIALOG_H \ No newline at end of file +#endif // GUI_DOWNLOADDIALOG_H diff --git a/src/Gui/DownloadItem.cpp b/src/Gui/DownloadItem.cpp index bfb79a515f9f..371783501cf7 100644 --- a/src/Gui/DownloadItem.cpp +++ b/src/Gui/DownloadItem.cpp @@ -40,7 +40,9 @@ #include #include #include - +#if QT_VERSION >= 0x050000 +#include +#endif #include #include "DownloadItem.h" @@ -167,7 +169,11 @@ NetworkAccessManager::NetworkAccessManager(QObject *parent) SLOT(proxyAuthenticationRequired(const QNetworkProxy&, QAuthenticator*))); QNetworkDiskCache *diskCache = new QNetworkDiskCache(this); +#if QT_VERSION >= 0x050000 + QString location = QStandardPaths::standardLocations(QStandardPaths::CacheLocation).first(); +#else QString location = QDesktopServices::storageLocation(QDesktopServices::CacheLocation); +#endif diskCache->setCacheDirectory(location); setCache(diskCache); } @@ -184,7 +190,7 @@ void NetworkAccessManager::authenticationRequired(QNetworkReply *reply, QAuthent dialog.adjustSize(); QString introMessage = tr("Enter username and password for \"%1\" at %2"); - introMessage = introMessage.arg(Qt::escape(reply->url().toString())).arg(Qt::escape(reply->url().toString())); + introMessage = introMessage.arg(reply->url().toString().toHtmlEscaped()).arg(reply->url().toString().toHtmlEscaped()); passwordDialog.siteDescription->setText(introMessage); passwordDialog.siteDescription->setWordWrap(true); @@ -206,7 +212,7 @@ void NetworkAccessManager::proxyAuthenticationRequired(const QNetworkProxy &prox dialog.adjustSize(); QString introMessage = tr("Connect to proxy \"%1\" using:"); - introMessage = introMessage.arg(Qt::escape(proxy.hostName())); + introMessage = introMessage.arg(proxy.hostName().toHtmlEscaped()); proxyDialog.siteDescription->setText(introMessage); proxyDialog.siteDescription->setWordWrap(true); @@ -271,8 +277,12 @@ void DownloadItem::init() QString DownloadItem::getDownloadDirectory() const { - QString exe = QString::fromAscii(App::GetApplication().getExecutableName()); + QString exe = QString::fromLatin1(App::GetApplication().getExecutableName()); +#if QT_VERSION >= 0x050000 + QString path = QStandardPaths::standardLocations(QStandardPaths::DocumentsLocation).first(); +#else QString path = QDesktopServices::storageLocation(QDesktopServices::DocumentsLocation); +#endif QString dirPath = QDir(path).filePath(exe); Base::Reference hPath = App::GetApplication().GetUserParameter().GetGroup("BaseApp") ->GetGroup("Preferences")->GetGroup("General"); @@ -367,12 +377,12 @@ void DownloadItem::open() if (doc) { for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) { Gui::Application::Instance->importFrom(it.key().toUtf8(), - doc->getDocument()->getName(), it.value().toAscii()); + doc->getDocument()->getName(), it.value().toLatin1()); } } else { for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) { - Gui::Application::Instance->open(it.key().toUtf8(), it.value().toAscii()); + Gui::Application::Instance->open(it.key().toUtf8(), it.value().toLatin1()); } } } diff --git a/src/Gui/EditorView.cpp b/src/Gui/EditorView.cpp index 034564a3f05c..31b2aaeae850 100644 --- a/src/Gui/EditorView.cpp +++ b/src/Gui/EditorView.cpp @@ -403,7 +403,7 @@ void EditorView::setCurrentFileName(const QString &fileName) if (fileName.isEmpty()) shownName = tr("untitled[*]"); else - shownName = QString::fromAscii("%1[*]").arg(fileName); + shownName = QString::fromLatin1("%1[*]").arg(fileName); shownName += tr(" - Editor"); setWindowTitle(shownName); setWindowModified(false); diff --git a/src/Gui/FileDialog.cpp b/src/Gui/FileDialog.cpp index af589916c46a..b7e45e73f3fe 100644 --- a/src/Gui/FileDialog.cpp +++ b/src/Gui/FileDialog.cpp @@ -62,7 +62,7 @@ FileDialog::~FileDialog() void FileDialog::onSelectedFilter(const QString& filter) { QRegExp rx(QLatin1String("\\(\\*.(\\w+)")); - QString suf = selectedFilter(); + QString suf = selectedNameFilter(); if (rx.indexIn(suf) >= 0) { suf = rx.cap(1); setDefaultSuffix(suf.toLower()); @@ -132,13 +132,13 @@ QString FileDialog::getSaveFileName (QWidget * parent, const QString & caption, dlg.setAcceptMode(QFileDialog::AcceptSave); dlg.setDirectory(dirName); dlg.setOptions(options); - dlg.setFilters(filter.split(QLatin1String(";;"))); - dlg.onSelectedFilter(dlg.selectedFilter()); + dlg.setNameFilters(filter.split(QLatin1String(";;"))); + dlg.onSelectedFilter(dlg.selectedNameFilter()); dlg.setNameFilterDetailsVisible(true); dlg.setConfirmOverwrite(true); if (dlg.exec() == QDialog::Accepted) { if (selectedFilter) - *selectedFilter = dlg.selectedFilter(); + *selectedFilter = dlg.selectedNameFilter(); file = dlg.selectedFiles().front(); } #else @@ -211,11 +211,11 @@ QString FileDialog::getOpenFileName(QWidget * parent, const QString & caption, c dlg.setAcceptMode(QFileDialog::AcceptOpen); dlg.setDirectory(dirName); dlg.setOptions(options); - dlg.setFilters(filter.split(QLatin1String(";;"))); + dlg.setNameFilters(filter.split(QLatin1String(";;"))); dlg.setNameFilterDetailsVisible(true); if (dlg.exec() == QDialog::Accepted) { if (selectedFilter) - *selectedFilter = dlg.selectedFilter(); + *selectedFilter = dlg.selectedNameFilter(); file = dlg.selectedFiles().front(); } #else @@ -269,11 +269,11 @@ QStringList FileDialog::getOpenFileNames (QWidget * parent, const QString & capt dlg.setAcceptMode(QFileDialog::AcceptOpen); dlg.setDirectory(dirName); dlg.setOptions(options); - dlg.setFilters(filter.split(QLatin1String(";;"))); + dlg.setNameFilters(filter.split(QLatin1String(";;"))); dlg.setNameFilterDetailsVisible(true); if (dlg.exec() == QDialog::Accepted) { if (selectedFilter) - *selectedFilter = dlg.selectedFilter(); + *selectedFilter = dlg.selectedNameFilter(); files = dlg.selectedFiles(); } #else @@ -330,7 +330,7 @@ void FileDialog::setWorkingDirectory(const QString& dir) /* TRANSLATOR Gui::FileOptionsDialog */ -FileOptionsDialog::FileOptionsDialog( QWidget* parent, Qt::WFlags fl ) +FileOptionsDialog::FileOptionsDialog( QWidget* parent, Qt::WindowFlags fl ) : QFileDialog( parent, fl ) { extensionButton = new QPushButton( this ); @@ -364,7 +364,7 @@ void FileOptionsDialog::accept() QFileInfo fi(fn); QString ext = fi.suffix(); ext.prepend(QLatin1String("*.")); - QStringList filters = this->filters(); + QStringList filters = this->nameFilters(); bool ok=false; // Compare the given suffix with the suffixes of all filters QString filter; @@ -380,14 +380,14 @@ void FileOptionsDialog::accept() if (!ok) { filter = tr("All files (*.*)"); filters << filter; - setFilters(filters); + setNameFilters(filters); } // empty the line edit filename->blockSignals(true); filename->clear(); filename->blockSignals(false); - selectFilter(filter); + selectNameFilter(filter); return; } @@ -395,13 +395,13 @@ void FileOptionsDialog::accept() QFileInfo fi(fn); QString ext = fi.completeSuffix(); QRegExp rx(QLatin1String("\\(\\*.(\\w+)")); - QString suf = selectedFilter(); + QString suf = selectedNameFilter(); if (rx.indexIn(suf) >= 0) suf = rx.cap(1); if (ext.isEmpty()) setDefaultSuffix(suf); else if (ext.toLower() != suf.toLower()) { - fn = QString::fromAscii("%1.%2").arg(fn).arg(suf); + fn = QString::fromLatin1("%1.%2").arg(fn).arg(suf); selectFile(fn); } } @@ -641,7 +641,7 @@ SelectModule::SelectModule (const QString& type, const SelectModule::Dict& types module = module.left(pos); } - button->setText(QString::fromAscii("%1 (%2)").arg(filter).arg(module)); + button->setText(QString::fromLatin1("%1 (%2)").arg(filter).arg(module)); button->setObjectName(it.value()); gridLayout1->addWidget(button, index, 0, 1, 1); group->addButton(button, index); @@ -716,7 +716,7 @@ SelectModule::Dict SelectModule::exportHandler(const QStringList& fileNames, con std::map::const_iterator it; it = filterList.find((const char*)filter.toUtf8()); if (it != filterList.end()) { - QString module = QString::fromAscii(it->second.c_str()); + QString module = QString::fromLatin1(it->second.c_str()); for (QStringList::const_iterator it = fileNames.begin(); it != fileNames.end(); ++it) { dict[*it] = module; } @@ -731,19 +731,19 @@ SelectModule::Dict SelectModule::exportHandler(const QStringList& fileNames, con for (QStringList::const_iterator it = fileNames.begin(); it != fileNames.end(); ++it) { QFileInfo fi(*it); QString ext = fi.completeSuffix().toLower(); - std::map filters = App::GetApplication().getExportFilters(ext.toAscii()); + std::map filters = App::GetApplication().getExportFilters(ext.toLatin1()); if (filters.empty()) { ext = fi.suffix().toLower(); - filters = App::GetApplication().getExportFilters(ext.toAscii()); + filters = App::GetApplication().getExportFilters(ext.toLatin1()); } fileExtension[ext].push_back(*it); for (std::map::iterator jt = filters.begin(); jt != filters.end(); ++jt) - filetypeHandler[ext][QString::fromUtf8(jt->first.c_str())] = QString::fromAscii(jt->second.c_str()); + filetypeHandler[ext][QString::fromUtf8(jt->first.c_str())] = QString::fromLatin1(jt->second.c_str()); // set the default module handler if (!filters.empty()) - dict[*it] = QString::fromAscii(filters.begin()->second.c_str()); + dict[*it] = QString::fromLatin1(filters.begin()->second.c_str()); } for (QMap::const_iterator it = filetypeHandler.begin(); @@ -778,7 +778,7 @@ SelectModule::Dict SelectModule::importHandler(const QStringList& fileNames, con std::map::const_iterator it; it = filterList.find((const char*)filter.toUtf8()); if (it != filterList.end()) { - QString module = QString::fromAscii(it->second.c_str()); + QString module = QString::fromLatin1(it->second.c_str()); for (QStringList::const_iterator it = fileNames.begin(); it != fileNames.end(); ++it) { dict[*it] = module; } @@ -793,19 +793,19 @@ SelectModule::Dict SelectModule::importHandler(const QStringList& fileNames, con for (QStringList::const_iterator it = fileNames.begin(); it != fileNames.end(); ++it) { QFileInfo fi(*it); QString ext = fi.completeSuffix().toLower(); - std::map filters = App::GetApplication().getImportFilters(ext.toAscii()); + std::map filters = App::GetApplication().getImportFilters(ext.toLatin1()); if (filters.empty()) { ext = fi.suffix().toLower(); - filters = App::GetApplication().getImportFilters(ext.toAscii()); + filters = App::GetApplication().getImportFilters(ext.toLatin1()); } fileExtension[ext].push_back(*it); for (std::map::iterator jt = filters.begin(); jt != filters.end(); ++jt) - filetypeHandler[ext][QString::fromUtf8(jt->first.c_str())] = QString::fromAscii(jt->second.c_str()); + filetypeHandler[ext][QString::fromUtf8(jt->first.c_str())] = QString::fromLatin1(jt->second.c_str()); // set the default module handler if (!filters.empty()) - dict[*it] = QString::fromAscii(filters.begin()->second.c_str()); + dict[*it] = QString::fromLatin1(filters.begin()->second.c_str()); } for (QMap::const_iterator it = filetypeHandler.begin(); diff --git a/src/Gui/FileDialog.h b/src/Gui/FileDialog.h index ddca6a647337..cbfe588c8b0c 100644 --- a/src/Gui/FileDialog.h +++ b/src/Gui/FileDialog.h @@ -83,7 +83,7 @@ class GuiExport FileOptionsDialog : public QFileDialog ExtensionBottom = 1 }; - FileOptionsDialog ( QWidget* parent, Qt::WFlags ); + FileOptionsDialog ( QWidget* parent, Qt::WindowFlags ); virtual ~FileOptionsDialog(); void accept(); diff --git a/src/Gui/HelpView.cpp b/src/Gui/HelpView.cpp index bd4773afe4c4..f71c7b661e19 100644 --- a/src/Gui/HelpView.cpp +++ b/src/Gui/HelpView.cpp @@ -95,8 +95,8 @@ TextBrowser::TextBrowser(QWidget * parent) setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff); setVerticalScrollBarPolicy(Qt::ScrollBarAlwaysOff); - setAcceptDrops( TRUE ); - viewport()->setAcceptDrops( TRUE ); + setAcceptDrops(true); + viewport()->setAcceptDrops(true); connect( d->http, SIGNAL(done(bool)), this, SLOT(done(bool))); connect( d->http, SIGNAL(stateChanged(int)), this, SLOT(onStateChanged(int))); @@ -208,7 +208,7 @@ QVariant TextBrowser::loadFileResource(int type, const QUrl& name) data = file.readAll(); file.close(); } else if (type == QTextDocument::HtmlResource) { - data = QString::fromAscii( + data = QString::fromLatin1( "" "" "" @@ -306,7 +306,7 @@ QVariant TextBrowser::loadHttpResource(int type, const QUrl& name) return d->http->readAll(); } else { if (type == QTextDocument::HtmlResource) { - data = QString::fromAscii( + data = QString::fromLatin1( "" "" "" @@ -469,12 +469,12 @@ void TextBrowser::dropEvent(QDropEvent * e) dataStream >> action; CommandManager& rclMan = Application::Instance->commandManager(); - Command* pCmd = rclMan.getCommandByName(action.toAscii()); + Command* pCmd = rclMan.getCommandByName(action.toLatin1()); if ( pCmd ) { QString info = pCmd->getAction()->whatsThis(); if ( !info.isEmpty() ) { // cannot show help to this command - info = QString::fromAscii( + info = QString::fromLatin1( "" "" "" @@ -482,7 +482,7 @@ void TextBrowser::dropEvent(QDropEvent * e) "" "" ).arg( info ); } else { - info = QString::fromAscii( + info = QString::fromLatin1( "" "" "" diff --git a/src/Gui/InputField.cpp b/src/Gui/InputField.cpp index 37bd9ea4cc5c..26461f924516 100644 --- a/src/Gui/InputField.cpp +++ b/src/Gui/InputField.cpp @@ -52,11 +52,11 @@ InputField::InputField ( QWidget * parent ) iconLabel->setCursor(Qt::ArrowCursor); QPixmap pixmap = BitmapFactory().pixmapFromSvg(":/icons/button_valid.svg", QSize(sizeHint().height(),sizeHint().height())); iconLabel->setPixmap(pixmap); - iconLabel->setStyleSheet(QString::fromAscii("QLabel { border: none; padding: 0px; }")); + iconLabel->setStyleSheet(QString::fromLatin1("QLabel { border: none; padding: 0px; }")); iconLabel->hide(); connect(this, SIGNAL(textChanged(const QString&)), this, SLOT(updateIconLabel(const QString&))); int frameWidth = style()->pixelMetric(QStyle::PM_DefaultFrameWidth); - setStyleSheet(QString::fromAscii("QLineEdit { padding-right: %1px } ").arg(iconLabel->sizeHint().width() + frameWidth + 1)); + setStyleSheet(QString::fromLatin1("QLineEdit { padding-right: %1px } ").arg(iconLabel->sizeHint().width() + frameWidth + 1)); QSize msz = minimumSizeHint(); setMinimumSize(qMax(msz.width(), iconLabel->sizeHint().height() + frameWidth * 2 + 2), qMax(msz.height(), iconLabel->sizeHint().height() + frameWidth * 2 + 2)); @@ -88,7 +88,7 @@ void InputField::contextMenuEvent(QContextMenuEvent *event) { QMenu *editMenu = createStandardContextMenu(); editMenu->setTitle(tr("Edit")); - QMenu* menu = new QMenu(QString::fromAscii("InputFieldContextmenu")); + QMenu* menu = new QMenu(QString::fromLatin1("InputFieldContextmenu")); menu->addMenu(editMenu); menu->addSeparator(); @@ -138,10 +138,10 @@ void InputField::newInput(const QString & text) res = Quantity::parse(text); }catch(Base::Exception &e){ ErrorText = e.what(); - this->setToolTip(QString::fromAscii(ErrorText.c_str())); + this->setToolTip(QString::fromLatin1(ErrorText.c_str())); QPixmap pixmap = BitmapFactory().pixmapFromSvg(":/icons/button_invalid.svg", QSize(sizeHint().height(),sizeHint().height())); iconLabel->setPixmap(pixmap); - parseError(QString::fromAscii(ErrorText.c_str())); + parseError(QString::fromLatin1(ErrorText.c_str())); return; } @@ -149,7 +149,7 @@ void InputField::newInput(const QString & text) iconLabel->setPixmap(pixmap); ErrorText = ""; - this->setToolTip(QString::fromAscii(ErrorText.c_str())); + this->setToolTip(QString::fromLatin1(ErrorText.c_str())); actQuantity = res; double dFactor; res.getUserString(dFactor,actUnitStr); diff --git a/src/Gui/InputVector.cpp b/src/Gui/InputVector.cpp index 58359f988e9f..219a018377d4 100644 --- a/src/Gui/InputVector.cpp +++ b/src/Gui/InputVector.cpp @@ -152,7 +152,7 @@ void LocationWidget::setDirection(const Base::Vector3d& dir) } // add a new item before the very last item - QString display = QString::fromAscii("(%1,%2,%3)") + QString display = QString::fromLatin1("(%1,%2,%3)") .arg(dir.x) .arg(dir.y) .arg(dir.z); @@ -211,7 +211,7 @@ void LocationWidget::on_direction_activated(int index) // ---------------------------------------------------------------------------- -LocationDialog::LocationDialog(QWidget* parent, Qt::WFlags fl) +LocationDialog::LocationDialog(QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl) { } diff --git a/src/Gui/InputVector.h b/src/Gui/InputVector.h index bd9d41f99ba3..aeabf785bdc0 100644 --- a/src/Gui/InputVector.h +++ b/src/Gui/InputVector.h @@ -80,7 +80,7 @@ class GuiExport LocationDialog : public QDialog Q_OBJECT protected: - LocationDialog(QWidget* parent = 0, Qt::WFlags fl = 0); + LocationDialog(QWidget* parent = 0, Qt::WindowFlags fl = 0); virtual ~LocationDialog(); protected: @@ -113,7 +113,7 @@ template class LocationInterface : public LocationDialog, public Ui { public: - LocationInterface(QWidget* parent = 0, Qt::WFlags fl = 0) : LocationDialog(parent, fl) + LocationInterface(QWidget* parent = 0, Qt::WindowFlags fl = 0) : LocationDialog(parent, fl) { this->setupUi(this); this->retranslate(); @@ -125,6 +125,14 @@ class LocationInterface : public LocationDialog, public Ui Ui::retranslateUi(this); if (this->direction->count() == 0) { +#if QT_VERSION >= 0x050000 + this->direction->insertItems(0, QStringList() + << QObject::tr("X") + << QObject::tr("Y") + << QObject::tr("Z") + << QObject::tr("User defined...") + ); +#else this->direction->insertItems(0, QStringList() << QApplication::translate("Gui::LocationDialog", "X", 0, QApplication::UnicodeUTF8) << QApplication::translate("Gui::LocationDialog", "Y", 0, QApplication::UnicodeUTF8) @@ -132,6 +140,7 @@ class LocationInterface : public LocationDialog, public Ui << QApplication::translate("Gui::LocationDialog", "User defined...", 0, QApplication::UnicodeUTF8) ); +#endif this->direction->setCurrentIndex(2); @@ -141,6 +150,12 @@ class LocationInterface : public LocationDialog, public Ui this->direction->setItemData(2, QVariant::fromValue(Base::Vector3d(0,0,1))); } else { +#if QT_VERSION >= 0x050000 + this->direction->setItemText(0, QObject::tr("X")); + this->direction->setItemText(1, QObject::tr("Y")); + this->direction->setItemText(2, QObject::tr("Z")); + this->direction->setItemText(this->direction->count()-1, QObject::tr("User defined...")); +#else this->direction->setItemText(0, QApplication::translate("Gui::LocationDialog", "X", 0, QApplication::UnicodeUTF8)); this->direction->setItemText(1, QApplication::translate("Gui::LocationDialog", "Y", 0, @@ -150,6 +165,7 @@ class LocationInterface : public LocationDialog, public Ui this->direction->setItemText(this->direction->count()-1, QApplication::translate("Gui::LocationDialog", "User defined...", 0, QApplication::UnicodeUTF8)); +#endif } } @@ -209,7 +225,7 @@ class LocationInterface : public LocationDialog, public Ui } // add a new item before the very last item - QString display = QString::fromAscii("(%1,%2,%3)") + QString display = QString::fromLatin1("(%1,%2,%3)") .arg(dir.x) .arg(dir.y) .arg(dir.z); @@ -247,31 +263,47 @@ class LocationInterfaceComp : public Ui Ui::retranslateUi(dlg); if (this->direction->count() == 0) { +#if QT_VERSION >= 0x050000 + this->direction->insertItems(0, QStringList() + << QObject::tr("X") + << QObject::tr("Y") + << QObject::tr("Z") + << QObject::tr("User defined...") + ); +#else this->direction->insertItems(0, QStringList() - << QApplication::translate("Gui::LocationDialog", "X", 0, QApplication::UnicodeUTF8) - << QApplication::translate("Gui::LocationDialog", "Y", 0, QApplication::UnicodeUTF8) - << QApplication::translate("Gui::LocationDialog", "Z", 0, QApplication::UnicodeUTF8) - << QApplication::translate("Gui::LocationDialog", "User defined...", 0, - QApplication::UnicodeUTF8) - ); - + << QApplication::translate("Gui::LocationDialog", "X", 0, QApplication::UnicodeUTF8) + << QApplication::translate("Gui::LocationDialog", "Y", 0, QApplication::UnicodeUTF8) + << QApplication::translate("Gui::LocationDialog", "Z", 0, QApplication::UnicodeUTF8) + << QApplication::translate("Gui::LocationDialog", "User defined...", 0, + QApplication::UnicodeUTF8) + ); +#endif + this->direction->setCurrentIndex(2); - + // Vector3d declared to use with QVariant see Gui/propertyeditor/PropertyItem.h this->direction->setItemData(0, QVariant::fromValue(Base::Vector3d(1,0,0))); this->direction->setItemData(1, QVariant::fromValue(Base::Vector3d(0,1,0))); this->direction->setItemData(2, QVariant::fromValue(Base::Vector3d(0,0,1))); } else { +#if QT_VERSION >= 0x050000 + this->direction->setItemText(0, QObject::tr("X")); + this->direction->setItemText(1, QObject::tr("Y")); + this->direction->setItemText(2, QObject::tr("Z")); + this->direction->setItemText(this->direction->count()-1, QObject::tr("User defined...")); +#else this->direction->setItemText(0, QApplication::translate("Gui::LocationDialog", "X", 0, - QApplication::UnicodeUTF8)); + QApplication::UnicodeUTF8)); this->direction->setItemText(1, QApplication::translate("Gui::LocationDialog", "Y", 0, - QApplication::UnicodeUTF8)); + QApplication::UnicodeUTF8)); this->direction->setItemText(2, QApplication::translate("Gui::LocationDialog", "Z", 0, - QApplication::UnicodeUTF8)); + QApplication::UnicodeUTF8)); this->direction->setItemText(this->direction->count()-1, - QApplication::translate("Gui::LocationDialog", "User defined...", 0, - QApplication::UnicodeUTF8)); + QApplication::translate("Gui::LocationDialog", "User defined...", 0, + QApplication::UnicodeUTF8)); +#endif } } @@ -320,7 +352,7 @@ class LocationInterfaceComp : public Ui } // add a new item before the very last item - QString display = QString::fromAscii("(%1,%2,%3)") + QString display = QString::fromLatin1("(%1,%2,%3)") .arg(dir.x) .arg(dir.y) .arg(dir.z); @@ -359,7 +391,7 @@ template class LocationDialogComp : public LocationDialog { public: - LocationDialogComp(QWidget* parent = 0, Qt::WFlags fl = 0) + LocationDialogComp(QWidget* parent = 0, Qt::WindowFlags fl = 0) : LocationDialog(parent, fl), ui(this) { } diff --git a/src/Gui/Inventor/SoAutoZoomTranslation.cpp b/src/Gui/Inventor/SoAutoZoomTranslation.cpp index 977b101a4c76..c9100fc55c59 100644 --- a/src/Gui/Inventor/SoAutoZoomTranslation.cpp +++ b/src/Gui/Inventor/SoAutoZoomTranslation.cpp @@ -151,4 +151,4 @@ void SoAutoZoomTranslation::getPrimitiveCount(SoGetPrimitiveCountAction * action { //Base::Console().Log("getPrimitiveCount\n"); SoAutoZoomTranslation::doAction((SoAction*)action); -} \ No newline at end of file +} diff --git a/src/Gui/Language/Translator.cpp b/src/Gui/Language/Translator.cpp index 4783148e8fb5..7e2f2c84fd90 100644 --- a/src/Gui/Language/Translator.cpp +++ b/src/Gui/Language/Translator.cpp @@ -171,7 +171,7 @@ TStringList Translator::supportedLanguages() const QDir dir(QLatin1String(":/translations")); for (std::map::const_iterator it = d->mapLanguageTopLevelDomain.begin(); it != d->mapLanguageTopLevelDomain.end(); ++it) { - QString filter = QString::fromAscii("*_%1.qm").arg(QLatin1String(it->second.c_str())); + QString filter = QString::fromLatin1("*_%1.qm").arg(QLatin1String(it->second.c_str())); QStringList fileNames = dir.entryList(QStringList(filter), QDir::Files, QDir::Name); if (!fileNames.isEmpty()) languages.push_back(it->first); @@ -187,7 +187,7 @@ TStringMap Translator::supportedLocales() const QDir dir(QLatin1String(":/translations")); for (std::map::const_iterator it = d->mapLanguageTopLevelDomain.begin(); it != d->mapLanguageTopLevelDomain.end(); ++it) { - QString filter = QString::fromAscii("*_%1.qm").arg(QLatin1String(it->second.c_str())); + QString filter = QString::fromLatin1("*_%1.qm").arg(QLatin1String(it->second.c_str())); QStringList fileNames = dir.entryList(QStringList(filter), QDir::Files, QDir::Name); if (!fileNames.isEmpty()) languages[it->first] = it->second; @@ -229,7 +229,7 @@ void Translator::addPath(const QString& path) void Translator::installQMFiles(const QDir& dir, const char* locale) { - QString filter = QString::fromAscii("*_%1.qm").arg(QLatin1String(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){ bool ok=false; diff --git a/src/Gui/MDIView.cpp b/src/Gui/MDIView.cpp index 80646a14d487..54e2ade36e96 100644 --- a/src/Gui/MDIView.cpp +++ b/src/Gui/MDIView.cpp @@ -44,7 +44,7 @@ using namespace Gui; TYPESYSTEM_SOURCE_ABSTRACT(Gui::MDIView,Gui::BaseView); -MDIView::MDIView(Gui::Document* pcDocument,QWidget* parent, Qt::WFlags wflags) +MDIView::MDIView(Gui::Document* pcDocument,QWidget* parent, Qt::WindowFlags wflags) : QMainWindow(parent, wflags), BaseView(pcDocument),currentMode(Child), wstate(Qt::WindowNoState) { setAttribute(Qt::WA_DeleteOnClose); @@ -117,7 +117,7 @@ void MDIView::onRelabel(Gui::Document *pDoc) } else { cap = QString::fromUtf8(pDoc->getDocument()->Label.getValue()); - cap = QString::fromAscii("%1[*]").arg(cap); + cap = QString::fromLatin1("%1[*]").arg(cap); setWindowTitle(cap); } } diff --git a/src/Gui/MDIView.h b/src/Gui/MDIView.h index eb086c53bd18..913d67ea5cd4 100644 --- a/src/Gui/MDIView.h +++ b/src/Gui/MDIView.h @@ -26,6 +26,7 @@ #include "View.h" #include +#include namespace Gui { @@ -56,7 +57,7 @@ class GuiExport MDIView : public QMainWindow, public BaseView * the view will attach to the active document. Be aware, there isn't * always an active document. */ - MDIView(Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags=0); + MDIView(Gui::Document* pcDocument, QWidget* parent, Qt::WindowFlags wflags=0); /** View destructor * Detach the view from the document, if attached. */ diff --git a/src/Gui/Macro.cpp b/src/Gui/Macro.cpp index e2bb6c507999..988b4cd75165 100644 --- a/src/Gui/Macro.cpp +++ b/src/Gui/Macro.cpp @@ -100,7 +100,7 @@ void MacroManager::commit(void) // sort import lines and avoid duplicates QTextStream str(&file); QStringList import; - import << QString::fromAscii("import FreeCAD"); + import << QString::fromLatin1("import FreeCAD"); QStringList body; QStringList::Iterator it; @@ -118,13 +118,13 @@ void MacroManager::commit(void) } } - QString header = QString::fromAscii("# Macro Begin: "); + QString header = QString::fromLatin1("# Macro Begin: "); header += this->macroName; - header += QString::fromAscii(" +++++++++++++++++++++++++++++++++++++++++++++++++\n"); + header += QString::fromLatin1(" +++++++++++++++++++++++++++++++++++++++++++++++++\n"); - QString footer = QString::fromAscii("# Macro End: "); + QString footer = QString::fromLatin1("# Macro End: "); footer += this->macroName; - footer += QString::fromAscii(" +++++++++++++++++++++++++++++++++++++++++++++++++\n"); + footer += QString::fromLatin1(" +++++++++++++++++++++++++++++++++++++++++++++++++\n"); // write the data to the text file str << header; @@ -171,7 +171,7 @@ void MacroManager::addLine(LineType Type, const char* sLine) comment = true; } - QStringList lines = QString::fromAscii(sLine).split(QLatin1String("\n")); + QStringList lines = QString::fromLatin1(sLine).split(QLatin1String("\n")); if (comment) { for (QStringList::iterator it = lines.begin(); it != lines.end(); ++it) it->prepend(QLatin1String("#")); @@ -193,7 +193,7 @@ void MacroManager::setModule(const char* sModule) { if (this->openMacro && sModule && *sModule != '\0') { - this->macroInProgress.append(QString::fromAscii("import %1").arg(QString::fromAscii(sModule))); + this->macroInProgress.append(QString::fromLatin1("import %1").arg(QString::fromLatin1(sModule))); } } diff --git a/src/Gui/MainWindow.cpp b/src/Gui/MainWindow.cpp index 675c02a076ac..1443f8bb5a46 100644 --- a/src/Gui/MainWindow.cpp +++ b/src/Gui/MainWindow.cpp @@ -44,6 +44,9 @@ # include # include # include +#if QT_VERSION >= 0x050000 +# include +#endif #endif #include @@ -239,7 +242,7 @@ class MainWindowTabBar : public QTabBar /* TRANSLATOR Gui::MainWindow */ -MainWindow::MainWindow(QWidget * parent, Qt::WFlags f) +MainWindow::MainWindow(QWidget * parent, Qt::WindowFlags f) : QMainWindow( parent, f/*WDestructiveClose*/ ) { d = new MainWindowP; @@ -357,7 +360,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WFlags f) // TaskPanel view TaskPanelView* pcTaskPanelView = new TaskPanelView(0, this); pcTaskPanelView->setObjectName - (QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Task View"))); + (QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Task View"))); pcTaskPanelView->setMinimumWidth(210); pDockMgr->registerDockWindow("Std_TaskPanelView", pcTaskPanelView); #endif @@ -365,27 +368,27 @@ MainWindow::MainWindow(QWidget * parent, Qt::WFlags f) // Tree view TreeDockWidget* tree = new TreeDockWidget(0, this); tree->setObjectName - (QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Tree view"))); + (QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Tree view"))); tree->setMinimumWidth(210); pDockMgr->registerDockWindow("Std_TreeView", tree); // Property view PropertyDockView* pcPropView = new PropertyDockView(0, this); pcPropView->setObjectName - (QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Property view"))); + (QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Property view"))); pcPropView->setMinimumWidth(210); pDockMgr->registerDockWindow("Std_PropertyView", pcPropView); // Selection view SelectionView* pcSelectionView = new SelectionView(0, this); pcSelectionView->setObjectName - (QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Selection view"))); + (QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Selection view"))); pcSelectionView->setMinimumWidth(210); pDockMgr->registerDockWindow("Std_SelectionView", pcSelectionView); // Combo view CombiView* pcCombiView = new CombiView(0, this); - pcCombiView->setObjectName(QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Combo View"))); + pcCombiView->setObjectName(QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Combo View"))); pcCombiView->setMinimumWidth(150); pDockMgr->registerDockWindow("Std_CombiView", pcCombiView); @@ -393,14 +396,14 @@ MainWindow::MainWindow(QWidget * parent, Qt::WFlags f) // Report view Gui::DockWnd::ReportView* pcReport = new Gui::DockWnd::ReportView(this); pcReport->setObjectName - (QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Report view"))); + (QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Report view"))); pDockMgr->registerDockWindow("Std_ReportView", pcReport); #else // Report view (must be created before PythonConsole!) ReportOutput* pcReport = new ReportOutput(this); pcReport->setWindowIcon(BitmapFactory().pixmap("MacroEditor")); pcReport->setObjectName - (QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Report view"))); + (QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Report view"))); pDockMgr->registerDockWindow("Std_ReportView", pcReport); // Python console @@ -408,7 +411,7 @@ MainWindow::MainWindow(QWidget * parent, Qt::WFlags f) pcPython->setWordWrapMode(QTextOption::NoWrap); pcPython->setWindowIcon(Gui::BitmapFactory().pixmap("python_small")); pcPython->setObjectName - (QString::fromAscii(QT_TRANSLATE_NOOP("QDockWidget","Python console"))); + (QString::fromLatin1(QT_TRANSLATE_NOOP("QDockWidget","Python console"))); pDockMgr->registerDockWindow("Std_PythonView", pcPython); #if defined(Q_OS_WIN32) @@ -852,11 +855,11 @@ void MainWindow::tabChanged(MDIView* view) for (int i = 0; i < d->tabs->count(); i++) { if (d->tabs->tabData(i).value() == view) { QString cap = view->windowTitle(); - int lastIndex = cap.lastIndexOf(QString::fromAscii("[*]")); + int lastIndex = cap.lastIndexOf(QString::fromLatin1("[*]")); if (lastIndex > 0) { cap = cap.left(lastIndex); if (view->isWindowModified()) - cap = QString::fromAscii("%1*").arg(cap); + cap = QString::fromLatin1("%1*").arg(cap); } d->tabs->setTabToolTip(i, cap); @@ -1009,16 +1012,16 @@ void MainWindow::onWindowsMenuAboutToShow() QAction* action = actions.at(index); QString text; QString title = child->windowTitle(); - int lastIndex = title.lastIndexOf(QString::fromAscii("[*]")); + int lastIndex = title.lastIndexOf(QString::fromLatin1("[*]")); if (lastIndex > 0) { title = title.left(lastIndex); if (child->isWindowModified()) - title = QString::fromAscii("%1*").arg(title); + title = QString::fromLatin1("%1*").arg(title); } if (index < 9) - text = QString::fromAscii("&%1 %2").arg(index+1).arg(title); + text = QString::fromLatin1("&%1 %2").arg(index+1).arg(title); else - text = QString::fromAscii("%1 %2").arg(index+1).arg(title); + text = QString::fromLatin1("%1 %2").arg(index+1).arg(title); action->setText(text); action->setVisible(true); action->setChecked(child == active); @@ -1188,7 +1191,7 @@ void MainWindow::delayedStartup() void MainWindow::appendRecentFile(const QString& filename) { RecentFilesAction *recent = this->findChild - (QString::fromAscii("recentFiles")); + (QString::fromLatin1("recentFiles")); if (recent) { recent->appendFile(filename); } @@ -1234,18 +1237,18 @@ void MainWindow::switchToDockedMode() void MainWindow::loadWindowSettings() { - QString vendor = QString::fromAscii(App::Application::Config()["ExeVendor"].c_str()); - QString application = QString::fromAscii(App::Application::Config()["ExeName"].c_str()); - QString version = QString::fromAscii(App::Application::Config()["ExeVersion"].c_str()); + QString vendor = QString::fromLatin1(App::Application::Config()["ExeVendor"].c_str()); + QString application = QString::fromLatin1(App::Application::Config()["ExeName"].c_str()); + QString version = QString::fromLatin1(App::Application::Config()["ExeVersion"].c_str()); int major = (QT_VERSION >> 0x10) & 0xff; int minor = (QT_VERSION >> 0x08) & 0xff; - QString qtver = QString::fromAscii("Qt%1.%2").arg(major).arg(minor); + QString qtver = QString::fromLatin1("Qt%1.%2").arg(major).arg(minor); QSettings config(vendor, application); config.beginGroup(version); config.beginGroup(qtver); - this->resize(config.value(QString::fromAscii("Size"), this->size()).toSize()); - QPoint pos = config.value(QString::fromAscii("Position"), this->pos()).toPoint(); + this->resize(config.value(QString::fromLatin1("Size"), this->size()).toSize()); + QPoint pos = config.value(QString::fromLatin1("Position"), this->pos()).toPoint(); QRect rect = QApplication::desktop()->availableGeometry(); int x1,x2,y1,y2; // make sure that the main window is not totally out of the visible rectangle @@ -1256,14 +1259,14 @@ void MainWindow::loadWindowSettings() // tmp. disable the report window to suppress some bothering warnings Base::Console().SetEnabledMsgType("ReportOutput", ConsoleMsgType::MsgType_Wrn, false); - this->restoreState(config.value(QString::fromAscii("MainWindowState")).toByteArray()); + this->restoreState(config.value(QString::fromLatin1("MainWindowState")).toByteArray()); std::clog << "Main window restored" << std::endl; Base::Console().SetEnabledMsgType("ReportOutput", ConsoleMsgType::MsgType_Wrn, true); - bool max = config.value(QString::fromAscii("Maximized"), false).toBool(); + bool max = config.value(QString::fromLatin1("Maximized"), false).toBool(); max ? showMaximized() : show(); - statusBar()->setVisible(config.value(QString::fromAscii("StatusBar"), true).toBool()); + statusBar()->setVisible(config.value(QString::fromLatin1("StatusBar"), true).toBool()); config.endGroup(); config.endGroup(); @@ -1273,21 +1276,21 @@ void MainWindow::loadWindowSettings() void MainWindow::saveWindowSettings() { - QString vendor = QString::fromAscii(App::Application::Config()["ExeVendor"].c_str()); - QString application = QString::fromAscii(App::Application::Config()["ExeName"].c_str()); - QString version = QString::fromAscii(App::Application::Config()["ExeVersion"].c_str()); + QString vendor = QString::fromLatin1(App::Application::Config()["ExeVendor"].c_str()); + QString application = QString::fromLatin1(App::Application::Config()["ExeName"].c_str()); + QString version = QString::fromLatin1(App::Application::Config()["ExeVersion"].c_str()); int major = (QT_VERSION >> 0x10) & 0xff; int minor = (QT_VERSION >> 0x08) & 0xff; - QString qtver = QString::fromAscii("Qt%1.%2").arg(major).arg(minor); + QString qtver = QString::fromLatin1("Qt%1.%2").arg(major).arg(minor); QSettings config(vendor, application); config.beginGroup(version); config.beginGroup(qtver); - config.setValue(QString::fromAscii("Size"), this->size()); - config.setValue(QString::fromAscii("Position"), this->pos()); - config.setValue(QString::fromAscii("Maximized"), this->isMaximized()); - config.setValue(QString::fromAscii("MainWindowState"), this->saveState()); - config.setValue(QString::fromAscii("StatusBar"), this->statusBar()->isVisible()); + config.setValue(QString::fromLatin1("Size"), this->size()); + config.setValue(QString::fromLatin1("Position"), this->pos()); + config.setValue(QString::fromLatin1("Maximized"), this->isMaximized()); + config.setValue(QString::fromLatin1("MainWindowState"), this->saveState()); + config.setValue(QString::fromLatin1("StatusBar"), this->statusBar()->isVisible()); config.endGroup(); config.endGroup(); @@ -1326,7 +1329,7 @@ QPixmap MainWindow::splashImage() const { QPixmap splash_image; QDir dir(QString::fromUtf8(App::Application::Config()["UserAppData"].c_str())); - QFileInfo fi(dir.filePath(QString::fromAscii("pixmaps/splash_image.png"))); + QFileInfo fi(dir.filePath(QString::fromLatin1("pixmaps/splash_image.png"))); if (fi.isFile() && fi.exists()) splash_image.load(fi.filePath(), "PNG"); if (splash_image.isNull()) @@ -1336,9 +1339,9 @@ QPixmap MainWindow::splashImage() const std::map::const_iterator tc = App::Application::Config().find("SplashInfoColor"); if (tc != App::Application::Config().end()) { QString title = qApp->applicationName(); - QString major = QString::fromAscii(App::Application::Config()["BuildVersionMajor"].c_str()); - QString minor = QString::fromAscii(App::Application::Config()["BuildVersionMinor"].c_str()); - QString version = QString::fromAscii("%1.%2").arg(major).arg(minor); + QString major = QString::fromLatin1(App::Application::Config()["BuildVersionMajor"].c_str()); + QString minor = QString::fromLatin1(App::Application::Config()["BuildVersionMinor"].c_str()); + QString version = QString::fromLatin1("%1.%2").arg(major).arg(minor); QPainter painter; painter.begin(&splash_image); @@ -1355,7 +1358,7 @@ QPixmap MainWindow::splashImage() const int v = metricVer.width(version); QColor color; - color.setNamedColor(QString::fromAscii(tc->second.c_str())); + color.setNamedColor(QString::fromLatin1(tc->second.c_str())); if (color.isValid()) { painter.setPen(color); painter.setFont(fontExe); @@ -1549,10 +1552,10 @@ void MainWindow::loadUrls(App::Document* doc, const QList& url) if (info.isSymLink()) info.setFile(info.readLink()); std::vector module = App::GetApplication() - .getImportModules(info.completeSuffix().toAscii()); + .getImportModules(info.completeSuffix().toLatin1()); if (module.empty()) { module = App::GetApplication() - .getImportModules(info.suffix().toAscii()); + .getImportModules(info.suffix().toLatin1()); } if (!module.empty()) { // ok, we support files with this extension @@ -1569,8 +1572,15 @@ void MainWindow::loadUrls(App::Document* doc, const QList& url) //#ifndef QT_NO_OPENSSL else if (it->scheme().toLower() == QLatin1String("https")) { QUrl url = *it; +#if QT_VERSION >= 0x050000 + QUrlQuery urlQuery(url); + if (urlQuery.hasQueryItem(QString::fromLatin1("sid"))) { + urlQuery.removeQueryItem(QString::fromLatin1("sid")); + url.setQuery(urlQuery); +#else if (it->hasEncodedQueryItem(QByteArray("sid"))) { url.removeEncodedQueryItem(QByteArray("sid")); +#endif url.setScheme(QLatin1String("http")); } Gui::Dialog::DownloadManager::getInstance()->download(url); @@ -1586,7 +1596,7 @@ void MainWindow::loadUrls(App::Document* doc, const QList& url) // load the files with the associated modules for (SelectModule::Dict::iterator it = dict.begin(); it != dict.end(); ++it) { // if the passed document name doesn't exist the module should create it, if needed - Application::Instance->importFrom(it.key().toUtf8(), docName, it.value().toAscii()); + Application::Instance->importFrom(it.key().toUtf8(), docName, it.value().toLatin1()); } } @@ -1667,7 +1677,7 @@ void MainWindow::customEvent(QEvent* e) if (d) { ViewProviderExtern *view = new ViewProviderExtern(); try { - view->setModeByString("1",msg.toAscii().constData()); + view->setModeByString("1",msg.toLatin1().constData()); d->setAnnotationViewProvider("Vdbg",view); } catch (...) { @@ -1689,9 +1699,9 @@ void MainWindow::customEvent(QEvent* e) StatusBarObserver::StatusBarObserver() : WindowParameter("OutputWindow") { - msg = QString::fromAscii("#000000"); // black - wrn = QString::fromAscii("#ffaa00"); // orange - err = QString::fromAscii("#ff0000"); // red + msg = QString::fromLatin1("#000000"); // black + wrn = QString::fromLatin1("#ffaa00"); // orange + err = QString::fromLatin1("#ff0000"); // red Base::Console().AttachObserver(this); getWindowParameter()->Attach(this); getWindowParameter()->NotifyAll(); @@ -1726,7 +1736,7 @@ void StatusBarObserver::OnChange(Base::Subject &rCaller, const char void StatusBarObserver::Message(const char * m) { // Send the event to the main window to allow thread-safety. Qt will delete it when done. - QString txt = QString::fromAscii("%2").arg(this->msg).arg(QString::fromUtf8(m)); + QString txt = QString::fromLatin1("%2").arg(this->msg).arg(QString::fromUtf8(m)); CustomMessageEvent* ev = new CustomMessageEvent(CustomMessageEvent::Msg, txt); QApplication::postEvent(getMainWindow(), ev); } @@ -1737,7 +1747,7 @@ void StatusBarObserver::Message(const char * m) void StatusBarObserver::Warning(const char *m) { // Send the event to the main window to allow thread-safety. Qt will delete it when done. - QString txt = QString::fromAscii("%2").arg(this->wrn).arg(QString::fromUtf8(m)); + QString txt = QString::fromLatin1("%2").arg(this->wrn).arg(QString::fromUtf8(m)); CustomMessageEvent* ev = new CustomMessageEvent(CustomMessageEvent::Wrn, txt); QApplication::postEvent(getMainWindow(), ev); } @@ -1748,7 +1758,7 @@ void StatusBarObserver::Warning(const char *m) void StatusBarObserver::Error (const char *m) { // Send the event to the main window to allow thread-safety. Qt will delete it when done. - QString txt = QString::fromAscii("%2").arg(this->err).arg(QString::fromUtf8(m)); + QString txt = QString::fromLatin1("%2").arg(this->err).arg(QString::fromUtf8(m)); CustomMessageEvent* ev = new CustomMessageEvent(CustomMessageEvent::Err, txt); QApplication::postEvent(getMainWindow(), ev); } diff --git a/src/Gui/MainWindow.h b/src/Gui/MainWindow.h index 5de7e0b3e945..9aa3aee39d6d 100644 --- a/src/Gui/MainWindow.h +++ b/src/Gui/MainWindow.h @@ -75,7 +75,7 @@ class GuiExport MainWindow : public QMainWindow * Constructs an empty main window. For default \a parent is 0, as there usually is * no toplevel window there. */ - MainWindow(QWidget * parent = 0, Qt::WFlags f = Qt::Window); + MainWindow(QWidget * parent = 0, Qt::WindowFlags f = Qt::Window); /** Destroys the object and frees any allocated resources. */ ~MainWindow(); /** diff --git a/src/Gui/ManualAlignment.cpp b/src/Gui/ManualAlignment.cpp index b8824b43404f..8a95e2252d08 100644 --- a/src/Gui/ManualAlignment.cpp +++ b/src/Gui/ManualAlignment.cpp @@ -330,7 +330,7 @@ class AlignmentView : public Gui::AbstractSplitView public: QLabel* myLabel; - AlignmentView(Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags=0) + AlignmentView(Gui::Document* pcDocument, QWidget* parent, Qt::WindowFlags wflags=0) : AbstractSplitView(pcDocument, parent, wflags) { QSplitter* mainSplitter=0; diff --git a/src/Gui/MenuManager.cpp b/src/Gui/MenuManager.cpp index 3d01a2497c2d..dc4628554597 100644 --- a/src/Gui/MenuManager.cpp +++ b/src/Gui/MenuManager.cpp @@ -22,7 +22,7 @@ #include "PreCompiled.h" -#ifndef _PreComp_ +#ifndef _PreComp_ # include # include # include @@ -198,7 +198,7 @@ void MenuManager::setup(MenuItem* menuItems) const for (QList::ConstIterator it = items.begin(); it != items.end(); ++it) { // search for the menu action - QAction* action = findAction(actions, QString::fromAscii((*it)->command().c_str())); + QAction* action = findAction(actions, QString::fromLatin1((*it)->command().c_str())); if (!action) { // There must be not more than one separator in the menu bar, so // we can safely remove it if available and append it at the end @@ -209,16 +209,20 @@ void MenuManager::setup(MenuItem* menuItems) const else { // create a new menu std::string menuName = (*it)->command(); - QMenu* menu = menuBar->addMenu( - QApplication::translate("Workbench", menuName.c_str(), - 0, QApplication::UnicodeUTF8)); +#if QT_VERSION >= 0x050000 + QMenu* menu = menuBar->addMenu(QApplication::translate("Workbench", menuName.c_str())); +#else + QMenu* menu = menuBar->addMenu( + QApplication::translate("Workbench", menuName.c_str(), + 0, QApplication::UnicodeUTF8)); +#endif action = menu->menuAction(); - menu->setObjectName(QString::fromAscii(menuName.c_str())); - action->setObjectName(QString::fromAscii(menuName.c_str())); + menu->setObjectName(QString::fromLatin1(menuName.c_str())); + action->setObjectName(QString::fromLatin1(menuName.c_str())); } // set the menu user data - action->setData(QString::fromAscii((*it)->command().c_str())); + action->setData(QString::fromLatin1((*it)->command().c_str())); } else { // put the menu at the end @@ -250,7 +254,7 @@ void MenuManager::setup(MenuItem* item, QMenu* menu) const QList actions = menu->actions(); for (QList::ConstIterator it = items.begin(); it != items.end(); ++it) { // search for the menu item - QList used_actions = findActions(actions, QString::fromAscii((*it)->command().c_str())); + QList used_actions = findActions(actions, QString::fromLatin1((*it)->command().c_str())); if (used_actions.isEmpty()) { if ((*it)->command() == "Separator") { QAction* action = menu->addSeparator(); @@ -263,14 +267,18 @@ void MenuManager::setup(MenuItem* item, QMenu* menu) const if ((*it)->hasItems()) { // Creste a submenu std::string menuName = (*it)->command(); +#if QT_VERSION >= 0x050000 + QMenu* submenu = menu->addMenu(QApplication::translate("Workbench", menuName.c_str())); +#else QMenu* submenu = menu->addMenu( QApplication::translate("Workbench", menuName.c_str(), 0, QApplication::UnicodeUTF8)); +#endif QAction* action = submenu->menuAction(); - submenu->setObjectName(QString::fromAscii((*it)->command().c_str())); - action->setObjectName(QString::fromAscii((*it)->command().c_str())); + submenu->setObjectName(QString::fromLatin1((*it)->command().c_str())); + action->setObjectName(QString::fromLatin1((*it)->command().c_str())); // set the menu user data - action->setData(QString::fromAscii((*it)->command().c_str())); + action->setData(QString::fromLatin1((*it)->command().c_str())); used_actions.append(action); } else { @@ -282,7 +290,7 @@ void MenuManager::setup(MenuItem* item, QMenu* menu) const for (int i=count; i < acts.count(); i++) { QAction* a = acts[i]; // set the menu user data - a->setData(QString::fromAscii((*it)->command().c_str())); + a->setData(QString::fromLatin1((*it)->command().c_str())); used_actions.append(a); } } @@ -332,16 +340,24 @@ void MenuManager::retranslate(QMenu* menu) const QByteArray menuName = menu->menuAction()->data().toByteArray(); Command* cmd = mgr.getCommandByName(menuName); if (cmd) { +#if QT_VERSION >= 0x050000 + menu->setTitle(QApplication::translate(cmd->className(), cmd->getMenuText())); +#else menu->setTitle( QApplication::translate(cmd->className(), cmd->getMenuText(), 0, QCoreApplication::CodecForTr)); +#endif } else { +#if QT_VERSION >= 0x050000 + menu->setTitle(QApplication::translate("Workbench", (const char*)menuName)); +#else menu->setTitle( QApplication::translate("Workbench", (const char*)menuName, 0, QApplication::UnicodeUTF8)); +#endif } QList actions = menu->actions(); for (QList::Iterator it = actions.begin(); it != actions.end(); ++it) { diff --git a/src/Gui/NavigationStyle.cpp b/src/Gui/NavigationStyle.cpp index 48fb8c01e329..370425481060 100644 --- a/src/Gui/NavigationStyle.cpp +++ b/src/Gui/NavigationStyle.cpp @@ -1377,12 +1377,12 @@ void NavigationStyle::openPopupMenu(const SbVec2s& position) contextMenu.addMenu(&subMenu); // add submenu at the end to select navigation style - QRegExp rx(QString::fromAscii("^\\w+::(\\w+)Navigation\\w+$")); + QRegExp rx(QString::fromLatin1("^\\w+::(\\w+)Navigation\\w+$")); std::vector types; Base::Type::getAllDerivedFrom(UserNavigationStyle::getClassTypeId(), types); for (std::vector::iterator it = types.begin(); it != types.end(); ++it) { if (*it != UserNavigationStyle::getClassTypeId()) { - QString data = QString::fromAscii(it->getName()); + QString data = QString::fromLatin1(it->getName()); QString name = data.mid(data.indexOf(QLatin1String("::"))+2); if (rx.indexIn(data) > -1) { name = QObject::tr("%1 navigation").arg(rx.cap(1)); diff --git a/src/Gui/NetworkRetriever.cpp b/src/Gui/NetworkRetriever.cpp index 1288cc204aeb..f287faa465da 100644 --- a/src/Gui/NetworkRetriever.cpp +++ b/src/Gui/NetworkRetriever.cpp @@ -118,7 +118,7 @@ void NetworkRetriever::testFailure() if ( wget->state() == QProcess::Running ) { d->fail = false; - Base::Console().Message( tr("Download started...\n").toAscii() ); + Base::Console().Message( tr("Download started...\n").toLatin1() ); } } @@ -240,15 +240,15 @@ bool NetworkRetriever::startDownload( const QString& startUrl ) if ( !d->proxy.isEmpty() ) { QStringList env = wget->environment(); - env << QString::fromAscii("http_proxy=%1").arg(d->proxy); - env << QString::fromAscii("ftp_proxy=%1").arg(d->proxy); + env << QString::fromLatin1("http_proxy=%1").arg(d->proxy); + env << QString::fromLatin1("ftp_proxy=%1").arg(d->proxy); wget->setEnvironment(env); } else { QStringList env = wget->environment(); - env.removeAll(QString::fromAscii("http_proxy=%1").arg(d->proxy)); - env.removeAll(QString::fromAscii("ftp_proxy=%1").arg(d->proxy)); + env.removeAll(QString::fromLatin1("http_proxy=%1").arg(d->proxy)); + env.removeAll(QString::fromLatin1("ftp_proxy=%1").arg(d->proxy)); wget->setEnvironment(env); } @@ -264,7 +264,7 @@ bool NetworkRetriever::startDownload( const QString& startUrl ) { if ( dir.mkdir( d->dir ) == false) { - Base::Console().Error("Directory '%s' could not be created.", (const char*)d->dir.toAscii()); + Base::Console().Error("Directory '%s' could not be created.", (const char*)d->dir.toLatin1()); return true; // please, no error message } } @@ -277,43 +277,43 @@ bool NetworkRetriever::startDownload( const QString& startUrl ) { if ( !d->user.isEmpty() ) { - wgetArguments << QString::fromAscii("--proxy-user=%1").arg( d->user ); + wgetArguments << QString::fromLatin1("--proxy-user=%1").arg( d->user ); if ( !d->passwd.isEmpty() ) { - wgetArguments << QString::fromAscii("--proxy-passwd=%1").arg( d->passwd ); + wgetArguments << QString::fromLatin1("--proxy-passwd=%1").arg( d->passwd ); } } } // output file if ( !d->outputFile.isEmpty() ) - wgetArguments << QString::fromAscii("--output-document=%1").arg( d->outputFile ); + wgetArguments << QString::fromLatin1("--output-document=%1").arg( d->outputFile ); // timestamping enabled -> update newer files only if ( d->timeStamp ) - wgetArguments << QString::fromAscii("-N"); + wgetArguments << QString::fromLatin1("-N"); // get all needed image files if ( d->img ) - wgetArguments << QString::fromAscii("-p"); + wgetArguments << QString::fromLatin1("-p"); // follow relative links only if ( d->folRel ) - wgetArguments<< QString::fromAscii("-L"); + wgetArguments<< QString::fromLatin1("-L"); if ( d->recurse ) { - wgetArguments << QString::fromAscii("-r"); - wgetArguments << QString::fromAscii("--level=%1").arg( d->level ); + wgetArguments << QString::fromLatin1("-r"); + wgetArguments << QString::fromLatin1("--level=%1").arg( d->level ); } if ( d->nop ) - wgetArguments << QString::fromAscii("-np"); + wgetArguments << QString::fromLatin1("-np"); // convert absolute links in to relative if ( d->convert ) - wgetArguments << QString::fromAscii("-k"); + wgetArguments << QString::fromLatin1("-k"); // number of tries - wgetArguments << QString::fromAscii("--tries=%1").arg( d->tries ); + wgetArguments << QString::fromLatin1("--tries=%1").arg( d->tries ); // use HTML file extension if ( d->html ) - wgetArguments << QString::fromAscii("-E"); + wgetArguments << QString::fromLatin1("-E"); // start URL wgetArguments << startUrl; @@ -326,10 +326,10 @@ bool NetworkRetriever::startDownload( const QString& startUrl ) QDir::setCurrent(d->dir); } - wget->start(QString::fromAscii("wget"), wgetArguments); + wget->start(QString::fromLatin1("wget"), wgetArguments); QDir::setCurrent( cwd ); #else - wget->start(QString::fromAscii("wget"), wgetArguments); + wget->start(QString::fromLatin1("wget"), wgetArguments); #endif return wget->state() == QProcess::Running; @@ -371,7 +371,7 @@ void NetworkRetriever::wgetFinished(int exitCode, QProcess::ExitStatus status) bool NetworkRetriever::testWget() { QProcess proc; - proc.start(QString::fromAscii("wget")); + proc.start(QString::fromLatin1("wget")); bool ok = proc.state() == QProcess::Running; proc.kill(); proc.waitForFinished(); @@ -414,8 +414,14 @@ Action * StdCmdDownloadOnlineHelp::createAction(void) { Action *pcAction; - QString exe = QString::fromAscii(App::GetApplication().getExecutableName()); + QString exe = QString::fromLatin1(App::GetApplication().getExecutableName()); pcAction = new Action(this,getMainWindow()); +#if QT_VERSION >= 0x050000 + pcAction->setText(QObject::tr(sMenuText)); + pcAction->setToolTip(QObject::tr(sToolTipText).arg(exe)); + pcAction->setStatusTip(QObject::tr(sStatusTip).arg(exe)); + pcAction->setWhatsThis(QObject::tr(sWhatsThis).arg(exe)); +#else pcAction->setText(QCoreApplication::translate( this->className(), sMenuText, 0, QCoreApplication::CodecForTr)); @@ -428,8 +434,9 @@ Action * StdCmdDownloadOnlineHelp::createAction(void) pcAction->setWhatsThis(QCoreApplication::translate( this->className(), sWhatsThis, 0, QCoreApplication::CodecForTr).arg(exe)); +#endif pcAction->setIcon(Gui::BitmapFactory().pixmap(sPixmap)); - pcAction->setShortcut(QString::fromAscii(sAccel)); + pcAction->setShortcut(QString::fromLatin1(sAccel)); return pcAction; } @@ -437,7 +444,13 @@ Action * StdCmdDownloadOnlineHelp::createAction(void) void StdCmdDownloadOnlineHelp::languageChange() { if (_pcAction) { - QString exe = QString::fromAscii(App::GetApplication().getExecutableName()); + QString exe = QString::fromLatin1(App::GetApplication().getExecutableName()); +#if QT_VERSION >= 0x050000 + _pcAction->setText(QObject::tr(sMenuText)); + _pcAction->setToolTip(QObject::tr(sToolTipText).arg(exe)); + _pcAction->setStatusTip(QObject::tr(sStatusTip).arg(exe)); + _pcAction->setWhatsThis(QObject::tr(sWhatsThis).arg(exe)); +#else _pcAction->setText(QCoreApplication::translate( this->className(), sMenuText, 0, QCoreApplication::CodecForTr)); @@ -450,6 +463,7 @@ void StdCmdDownloadOnlineHelp::languageChange() _pcAction->setWhatsThis(QCoreApplication::translate( this->className(), sWhatsThis, 0, QCoreApplication::CodecForTr).arg(exe)); +#endif } } @@ -479,7 +493,7 @@ void StdCmdDownloadOnlineHelp::activated(int iMsg) } } - wget->setProxy(QString::fromAscii(prx.c_str()), username, password); + wget->setProxy(QString::fromLatin1(prx.c_str()), username, password); } int loop=3; @@ -487,9 +501,9 @@ void StdCmdDownloadOnlineHelp::activated(int iMsg) // set output directory QString path = QString::fromUtf8(App::GetApplication().GetHomePath()); - path += QString::fromAscii("/doc/"); + path += QString::fromLatin1("/doc/"); ParameterGrp::handle hURLGrp = App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/OnlineHelp"); - path = QString::fromUtf8(hURLGrp->GetASCII( "DownloadLocation", path.toAscii() ).c_str()); + path = QString::fromUtf8(hURLGrp->GetASCII( "DownloadLocation", path.toLatin1() ).c_str()); while (loop > 0) { loop--; @@ -536,7 +550,7 @@ void StdCmdDownloadOnlineHelp::activated(int iMsg) } if (canStart) { - bool ok = wget->startDownload(QString::fromAscii(url.c_str())); + bool ok = wget->startDownload(QString::fromLatin1(url.c_str())); if ( ok == false ) Base::Console().Error("The tool 'wget' couldn't be found. Please check your installation."); else if ( wget->isDownloading() && _pcAction ) @@ -552,9 +566,13 @@ void StdCmdDownloadOnlineHelp::activated(int iMsg) void StdCmdDownloadOnlineHelp::wgetFinished() { if (_pcAction) +#if QT_VERSION >= 0x050000 + _pcAction->setText(QObject::tr(sMenuText)); +#else _pcAction->setText(QCoreApplication::translate( this->className(), sMenuText, 0, QCoreApplication::CodecForTr)); +#endif } #include "moc_NetworkRetriever.cpp" diff --git a/src/Gui/OnlineDocumentation.cpp b/src/Gui/OnlineDocumentation.cpp index 8f932b262175..6a2d65a3a0c1 100644 --- a/src/Gui/OnlineDocumentation.cpp +++ b/src/Gui/OnlineDocumentation.cpp @@ -78,7 +78,7 @@ OnlineDocumentation::OnlineDocumentation() if (zip.isValid()) { zipios::ConstEntries entries = zip.entries(); for (zipios::ConstEntries::iterator it = entries.begin(); it != entries.end(); ++it) { - this->files.push_back(QString::fromAscii((*it)->getFileName().c_str())); + this->files.push_back(QString::fromLatin1((*it)->getFileName().c_str())); } } } @@ -102,7 +102,7 @@ QByteArray OnlineDocumentation::loadResource(const QString& filename) const } else if (filename == QLatin1String("/")) { // load the startpage - QString header = QString::fromAscii( + QString header = QString::fromLatin1( "" "" "Python: Index of Modules" @@ -128,12 +128,12 @@ QByteArray OnlineDocumentation::loadResource(const QString& filename) const if (file.endsWith(QLatin1String(".html"))) { file.chop(5); if ((++ct)%15 == 0) - header += QString::fromAscii(""); - header += QString::fromAscii("%2
").arg(file).arg(file); + header += QString::fromLatin1(""); + header += QString::fromLatin1("%2
").arg(file).arg(file); } } - header += QString::fromAscii( + header += QString::fromLatin1( "

" //"

" //"" @@ -146,7 +146,7 @@ QByteArray OnlineDocumentation::loadResource(const QString& filename) const std::string path = App::GetApplication().GetHomePath(); path += "/doc/docs.zip"; zipios::ZipFile zip(path); - zipios::ConstEntryPointer entry = zip.getEntry((const char*)fn.toAscii()); + zipios::ConstEntryPointer entry = zip.getEntry((const char*)fn.toLatin1()); std::istream* str = zip.getInputStream(entry); // set size of the array so that no re-allocation is needed when reading from the stream @@ -158,8 +158,8 @@ QByteArray OnlineDocumentation::loadResource(const QString& filename) const } else { // load the error page - QHttpResponseHeader header(404, QString::fromAscii("File not found")); - header.setContentType(QString::fromAscii("text/html\r\n" + QHttpResponseHeader header(404, QString::fromLatin1("File not found")); + header.setContentType(QString::fromLatin1("text/html\r\n" "\r\n" "Error" "" @@ -318,8 +318,8 @@ QByteArray PythonOnlineHelp::loadResource(const QString& filename) const QByteArray PythonOnlineHelp::fileNotFound() const { QByteArray res; - QHttpResponseHeader header(404, QString::fromAscii("File not found")); - header.setContentType(QString::fromAscii("text/html\r\n" + QHttpResponseHeader header(404, QString::fromLatin1("File not found")); + header.setContentType(QString::fromLatin1("text/html\r\n" "\r\n" "Error" "" @@ -380,7 +380,7 @@ void HttpServer::readClient() // corresponding HTML document from the ZIP file. QTcpSocket* socket = (QTcpSocket*)sender(); if (socket->canReadLine()) { - QString request = QString::fromAscii(socket->readLine()); + QString request = QString::fromLatin1(socket->readLine()); QHttpRequestHeader header(request); if (header.method() == QLatin1String("GET")) { socket->write(help.loadResource(header.path())); diff --git a/src/Gui/Placement.cpp b/src/Gui/Placement.cpp index a6e2e9f0e77a..e51869a073de 100644 --- a/src/Gui/Placement.cpp +++ b/src/Gui/Placement.cpp @@ -73,7 +73,7 @@ class find_placement /* TRANSLATOR Gui::Dialog::Placement */ -Placement::Placement(QWidget* parent, Qt::WFlags fl) +Placement::Placement(QWidget* parent, Qt::WindowFlags fl) : Gui::LocationDialog(parent, fl) { propertyName = "Placement"; // default name @@ -173,7 +173,7 @@ void Placement::applyPlacement(const Base::Placement& p, bool incremental, bool Base::Vector3d pos = cur.getPosition(); const Base::Rotation& rt = cur.getRotation(); - QString cmd = QString::fromAscii( + QString cmd = QString::fromLatin1( "App.getDocument(\"%1\").%2.Placement=" "App.Placement(" "App.Vector(%3,%4,%5)," @@ -187,7 +187,7 @@ void Placement::applyPlacement(const Base::Placement& p, bool incremental, bool .arg(rt[1],0,'g',6) .arg(rt[2],0,'g',6) .arg(rt[3],0,'g',6); - Application::Instance->runPythonCode((const char*)cmd.toAscii()); + Application::Instance->runPythonCode((const char*)cmd.toLatin1()); } } @@ -358,7 +358,7 @@ void Placement::setPlacementData(const Base::Placement& p) if (newitem) { // add a new item before the very last item - QString display = QString::fromAscii("(%1,%2,%3)") + QString display = QString::fromLatin1("(%1,%2,%3)") .arg(dir.x) .arg(dir.y) .arg(dir.z); @@ -414,7 +414,7 @@ void Placement::changeEvent(QEvent *e) /* TRANSLATOR Gui::Dialog::DockablePlacement */ -DockablePlacement::DockablePlacement(QWidget* parent, Qt::WFlags fl) : Placement(parent, fl) +DockablePlacement::DockablePlacement(QWidget* parent, Qt::WindowFlags fl) : Placement(parent, fl) { Gui::DockWindowManager* pDockMgr = Gui::DockWindowManager::instance(); QDockWidget* dw = pDockMgr->addDockWindow(QT_TR_NOOP("Placement"), diff --git a/src/Gui/Placement.h b/src/Gui/Placement.h index 412ec03ba917..b594d4b767a3 100644 --- a/src/Gui/Placement.h +++ b/src/Gui/Placement.h @@ -45,7 +45,7 @@ class GuiExport Placement : public Gui::LocationDialog Q_OBJECT public: - Placement(QWidget* parent = 0, Qt::WFlags fl = 0); + Placement(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~Placement(); void accept(); void reject(); @@ -94,7 +94,7 @@ class GuiExport DockablePlacement : public Placement Q_OBJECT public: - DockablePlacement(QWidget* parent = 0, Qt::WFlags fl = 0); + DockablePlacement(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DockablePlacement(); void accept(); diff --git a/src/Gui/ProgressBar.cpp b/src/Gui/ProgressBar.cpp index 5fd5be65bc0b..67f1df74e1d6 100644 --- a/src/Gui/ProgressBar.cpp +++ b/src/Gui/ProgressBar.cpp @@ -243,7 +243,7 @@ void Sequencer::showRemainingTime() QTime time( 0,0, 0); time = time.addSecs( rest/1000 ); QString remain = Gui::ProgressBar::tr("Remaining: %1").arg(time.toString()); - QString status = QString::fromAscii("%1\t[%2]").arg(txt).arg(remain); + QString status = QString::fromLatin1("%1\t[%2]").arg(txt).arg(remain); if (thr != currentThread) { QMetaObject::invokeMethod(getMainWindow()->statusBar(), "showMessage", diff --git a/src/Gui/ProgressDialog.cpp b/src/Gui/ProgressDialog.cpp index 10c444bc8fd1..c1eccae10fd2 100644 --- a/src/Gui/ProgressDialog.cpp +++ b/src/Gui/ProgressDialog.cpp @@ -195,7 +195,7 @@ void SequencerDialog::showRemainingTime() QTime time( 0,0, 0); time = time.addSecs( rest/1000 ); QString remain = Gui::ProgressDialog::tr("Remaining: %1").arg(time.toString()); - QString status = QString::fromAscii("%1\t[%2]").arg(txt).arg(remain); + QString status = QString::fromLatin1("%1\t[%2]").arg(txt).arg(remain); if (thr != currentThread) { QMetaObject::invokeMethod(d->dlg, "setLabelText", diff --git a/src/Gui/PythonConsole.cpp b/src/Gui/PythonConsole.cpp index 31614a9f4c81..0cc6210ca168 100644 --- a/src/Gui/PythonConsole.cpp +++ b/src/Gui/PythonConsole.cpp @@ -37,6 +37,7 @@ # include # include # include +# include #endif #include "PythonConsole.h" @@ -315,11 +316,11 @@ void InteractiveInterpreter::runCode(PyCodeObject* code) const */ bool InteractiveInterpreter::push(const char* line) { - d->buffer.append(QString::fromAscii(line)); + d->buffer.append(QString::fromLatin1(line)); QString source = d->buffer.join(QLatin1String("\n")); try { - // Source is already UTF-8, so we can use toAscii() - bool more = runSource(source.toAscii()); + // Source is already UTF-8, so we can use toLatin1() + bool more = runSource(source.toLatin1()); if (!more) d->buffer.clear(); return more; @@ -372,7 +373,7 @@ PythonConsole::PythonConsole(QWidget *parent) try { d->interpreter = new InteractiveInterpreter(); } catch (const Base::Exception& e) { - setPlainText(QString::fromAscii(e.what())); + setPlainText(QString::fromLatin1(e.what())); setEnabled(false); } @@ -411,9 +412,9 @@ PythonConsole::PythonConsole(QWidget *parent) const char* version = PyString_AsString(PySys_GetObject("version")); const char* platform = PyString_AsString(PySys_GetObject("platform")); - d->info = QString::fromAscii("Python %1 on %2\n" + d->info = QString::fromLatin1("Python %1 on %2\n" "Type 'help', 'copyright', 'credits' or 'license' for more information.") - .arg(QString::fromAscii(version)).arg(QString::fromAscii(platform)); + .arg(QString::fromLatin1(version)).arg(QString::fromLatin1(platform)); d->output = d->info; printPrompt(PythonConsole::Complete); } @@ -438,7 +439,7 @@ void PythonConsole::OnChange( Base::Subject &rCaller,const char* sR if (strcmp(sReason, "FontSize") == 0 || strcmp(sReason, "Font") == 0) { int fontSize = hPrefGrp->GetInt("FontSize", 10); - QString fontFamily = QString::fromAscii(hPrefGrp->GetASCII("Font", "Courier").c_str()); + QString fontFamily = QString::fromLatin1(hPrefGrp->GetASCII("Font", "Courier").c_str()); QFont font(fontFamily, fontSize); setFont(font); @@ -446,13 +447,13 @@ void PythonConsole::OnChange( Base::Subject &rCaller,const char* sR int width = metric.width(QLatin1String("0000")); setTabStopWidth(width); } else { - QMap::ConstIterator it = d->colormap.find(QString::fromAscii(sReason)); + QMap::ConstIterator it = d->colormap.find(QString::fromLatin1(sReason)); if (it != d->colormap.end()) { QColor color = it.value(); unsigned long col = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8); col = hPrefGrp->GetUnsigned( sReason, col); color.setRgb((col>>24)&0xff, (col>>16)&0xff, (col>>8)&0xff); - pythonSyntax->setColor(QString::fromAscii(sReason), color); + pythonSyntax->setColor(QString::fromLatin1(sReason), color); } } } @@ -522,7 +523,7 @@ void PythonConsole::keyPressEvent(QKeyEvent * e) if (!inputStrg.isEmpty()) { d->history.append( QLatin1String("# ") + inputStrg ); //< put commented string to history ... - inputLineBegin.insertText( QString::fromAscii("# ") ); //< and comment it on console + inputLineBegin.insertText( QString::fromLatin1("# ") ); //< and comment it on console setTextCursor( inputLineBegin ); printPrompt(d->interpreter->hasPendingInput() //< print adequate prompt ? PythonConsole::Incomplete @@ -676,10 +677,10 @@ void PythonConsole::printPrompt(PythonConsole::Prompt mode) switch (mode) { case PythonConsole::Incomplete: - cursor.insertText(QString::fromAscii("... ")); + cursor.insertText(QString::fromLatin1("... ")); break; case PythonConsole::Complete: - cursor.insertText(QString::fromAscii(">>> ")); + cursor.insertText(QString::fromLatin1(">>> ")); break; default: break; @@ -892,7 +893,7 @@ void PythonConsole::dropEvent (QDropEvent * e) for (int i=0; i> action; - printStatement(QString::fromAscii("Gui.runCommand(\"%1\")").arg(action)); + printStatement(QString::fromLatin1("Gui.runCommand(\"%1\")").arg(action)); } e->setDropAction(Qt::CopyAction); @@ -1257,7 +1258,7 @@ QString PythonConsole::readline( void ) if (loop.exec() != 0) { PyErr_SetInterrupt(); } //< send SIGINT to python this->_sourceDrain = NULL; //< disable source drain - return inputBuffer.append(QChar::fromAscii('\n')); //< pass a newline here, since the readline-caller may need it! + return inputBuffer.append(QChar::fromLatin1('\n')); //< pass a newline here, since the readline-caller may need it! } // --------------------------------------------------------------------- diff --git a/src/Gui/PythonConsolePy.cpp b/src/Gui/PythonConsolePy.cpp index fe28a0c6f87b..a23b36f7c1b6 100644 --- a/src/Gui/PythonConsolePy.cpp +++ b/src/Gui/PythonConsolePy.cpp @@ -309,5 +309,5 @@ Py::Object PythonStdin::repr() Py::Object PythonStdin::readline(const Py::Tuple& args) { - return Py::String( (const char *)console->readline().toAscii() ); + return Py::String( (const char *)console->readline().toLatin1() ); } diff --git a/src/Gui/ReportView.cpp b/src/Gui/ReportView.cpp index 3936bd5ad07d..abeb579f382b 100644 --- a/src/Gui/ReportView.cpp +++ b/src/Gui/ReportView.cpp @@ -551,7 +551,7 @@ void ReportOutput::OnChange(Base::Subject &rCaller, const char * sR } else if (strcmp(sReason, "FontSize") == 0 || strcmp(sReason, "Font") == 0) { int fontSize = rclGrp.GetInt("FontSize", 10); - QString fontFamily = QString::fromAscii(rclGrp.GetASCII("Font", "Courier").c_str()); + QString fontFamily = QString::fromLatin1(rclGrp.GetASCII("Font", "Courier").c_str()); QFont font(fontFamily, fontSize); setFont(font); diff --git a/src/Gui/SceneInspector.cpp b/src/Gui/SceneInspector.cpp index 3a1957d6df29..06e71ca8b55a 100644 --- a/src/Gui/SceneInspector.cpp +++ b/src/Gui/SceneInspector.cpp @@ -87,7 +87,7 @@ void SceneModel::setNode(SoNode* node) void SceneModel::setNode(QModelIndex index, SoNode* node) { - this->setData(index, QVariant(QString::fromAscii(node->getTypeId().getName()))); + this->setData(index, QVariant(QString::fromLatin1(node->getTypeId().getName()))); if (node->getTypeId().isDerivedFrom(SoGroup::getClassTypeId())) { SoGroup *group = static_cast(node); // insert SoGroup icon @@ -96,7 +96,7 @@ void SceneModel::setNode(QModelIndex index, SoNode* node) for (int i=0; igetNumChildren();i++) { SoNode* child = group->getChild(i); setNode(this->index(i, 0, index), child); - this->setData(this->index(i, 1, index), QVariant(QString::fromAscii(child->getName()))); + this->setData(this->index(i, 1, index), QVariant(QString::fromLatin1(child->getName()))); } } // insert icon @@ -106,7 +106,7 @@ void SceneModel::setNode(QModelIndex index, SoNode* node) /* TRANSLATOR Gui::Dialog::DlgInspector */ -DlgInspector::DlgInspector(QWidget* parent, Qt::WFlags fl) +DlgInspector::DlgInspector(QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl), ui(new Ui_SceneInspector()) { ui->setupUi(this); @@ -132,8 +132,13 @@ void DlgInspector::setNode(SoNode* node) model->setNode(node); QHeaderView* header = ui->treeView->header(); +#if QT_VERSION >= 0x050000 + header->setSectionResizeMode(0, QHeaderView::Stretch); + header->setSectionsMovable(false); +#else header->setResizeMode(0, QHeaderView::Stretch); header->setMovable(false); +#endif } void DlgInspector::changeEvent(QEvent *e) diff --git a/src/Gui/SceneInspector.h b/src/Gui/SceneInspector.h index 8298ed6a8b6b..a7b187c71d4a 100644 --- a/src/Gui/SceneInspector.h +++ b/src/Gui/SceneInspector.h @@ -66,7 +66,7 @@ class DlgInspector : public QDialog Q_OBJECT public: - DlgInspector(QWidget* parent = 0, Qt::WFlags fl = 0); + DlgInspector(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DlgInspector(); void setNode(SoNode* node); diff --git a/src/Gui/Selection.cpp b/src/Gui/Selection.cpp index a8d078b4228b..63da013d346f 100644 --- a/src/Gui/Selection.cpp +++ b/src/Gui/Selection.cpp @@ -467,7 +467,7 @@ bool SelectionSingleton::setPreselect(const char* pDocName, const char* pObjectN ); if (getMainWindow()) { - getMainWindow()->showMessage(QString::fromAscii(buf),3000); + getMainWindow()->showMessage(QString::fromLatin1(buf),3000); Gui::MDIView* mdi = Gui::Application::Instance->activeDocument()->getActiveView(); mdi->setOverrideCursor(QCursor(Qt::ForbiddenCursor)); } @@ -511,7 +511,7 @@ bool SelectionSingleton::setPreselect(const char* pDocName, const char* pObjectN //FIXME: We shouldn't replace the possibly defined edit cursor //with the arrow cursor. But it seems that we don't even have to. //if (getMainWindow()){ - // getMainWindow()->showMessage(QString::fromAscii(buf),3000); + // getMainWindow()->showMessage(QString::fromLatin1(buf),3000); // Gui::MDIView* mdi = Gui::Application::Instance->activeDocument()->getActiveView(); // mdi->restoreOverrideCursor(); //} @@ -542,7 +542,7 @@ void SelectionSingleton::setPreselectCoord( float x, float y, float z) ,x,y,z); if (getMainWindow()) - getMainWindow()->showMessage(QString::fromAscii(buf),3000); + getMainWindow()->showMessage(QString::fromLatin1(buf),3000); } void SelectionSingleton::rmvPreselect() @@ -641,7 +641,7 @@ bool SelectionSingleton::addSelection(const char* pDocName, const char* pObjectN if (ActiveGate) { if (!ActiveGate->allow(temp.pDoc,temp.pObject,pSubName)) { if (getMainWindow()) { - getMainWindow()->showMessage(QString::fromAscii("Selection not allowed by filter"),5000); + getMainWindow()->showMessage(QString::fromLatin1("Selection not allowed by filter"),5000); Gui::MDIView* mdi = Gui::Application::Instance->activeDocument()->getActiveView(); mdi->setOverrideCursor(Qt::ForbiddenCursor); } diff --git a/src/Gui/SelectionView.cpp b/src/Gui/SelectionView.cpp index c770f3c218e6..e5ca2dd80da1 100644 --- a/src/Gui/SelectionView.cpp +++ b/src/Gui/SelectionView.cpp @@ -82,7 +82,7 @@ void SelectionView::OnChange(Gui::SelectionSingleton::SubjectType &rCaller, temp += Reason.pSubName; } - new QListWidgetItem(QString::fromAscii(temp.c_str()), selectionView); + new QListWidgetItem(QString::fromLatin1(temp.c_str()), selectionView); } else if (Reason.Type == SelectionChanges::ClrSelection) { // remove all items @@ -117,7 +117,7 @@ void SelectionView::OnChange(Gui::SelectionSingleton::SubjectType &rCaller, temp += "."; temp += it->SubName; } - new QListWidgetItem(QString::fromAscii(temp.c_str()), selectionView); + new QListWidgetItem(QString::fromLatin1(temp.c_str()), selectionView); } } } diff --git a/src/Gui/SoFCOffscreenRenderer.cpp b/src/Gui/SoFCOffscreenRenderer.cpp index 0cef2ab2a54e..002dacb9d0e8 100644 --- a/src/Gui/SoFCOffscreenRenderer.cpp +++ b/src/Gui/SoFCOffscreenRenderer.cpp @@ -271,7 +271,7 @@ std::string SoFCOffscreenRenderer::createMIBA(const SbMatrix& mat) const com << " \n" ; com << " \n" ; com << " Unknown\n" ; - com << " " << QDateTime::currentDateTime().toString().toAscii().constData() << "\n" ; + com << " " << QDateTime::currentDateTime().toString().toLatin1().constData() << "\n" ; com << " " << App::GetApplication().getExecutableName() << " " << major << "." << minor << "\n" ; com << " Unknown\n"; com << " 1.0\n"; diff --git a/src/Gui/SoFCSelection.cpp b/src/Gui/SoFCSelection.cpp index 282ebd98f7bf..31a8ac11fba6 100644 --- a/src/Gui/SoFCSelection.cpp +++ b/src/Gui/SoFCSelection.cpp @@ -345,7 +345,7 @@ SoFCSelection::handleEvent(SoHandleEventAction * action) ,pp->getPoint()[1] ,pp->getPoint()[2]); - getMainWindow()->showMessage(QString::fromAscii(buf),3000); + getMainWindow()->showMessage(QString::fromLatin1(buf),3000); } else { // picked point if (highlighted) { @@ -404,7 +404,7 @@ SoFCSelection::handleEvent(SoHandleEventAction * action) ,pp->getPoint()[1] ,pp->getPoint()[2]); - getMainWindow()->showMessage(QString::fromAscii(buf),3000); + getMainWindow()->showMessage(QString::fromLatin1(buf),3000); } } } @@ -438,7 +438,7 @@ SoFCSelection::handleEvent(SoHandleEventAction * action) ,pp->getPoint()[1] ,pp->getPoint()[2]); - getMainWindow()->showMessage(QString::fromAscii(buf),3000); + getMainWindow()->showMessage(QString::fromLatin1(buf),3000); } } @@ -569,7 +569,7 @@ SoFCSelection::handleEvent(SoHandleEventAction * action) ,pp->getPoint()[1] ,pp->getPoint()[2]); - getMainWindow()->showMessage(QString::fromAscii(buf),3000); + getMainWindow()->showMessage(QString::fromLatin1(buf),3000); } } } @@ -603,7 +603,7 @@ SoFCSelection::handleEvent(SoHandleEventAction * action) ,pp->getPoint()[1] ,pp->getPoint()[2]); - getMainWindow()->showMessage(QString::fromAscii(buf),3000); + getMainWindow()->showMessage(QString::fromLatin1(buf),3000); } } diff --git a/src/Gui/SoFCUnifiedSelection.cpp b/src/Gui/SoFCUnifiedSelection.cpp index 03b09a5be632..6b08501cd5f7 100644 --- a/src/Gui/SoFCUnifiedSelection.cpp +++ b/src/Gui/SoFCUnifiedSelection.cpp @@ -368,7 +368,7 @@ SoFCUnifiedSelection::handleEvent(SoHandleEventAction * action) ,pp->getPoint()[1] ,pp->getPoint()[2]); - getMainWindow()->showMessage(QString::fromAscii(buf),3000); + getMainWindow()->showMessage(QString::fromLatin1(buf),3000); if (Gui::Selection().setPreselect(documentName.c_str() ,objectName.c_str() @@ -456,7 +456,7 @@ SoFCUnifiedSelection::handleEvent(SoHandleEventAction * action) ,pp->getPoint()[1] ,pp->getPoint()[2]); - getMainWindow()->showMessage(QString::fromAscii(buf),3000); + getMainWindow()->showMessage(QString::fromLatin1(buf),3000); } } } @@ -494,7 +494,7 @@ SoFCUnifiedSelection::handleEvent(SoHandleEventAction * action) ,pp->getPoint()[1] ,pp->getPoint()[2]); - getMainWindow()->showMessage(QString::fromAscii(buf),3000); + getMainWindow()->showMessage(QString::fromLatin1(buf),3000); } } diff --git a/src/Gui/SoTextLabel.cpp b/src/Gui/SoTextLabel.cpp index 71b29852c53b..2b9b7dfb2a39 100644 --- a/src/Gui/SoTextLabel.cpp +++ b/src/Gui/SoTextLabel.cpp @@ -209,7 +209,7 @@ void SoTextLabel::GLRender(SoGLRenderAction *action) // The font name is of the form "family:style". If 'style' is given it can be // 'Bold', 'Italic' or 'Bold Italic'. QFont font; - QString fn = QString::fromAscii(fontname.getString()); + QString fn = QString::fromLatin1(fontname.getString()); int pos = fn.indexOf(QLatin1Char(':')); if (pos > -1) { if (fn.indexOf(QLatin1String("Bold"),pos,Qt::CaseInsensitive) > pos) @@ -434,7 +434,7 @@ void SoFrameLabel::drawImage() return; } - QFont font(QString::fromAscii(name.getValue()), size.getValue()); + QFont font(QString::fromLatin1(name.getValue()), size.getValue()); QFontMetrics fm(font); int w = 0; int h = fm.height() * num; diff --git a/src/Gui/Splashscreen.cpp b/src/Gui/Splashscreen.cpp index bf207b38ead1..22cbea36156e 100644 --- a/src/Gui/Splashscreen.cpp +++ b/src/Gui/Splashscreen.cpp @@ -62,7 +62,7 @@ class SplashObserver : public Base::ConsoleObserver const std::map& cfg = App::GetApplication().Config(); std::map::const_iterator al = cfg.find("SplashAlignment"); if (al != cfg.end()) { - QString alt = QString::fromAscii(al->second.c_str()); + QString alt = QString::fromLatin1(al->second.c_str()); int align=0; if (alt.startsWith(QLatin1String("VCenter"))) align = Qt::AlignVCenter; @@ -84,7 +84,7 @@ class SplashObserver : public Base::ConsoleObserver // choose text color std::map::const_iterator tc = cfg.find("SplashTextColor"); if (tc != cfg.end()) { - QColor col; col.setNamedColor(QString::fromAscii(tc->second.c_str())); + QColor col; col.setNamedColor(QString::fromLatin1(tc->second.c_str())); if (col.isValid()) textColor = col; } @@ -151,7 +151,7 @@ class SplashObserver : public Base::ConsoleObserver /** * Constructs a splash screen that will display the pixmap. */ -SplashScreen::SplashScreen( const QPixmap & pixmap , Qt::WFlags f ) +SplashScreen::SplashScreen( const QPixmap & pixmap , Qt::WindowFlags f ) : QSplashScreen(pixmap, f) { // write the messages to splasher @@ -241,22 +241,22 @@ static QString getOperatingSystem() switch(QSysInfo::windowsVersion()) { case QSysInfo::WV_NT: - return QString::fromAscii("Windows NT"); + return QString::fromLatin1("Windows NT"); case QSysInfo::WV_2000: - return QString::fromAscii("Windows 2000"); + return QString::fromLatin1("Windows 2000"); case QSysInfo::WV_XP: - return QString::fromAscii("Windows XP"); + return QString::fromLatin1("Windows XP"); case QSysInfo::WV_2003: - return QString::fromAscii("Windows Server 2003"); + return QString::fromLatin1("Windows Server 2003"); case QSysInfo::WV_VISTA: - return QString::fromAscii("Windows Vista"); + return QString::fromLatin1("Windows Vista"); case QSysInfo::WV_WINDOWS7: - return QString::fromAscii("Windows 7"); + return QString::fromLatin1("Windows 7"); default: - return QString::fromAscii("Windows"); + return QString::fromLatin1("Windows"); } #elif defined (Q_OS_MAC) - return QString::fromAscii("Mac OS X"); + return QString::fromLatin1("Mac OS X"); #elif defined (Q_OS_LINUX) QString exe(QLatin1String("lsb_release")); QStringList args; @@ -267,12 +267,12 @@ static QString getOperatingSystem() if (proc.waitForStarted() && proc.waitForFinished()) { QByteArray info = proc.readAll(); info.replace('\n',""); - return QString::fromAscii((const char*)info); + return QString::fromLatin1((const char*)info); } - return QString::fromAscii("Linux"); + return QString::fromLatin1("Linux"); #elif defined (Q_OS_UNIX) - return QString::fromAscii("UNIX"); + return QString::fromLatin1("UNIX"); #else return QString(); #endif @@ -285,44 +285,44 @@ void AboutDialog::setupLabels() std::map::iterator it; QString banner = QString::fromUtf8(config["CopyrightInfo"].c_str()); banner = banner.left( banner.indexOf(QLatin1Char('\n')) ); - QString major = QString::fromAscii(config["BuildVersionMajor"].c_str()); - QString minor = QString::fromAscii(config["BuildVersionMinor"].c_str()); - QString build = QString::fromAscii(config["BuildRevision"].c_str()); - QString disda = QString::fromAscii(config["BuildRevisionDate"].c_str()); - QString mturl = QString::fromAscii(config["MaintainerUrl"].c_str()); + QString major = QString::fromLatin1(config["BuildVersionMajor"].c_str()); + QString minor = QString::fromLatin1(config["BuildVersionMinor"].c_str()); + QString build = QString::fromLatin1(config["BuildRevision"].c_str()); + QString disda = QString::fromLatin1(config["BuildRevisionDate"].c_str()); + QString mturl = QString::fromLatin1(config["MaintainerUrl"].c_str()); QString author = ui->labelAuthor->text(); - author.replace(QString::fromAscii("Unknown Application"), exeName); - author.replace(QString::fromAscii("(c) Unknown Author"), banner); + author.replace(QString::fromLatin1("Unknown Application"), exeName); + author.replace(QString::fromLatin1("(c) Unknown Author"), banner); ui->labelAuthor->setText(author); ui->labelAuthor->setUrl(mturl); QString version = ui->labelBuildVersion->text(); - version.replace(QString::fromAscii("Unknown"), QString::fromAscii("%1.%2").arg(major).arg(minor)); + version.replace(QString::fromLatin1("Unknown"), QString::fromLatin1("%1.%2").arg(major).arg(minor)); ui->labelBuildVersion->setText(version); QString revision = ui->labelBuildRevision->text(); - revision.replace(QString::fromAscii("Unknown"), build); + revision.replace(QString::fromLatin1("Unknown"), build); ui->labelBuildRevision->setText(revision); QString date = ui->labelBuildDate->text(); - date.replace(QString::fromAscii("Unknown"), disda); + date.replace(QString::fromLatin1("Unknown"), disda); ui->labelBuildDate->setText(date); QString os = ui->labelBuildOS->text(); - os.replace(QString::fromAscii("Unknown"), getOperatingSystem()); + os.replace(QString::fromLatin1("Unknown"), getOperatingSystem()); ui->labelBuildOS->setText(os); QString platform = ui->labelBuildPlatform->text(); - platform.replace(QString::fromAscii("Unknown"), - QString::fromAscii("%1-bit").arg(QSysInfo::WordSize)); + platform.replace(QString::fromLatin1("Unknown"), + QString::fromLatin1("%1-bit").arg(QSysInfo::WordSize)); ui->labelBuildPlatform->setText(platform); // branch name it = config.find("BuildRevisionBranch"); if (it != config.end()) { QString branch = ui->labelBuildBranch->text(); - branch.replace(QString::fromAscii("Unknown"), QString::fromAscii(it->second.c_str())); + branch.replace(QString::fromLatin1("Unknown"), QString::fromLatin1(it->second.c_str())); ui->labelBuildBranch->setText(branch); } else { @@ -334,7 +334,7 @@ void AboutDialog::setupLabels() it = config.find("BuildRevisionHash"); if (it != config.end()) { QString hash = ui->labelBuildHash->text(); - hash.replace(QString::fromAscii("Unknown"), QString::fromAscii(it->second.c_str())); + hash.replace(QString::fromLatin1("Unknown"), QString::fromLatin1(it->second.c_str())); ui->labelBuildHash->setText(hash); } else { @@ -353,7 +353,7 @@ class GuiExport LicenseDialog : public QDialog { QString info; #ifdef _USE_3DCONNEXION_SDK - info = QString::fromAscii( + info = QString::fromLatin1( "3D Mouse Support:\n" "Development tools and related technology provided under license from 3Dconnexion.\n" "(c) 1992 - 2012 3Dconnexion. All rights reserved"); @@ -400,9 +400,9 @@ void AboutDialog::on_copyButton_clicked() std::map& config = App::Application::Config(); std::map::iterator it; - QString major = QString::fromAscii(config["BuildVersionMajor"].c_str()); - QString minor = QString::fromAscii(config["BuildVersionMinor"].c_str()); - QString build = QString::fromAscii(config["BuildRevision"].c_str()); + QString major = QString::fromLatin1(config["BuildVersionMajor"].c_str()); + QString minor = QString::fromLatin1(config["BuildVersionMinor"].c_str()); + QString build = QString::fromLatin1(config["BuildRevision"].c_str()); str << "OS: " << getOperatingSystem() << endl; str << "Platform: " << QSysInfo::WordSize << "-bit" << endl; str << "Version: " << major << "." << minor << "." << build << endl; diff --git a/src/Gui/Splashscreen.h b/src/Gui/Splashscreen.h index 0f07e8d2be1c..006efccbed81 100644 --- a/src/Gui/Splashscreen.h +++ b/src/Gui/Splashscreen.h @@ -40,7 +40,7 @@ class SplashScreen : public QSplashScreen Q_OBJECT public: - SplashScreen( const QPixmap & pixmap = QPixmap ( ), Qt::WFlags f = 0 ); + SplashScreen( const QPixmap & pixmap = QPixmap ( ), Qt::WindowFlags f = 0 ); ~SplashScreen(); protected: diff --git a/src/Gui/SplitView3DInventor.cpp b/src/Gui/SplitView3DInventor.cpp index 33879ffb2754..75fa6a168e19 100644 --- a/src/Gui/SplitView3DInventor.cpp +++ b/src/Gui/SplitView3DInventor.cpp @@ -43,7 +43,7 @@ using namespace Gui; TYPESYSTEM_SOURCE_ABSTRACT(Gui::AbstractSplitView,Gui::MDIView); -AbstractSplitView::AbstractSplitView(Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags) +AbstractSplitView::AbstractSplitView(Gui::Document* pcDocument, QWidget* parent, Qt::WindowFlags wflags) : MDIView(pcDocument,parent, wflags) { // important for highlighting @@ -106,8 +106,8 @@ void AbstractSplitView::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp } else if (strcmp(Reason,"HeadlightDirection") == 0) { std::string pos = rGrp.GetASCII("HeadlightDirection"); - QString flt = QString::fromAscii("([-+]?[0-9]+\\.?[0-9]+)"); - QRegExp rx(QString::fromAscii("^\\(%1,%1,%1\\)$").arg(flt)); + QString flt = QString::fromLatin1("([-+]?[0-9]+\\.?[0-9]+)"); + QRegExp rx(QString::fromLatin1("^\\(%1,%1,%1\\)$").arg(flt)); if (rx.indexIn(QLatin1String(pos.c_str())) > -1) { float x = rx.cap(1).toFloat(); float y = rx.cap(2).toFloat(); @@ -135,8 +135,8 @@ void AbstractSplitView::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp } else if (strcmp(Reason,"BacklightDirection") == 0) { std::string pos = rGrp.GetASCII("BacklightDirection"); - QString flt = QString::fromAscii("([-+]?[0-9]+\\.?[0-9]+)"); - QRegExp rx(QString::fromAscii("^\\(%1,%1,%1\\)$").arg(flt)); + QString flt = QString::fromLatin1("([-+]?[0-9]+\\.?[0-9]+)"); + QRegExp rx(QString::fromLatin1("^\\(%1,%1,%1\\)$").arg(flt)); if (rx.indexIn(QLatin1String(pos.c_str())) > -1) { float x = rx.cap(1).toFloat(); float y = rx.cap(2).toFloat(); @@ -363,7 +363,7 @@ void AbstractSplitView::setOverrideCursor(const QCursor& aCursor) TYPESYSTEM_SOURCE_ABSTRACT(Gui::SplitView3DInventor, Gui::AbstractSplitView); -SplitView3DInventor::SplitView3DInventor(int views, Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags) +SplitView3DInventor::SplitView3DInventor(int views, Gui::Document* pcDocument, QWidget* parent, Qt::WindowFlags wflags) : AbstractSplitView(pcDocument,parent, wflags) { QSplitter* mainSplitter=0; diff --git a/src/Gui/SplitView3DInventor.h b/src/Gui/SplitView3DInventor.h index 2131f93a12c5..a6473eff25ba 100644 --- a/src/Gui/SplitView3DInventor.h +++ b/src/Gui/SplitView3DInventor.h @@ -41,7 +41,7 @@ class GuiExport AbstractSplitView : public MDIView, public ParameterGrp::Observe TYPESYSTEM_HEADER(); public: - AbstractSplitView(Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags=0); + AbstractSplitView(Gui::Document* pcDocument, QWidget* parent, Qt::WindowFlags wflags=0); ~AbstractSplitView(); virtual const char *getName(void) const; @@ -73,7 +73,7 @@ class GuiExport SplitView3DInventor : public AbstractSplitView TYPESYSTEM_HEADER(); public: - SplitView3DInventor(int views, Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags=0); + SplitView3DInventor(int views, Gui::Document* pcDocument, QWidget* parent, Qt::WindowFlags wflags=0); ~SplitView3DInventor(); }; diff --git a/src/Gui/TaskPanelView.cpp b/src/Gui/TaskPanelView.cpp index 4c385ae85655..cdccbce88e60 100644 --- a/src/Gui/TaskPanelView.cpp +++ b/src/Gui/TaskPanelView.cpp @@ -23,6 +23,9 @@ #include "PreCompiled.h" +#include +#include + /// Here the FreeCAD includes sorted by Base,App,Gui...... #include "TaskPanelView.h" @@ -48,22 +51,22 @@ TaskPanelView::TaskPanelView(Gui::Document* pcDocument, QWidget *parent) setWindowTitle(tr( "Task View")); - QGridLayout* gridLayout = new QGridLayout(this); + QGridLayout* gridLayout = new QGridLayout(this); iisTaskPanel *taskPanel = new iisTaskPanel(this); iisTaskBox *tb1 = new iisTaskBox( Gui::BitmapFactory().pixmap("document-new"),QLatin1String("Group of Tasks"),true, this); taskPanel->addWidget(tb1); - gridLayout->addWidget(taskPanel, 0, 0, 2, 1); + gridLayout->addWidget(taskPanel, 0, 0, 2, 1); iisIconLabel *i1 = new iisIconLabel( Gui::BitmapFactory().pixmap("view-zoom-in"), QLatin1String("Do Task 1"), tb1); tb1->addIconLabel(i1); //connect(i1, SIGNAL(activated()), this, SLOT(task1())); - + iisIconLabel *i2 = new iisIconLabel( Gui::BitmapFactory().pixmap("view-zoom-out"), QLatin1String("Do Task 2"), tb1); tb1->addIconLabel(i2); - + QHBoxLayout *hbl = new QHBoxLayout(); tb1->groupLayout()->addLayout(hbl); diff --git a/src/Gui/TaskView/TaskAppearance.cpp b/src/Gui/TaskView/TaskAppearance.cpp index bfef66cf564a..1f9ad054c6bc 100644 --- a/src/Gui/TaskView/TaskAppearance.cpp +++ b/src/Gui/TaskView/TaskAppearance.cpp @@ -142,14 +142,14 @@ void TaskAppearance::on_changeMode_activated(const QString& s) App::Property* prop = (*It)->getPropertyByName("DisplayMode"); if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) { App::PropertyEnumeration* Display = (App::PropertyEnumeration*)prop; - Display->setValue((const char*)s.toAscii()); + Display->setValue((const char*)s.toLatin1()); } } } void TaskAppearance::on_changePlot_activated(const QString&s) { - Base::Console().Log("Plot = %s\n",(const char*)s.toAscii()); + Base::Console().Log("Plot = %s\n",(const char*)s.toLatin1()); } /** @@ -231,7 +231,7 @@ void TaskAppearance::setDisplayModes(const std::vector& view App::Property* prop = (*it)->getPropertyByName("DisplayMode"); if (prop && prop->getTypeId() == App::PropertyEnumeration::getClassTypeId()) { App::PropertyEnumeration* display = static_cast(prop); - QString activeMode = QString::fromAscii(display->getValueAsString()); + QString activeMode = QString::fromLatin1(display->getValueAsString()); int index = ui->changeMode->findText(activeMode); if (index != -1) { ui->changeMode->setCurrentIndex(index); diff --git a/src/Gui/TaskView/TaskSelectLinkProperty.cpp b/src/Gui/TaskView/TaskSelectLinkProperty.cpp index 38b252c3ff80..a5b9de9ba8b4 100644 --- a/src/Gui/TaskView/TaskSelectLinkProperty.cpp +++ b/src/Gui/TaskView/TaskSelectLinkProperty.cpp @@ -219,7 +219,7 @@ void TaskSelectLinkProperty::OnChange(Gui::SelectionSingleton::SubjectType &rCal temp += "::"; temp += it->SubName; } - new QListWidgetItem(QString::fromAscii(temp.c_str()), ui->listWidget); + new QListWidgetItem(QString::fromLatin1(temp.c_str()), ui->listWidget); } checkSelectionStatus(); } diff --git a/src/Gui/TaskView/TaskView.cpp b/src/Gui/TaskView/TaskView.cpp index aa52c86e7ec6..64b083ce01ac 100644 --- a/src/Gui/TaskView/TaskView.cpp +++ b/src/Gui/TaskView/TaskView.cpp @@ -23,8 +23,14 @@ #include "PreCompiled.h" -#ifndef _PreComp_ +#ifndef _PreComp_ # include +# include +# include +# include +# include +# include +# include #endif #include "TaskView.h" @@ -245,16 +251,16 @@ TaskView::TaskView(QWidget *parent) Gui::Selection().Attach(this); connectApplicationActiveDocument = - App::GetApplication().signalActiveDocument.connect + App::GetApplication().signalActiveDocument.connect (boost::bind(&Gui::TaskView::TaskView::slotActiveDocument, this, _1)); connectApplicationDeleteDocument = - App::GetApplication().signalDeletedDocument.connect + App::GetApplication().signalDeletedDocument.connect (boost::bind(&Gui::TaskView::TaskView::slotDeletedDocument, this)); connectApplicationUndoDocument = - App::GetApplication().signalUndoDocument.connect + App::GetApplication().signalUndoDocument.connect (boost::bind(&Gui::TaskView::TaskView::slotUndoDocument, this, _1)); connectApplicationRedoDocument = - App::GetApplication().signalRedoDocument.connect + App::GetApplication().signalRedoDocument.connect (boost::bind(&Gui::TaskView::TaskView::slotRedoDocument, this, _1)); } diff --git a/src/Gui/TaskView/TaskView.h b/src/Gui/TaskView/TaskView.h index 72b8100f72fe..27e8cb4ec4d3 100644 --- a/src/Gui/TaskView/TaskView.h +++ b/src/Gui/TaskView/TaskView.h @@ -29,9 +29,14 @@ #include #include +#include + #include #include -#include "TaskWatcher.h" +#include "TaskWatcher.h" + +class QAbstractButton; +class QSplitter; namespace App { class Property; diff --git a/src/Gui/TextEdit.cpp b/src/Gui/TextEdit.cpp index 2bb69905e9de..a3291d2d70d7 100644 --- a/src/Gui/TextEdit.cpp +++ b/src/Gui/TextEdit.cpp @@ -332,7 +332,7 @@ void TextEditor::keyPressEvent (QKeyEvent * e) int indent = hPrefGrp->GetInt( "IndentSize", 4 ); bool space = hPrefGrp->GetBool( "Spaces", false ); QString ch = space ? QString(indent, QLatin1Char(' ')) - : QString::fromAscii("\t"); + : QString::fromLatin1("\t"); QTextCursor cursor = textCursor(); if (!cursor.hasSelection()) { @@ -421,12 +421,12 @@ void TextEditor::OnChange(Base::Subject &rCaller,const char* sReaso #else int fontSize = hPrefGrp->GetInt("FontSize", 10); #endif - QString fontFamily = QString::fromAscii(hPrefGrp->GetASCII( "Font", "Courier" ).c_str()); + QString fontFamily = QString::fromLatin1(hPrefGrp->GetASCII( "Font", "Courier" ).c_str()); QFont font(fontFamily, fontSize); setFont(font); } else { - QMap::ConstIterator it = d->colormap.find(QString::fromAscii(sReason)); + QMap::ConstIterator it = d->colormap.find(QString::fromLatin1(sReason)); if (it != d->colormap.end()) { QColor color = it.value(); unsigned long col = (color.red() << 24) | (color.green() << 16) | (color.blue() << 8); diff --git a/src/Gui/TextureMapping.cpp b/src/Gui/TextureMapping.cpp index d8fb94bc94fd..1d1cc02f9321 100644 --- a/src/Gui/TextureMapping.cpp +++ b/src/Gui/TextureMapping.cpp @@ -48,7 +48,7 @@ using namespace Gui::Dialog; /* TRANSLATOR Gui::Dialog::TextureMapping */ -TextureMapping::TextureMapping(QWidget* parent, Qt::WFlags fl) +TextureMapping::TextureMapping(QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl), grp(0), tex(0), env(0) { ui = new Ui_TextureMapping(); @@ -59,7 +59,7 @@ TextureMapping::TextureMapping(QWidget* parent, Qt::WFlags fl) QStringList formats; QList qtformats = QImageReader::supportedImageFormats(); for (QList::Iterator it = qtformats.begin(); it != qtformats.end(); ++it) { - formats << QString::fromAscii("*.%1").arg(QLatin1String(*it)); + formats << QString::fromLatin1("*.%1").arg(QLatin1String(*it)); } ui->fileChooser->setFilter(tr("Image files (%1)").arg(formats.join(QLatin1String(" ")))); diff --git a/src/Gui/TextureMapping.h b/src/Gui/TextureMapping.h index 77f32f1d2dcc..58927f6434c9 100644 --- a/src/Gui/TextureMapping.h +++ b/src/Gui/TextureMapping.h @@ -39,7 +39,7 @@ class GuiExport TextureMapping : public QDialog Q_OBJECT public: - TextureMapping(QWidget* parent = 0, Qt::WFlags fl = 0); + TextureMapping(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~TextureMapping(); void accept(); void reject(); diff --git a/src/Gui/Thumbnail.cpp b/src/Gui/Thumbnail.cpp index ac0d4490ed40..8947d4345b53 100644 --- a/src/Gui/Thumbnail.cpp +++ b/src/Gui/Thumbnail.cpp @@ -104,7 +104,7 @@ void Thumbnail::SaveDocFile (Base::Writer &writer) const // according to specification add some meta-information to the image uint mt = QDateTime::currentDateTime().toTime_t(); - QString mtime = QString::fromAscii("%1").arg(mt); + QString mtime = QString::fromLatin1("%1").arg(mt); img.setText(QLatin1String("Software"), qApp->applicationName()); img.setText(QLatin1String("Thumb::Mimetype"), QLatin1String("application/x-extension-fcstd")); img.setText(QLatin1String("Thumb::MTime"), mtime); diff --git a/src/Gui/ToolBarManager.cpp b/src/Gui/ToolBarManager.cpp index b539f98f6ee7..be7899e36467 100644 --- a/src/Gui/ToolBarManager.cpp +++ b/src/Gui/ToolBarManager.cpp @@ -22,7 +22,7 @@ #include "PreCompiled.h" -#ifndef _PreComp_ +#ifndef _PreComp_ # include # include # include @@ -198,10 +198,15 @@ void ToolBarManager::setup(ToolBarItem* toolBarItems) bool toolbar_added = false; if (!toolbar) { +#if QT_VERSION >= 0x050000 + toolbar = getMainWindow()->addToolBar(QApplication::translate("Workbench", + toolbarName.c_str())); +#else toolbar = getMainWindow()->addToolBar( QApplication::translate("Workbench", toolbarName.c_str(), 0, QApplication::UnicodeUTF8)); // i18n +#endif toolbar->setObjectName(name); toolbar->setVisible(visible); toolbar_added = true; @@ -260,7 +265,7 @@ void ToolBarManager::setup(ToolBarItem* item, QToolBar* toolbar) const QList actions = toolbar->actions(); for (QList::ConstIterator it = items.begin(); it != items.end(); ++it) { // search for the action item - QAction* action = findAction(actions, QString::fromAscii((*it)->command().c_str())); + QAction* action = findAction(actions, QString::fromLatin1((*it)->command().c_str())); if (!action) { if ((*it)->command() == "Separator") { action = toolbar->addSeparator(); @@ -271,7 +276,7 @@ void ToolBarManager::setup(ToolBarItem* item, QToolBar* toolbar) const } // set the tool button user data - if (action) action->setData(QString::fromAscii((*it)->command().c_str())); + if (action) action->setData(QString::fromLatin1((*it)->command().c_str())); } else { // Note: For toolbars we do not remove and readd the actions // because this causes flicker effects. So, it could happen that the order of @@ -322,10 +327,15 @@ void ToolBarManager::retranslate() const QList toolbars = toolBars(); for (QList::Iterator it = toolbars.begin(); it != toolbars.end(); ++it) { QByteArray toolbarName = (*it)->objectName().toUtf8(); +#if QT_VERSION >= 0x050000 + (*it)->setWindowTitle(QApplication::translate("Workbench", + (const char*)toolbarName)); +#else (*it)->setWindowTitle( QApplication::translate("Workbench", (const char*)toolbarName, 0, QApplication::UnicodeUTF8)); +#endif } } diff --git a/src/Gui/ToolBoxManager.cpp b/src/Gui/ToolBoxManager.cpp index 846c4ce14047..a4cfb165bc35 100644 --- a/src/Gui/ToolBoxManager.cpp +++ b/src/Gui/ToolBoxManager.cpp @@ -89,7 +89,7 @@ void ToolBoxManager::setup( ToolBarItem* toolBar ) const bar->setOrientation(Qt::Vertical); bar->setToolButtonStyle(Qt::ToolButtonTextBesideIcon); std::string toolbarName = (*item)->command(); - bar->setObjectName(QString::fromAscii((*item)->command().c_str())); + bar->setObjectName(QString::fromLatin1((*item)->command().c_str())); bar->setWindowTitle(QObject::trUtf8(toolbarName.c_str())); // i18n _toolBox->addItem( bar, bar->windowTitle() ); diff --git a/src/Gui/Transform.cpp b/src/Gui/Transform.cpp index 608e13e65f5d..41dccbda99cb 100644 --- a/src/Gui/Transform.cpp +++ b/src/Gui/Transform.cpp @@ -301,7 +301,7 @@ void DefaultTransformStrategy::onSelectionChanged(const Gui::SelectionChanges& m /* TRANSLATOR Gui::Dialog::Transform */ -Transform::Transform(QWidget* parent, Qt::WFlags fl) +Transform::Transform(QWidget* parent, Qt::WindowFlags fl) : Gui::LocationDialog(parent, fl), strategy(0) { ui = new Ui_TransformComp(this); diff --git a/src/Gui/Transform.h b/src/Gui/Transform.h index 042d4f691950..f73b1a9059b1 100644 --- a/src/Gui/Transform.h +++ b/src/Gui/Transform.h @@ -71,7 +71,7 @@ class GuiExport Transform : public Gui::LocationDialog Q_OBJECT public: - Transform(QWidget* parent = 0, Qt::WFlags fl = 0); + Transform(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~Transform(); void accept(); void reject(); diff --git a/src/Gui/Tree.cpp b/src/Gui/Tree.cpp index 00922fc5d84f..796ec5b19e8b 100644 --- a/src/Gui/Tree.cpp +++ b/src/Gui/Tree.cpp @@ -96,7 +96,11 @@ TreeWidget::TreeWidget(QWidget* parent) labels << tr("Labels & Attributes"); this->setHeaderLabels(labels); // make sure to show a horizontal scrollbar if needed +#if QT_VERSION >= 0x050000 + this->header()->setSectionResizeMode(0, QHeaderView::ResizeToContents); +#else this->header()->setResizeMode(0, QHeaderView::ResizeToContents); +#endif this->header()->setStretchLastSection(false); // Add the first main label @@ -218,9 +222,9 @@ void TreeWidget::onCreateGroup() if (this->contextItem->type() == DocumentType) { DocumentItem* docitem = static_cast(this->contextItem); App::Document* doc = docitem->document()->getDocument(); - QString cmd = QString::fromAscii("App.getDocument(\"%1\").addObject" + QString cmd = QString::fromLatin1("App.getDocument(\"%1\").addObject" "(\"App::DocumentObjectGroup\",\"%2\")") - .arg(QString::fromAscii(doc->getName())).arg(name); + .arg(QString::fromLatin1(doc->getName())).arg(name); Gui::Document* gui = Gui::Application::Instance->getDocument(doc); gui->openCommand("Create group"); Gui::Application::Instance->runPythonCode(cmd.toUtf8()); @@ -231,10 +235,10 @@ void TreeWidget::onCreateGroup() (this->contextItem); App::DocumentObject* obj = objitem->object()->getObject(); App::Document* doc = obj->getDocument(); - QString cmd = QString::fromAscii("App.getDocument(\"%1\").getObject(\"%2\")" + QString cmd = QString::fromLatin1("App.getDocument(\"%1\").getObject(\"%2\")" ".newObject(\"App::DocumentObjectGroup\",\"%3\")") - .arg(QString::fromAscii(doc->getName())) - .arg(QString::fromAscii(obj->getNameInDocument())) + .arg(QString::fromLatin1(doc->getName())) + .arg(QString::fromLatin1(obj->getNameInDocument())) .arg(name); Gui::Document* gui = Gui::Application::Instance->getDocument(doc); gui->openCommand("Create group"); @@ -496,22 +500,22 @@ void TreeWidget::dropEvent(QDropEvent *event) ::getGroupOfObject(obj); if (par) { // allow an object to be in one group only - QString cmd; - cmd = QString::fromAscii("App.getDocument(\"%1\").getObject(\"%2\").removeObject(" + QString cmd; + cmd = QString::fromLatin1("App.getDocument(\"%1\").getObject(\"%2\").removeObject(" "App.getDocument(\"%1\").getObject(\"%3\"))") - .arg(QString::fromAscii(doc->getName())) - .arg(QString::fromAscii(par->getNameInDocument())) - .arg(QString::fromAscii(obj->getNameInDocument())); + .arg(QString::fromLatin1(doc->getName())) + .arg(QString::fromLatin1(par->getNameInDocument())) + .arg(QString::fromLatin1(obj->getNameInDocument())); Gui::Application::Instance->runPythonCode(cmd.toUtf8()); } // build Python command for execution - QString cmd; - cmd = QString::fromAscii("App.getDocument(\"%1\").getObject(\"%2\").addObject(" + QString cmd; + cmd = QString::fromLatin1("App.getDocument(\"%1\").getObject(\"%2\").addObject(" "App.getDocument(\"%1\").getObject(\"%3\"))") - .arg(QString::fromAscii(doc->getName())) - .arg(QString::fromAscii(grp->getNameInDocument())) - .arg(QString::fromAscii(obj->getNameInDocument())); + .arg(QString::fromLatin1(doc->getName())) + .arg(QString::fromLatin1(grp->getNameInDocument())) + .arg(QString::fromLatin1(obj->getNameInDocument())); Gui::Application::Instance->runPythonCode(cmd.toUtf8()); } gui->commitCommand(); @@ -529,11 +533,11 @@ void TreeWidget::dropEvent(QDropEvent *event) App::DocumentObjectGroup* grp = App::DocumentObjectGroup ::getGroupOfObject(obj); if (grp) { - QString cmd = QString::fromAscii("App.getDocument(\"%1\").getObject(\"%2\").removeObject(" + QString cmd = QString::fromLatin1("App.getDocument(\"%1\").getObject(\"%2\").removeObject(" "App.getDocument(\"%1\").getObject(\"%3\"))") - .arg(QString::fromAscii(doc->getName())) - .arg(QString::fromAscii(grp->getNameInDocument())) - .arg(QString::fromAscii(obj->getNameInDocument())); + .arg(QString::fromLatin1(doc->getName())) + .arg(QString::fromLatin1(grp->getNameInDocument())) + .arg(QString::fromLatin1(obj->getNameInDocument())); Gui::Application::Instance->runPythonCode(cmd.toUtf8()); } } @@ -832,7 +836,7 @@ void DocumentItem::slotResetEdit(const Gui::ViewProviderDocumentObject& v) std::string name (v.getObject()->getNameInDocument()); std::map::iterator it = ObjectMap.find(name); if (it != ObjectMap.end()) { - it->second->setData(0, Qt::BackgroundColorRole,QVariant()); + it->second->setData(0, Qt::BackgroundColorRole,QVariant()); } } @@ -1131,7 +1135,7 @@ void DocumentItem::selectItems(void) // The document objects in 'objs' is a subset of the document objects stored // in 'items'. Since both arrays are sorted we get the wanted tree items in // linear time. - std::vector common; + std::vector common; std::vector::iterator item_it = items.begin(); for (std::vector::iterator it = objs.begin(); it != objs.end(); ++it) { item_it = std::find_if(item_it, items.end(), std::bind2nd(ObjectItem_Equal(), *it)); @@ -1143,7 +1147,7 @@ void DocumentItem::selectItems(void) // get all unselected items of the given document std::sort(common.begin(), common.end()); std::sort(items.begin(), items.end()); - std::vector diff; + std::vector diff; std::back_insert_iterator > biit(diff); std::set_difference(items.begin(), items.end(), common.begin(), common.end(), biit); @@ -1237,28 +1241,28 @@ void DocumentObjectItem::testStatus() QIcon::Mode mode = QIcon::Normal; if (currentStatus & 1) { // visible - // Note: By default the foreground, i.e. text color is invalid - // to make use of the default color of the tree widget's palette. - // If we temporarily set this color to dark and reset to an invalid - // color again we cannot do it with setTextColor() or setForeground(), - // respectively, because for any reason the color would always switch - // to black which will lead to unreadable text if the system background - // hss already a dark color. + // Note: By default the foreground, i.e. text color is invalid + // to make use of the default color of the tree widget's palette. + // If we temporarily set this color to dark and reset to an invalid + // color again we cannot do it with setTextColor() or setForeground(), + // respectively, because for any reason the color would always switch + // to black which will lead to unreadable text if the system background + // hss already a dark color. // However, it works if we set the appropriate role to an empty QVariant(). -#if QT_VERSION >= 0x040200 - this->setData(0, Qt::ForegroundRole,QVariant()); +#if QT_VERSION >= 0x040200 + this->setData(0, Qt::ForegroundRole,QVariant()); #else - this->setData(0, Qt::TextColorRole,QVariant()); -#endif - } - else { // invisible - QStyleOptionViewItem opt; - opt.initFrom(this->treeWidget()); -#if QT_VERSION >= 0x040200 + this->setData(0, Qt::TextColorRole,QVariant()); +#endif + } + else { // invisible + QStyleOptionViewItem opt; + opt.initFrom(this->treeWidget()); +#if QT_VERSION >= 0x040200 this->setForeground(0, opt.palette.color(QPalette::Disabled,QPalette::Dark)); #else this->setTextColor(0, opt.palette.color(QPalette::Disabled,QPalette::Dark)); -#endif +#endif mode = QIcon::Disabled; } @@ -1286,9 +1290,9 @@ void DocumentObjectItem::displayStatusInfo() { App::DocumentObject* Obj = viewObject->getObject(); - QString info = QString::fromAscii(Obj->getStatusString()); + QString info = QString::fromLatin1(Obj->getStatusString()); if ( Obj->mustExecute() == 1 ) - info += QString::fromAscii(" (but must be executed)"); + info += QString::fromLatin1(" (but must be executed)"); getMainWindow()->showMessage( info ); } diff --git a/src/Gui/View3DInventor.cpp b/src/Gui/View3DInventor.cpp index 890cada0e031..acd731a05829 100644 --- a/src/Gui/View3DInventor.cpp +++ b/src/Gui/View3DInventor.cpp @@ -56,6 +56,7 @@ # include #endif # include +# include #include #include @@ -99,7 +100,7 @@ void GLOverlayWidget::paintEvent(QPaintEvent* ev) TYPESYSTEM_SOURCE_ABSTRACT(Gui::View3DInventor,Gui::MDIView); -View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags) +View3DInventor::View3DInventor(Gui::Document* pcDocument, QWidget* parent, Qt::WindowFlags wflags) : MDIView(pcDocument, parent, wflags), _viewerPy(0) { stack = new QStackedWidget(this); @@ -217,8 +218,8 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M } else if (strcmp(Reason,"HeadlightDirection") == 0) { std::string pos = rGrp.GetASCII("HeadlightDirection"); - QString flt = QString::fromAscii("([-+]?[0-9]+\\.?[0-9]+)"); - QRegExp rx(QString::fromAscii("^\\(%1,%1,%1\\)$").arg(flt)); + QString flt = QString::fromLatin1("([-+]?[0-9]+\\.?[0-9]+)"); + QRegExp rx(QString::fromLatin1("^\\(%1,%1,%1\\)$").arg(flt)); if (rx.indexIn(QLatin1String(pos.c_str())) > -1) { float x = rx.cap(1).toFloat(); float y = rx.cap(2).toFloat(); @@ -242,8 +243,8 @@ void View3DInventor::OnChange(ParameterGrp::SubjectType &rCaller,ParameterGrp::M } else if (strcmp(Reason,"BacklightDirection") == 0) { std::string pos = rGrp.GetASCII("BacklightDirection"); - QString flt = QString::fromAscii("([-+]?[0-9]+\\.?[0-9]+)"); - QRegExp rx(QString::fromAscii("^\\(%1,%1,%1\\)$").arg(flt)); + QString flt = QString::fromLatin1("([-+]?[0-9]+\\.?[0-9]+)"); + QRegExp rx(QString::fromLatin1("^\\(%1,%1,%1\\)$").arg(flt)); if (rx.indexIn(QLatin1String(pos.c_str())) > -1) { float x = rx.cap(1).toFloat(); float y = rx.cap(2).toFloat(); diff --git a/src/Gui/View3DInventor.h b/src/Gui/View3DInventor.h index f955c0cc6e32..40fde155ac7e 100644 --- a/src/Gui/View3DInventor.h +++ b/src/Gui/View3DInventor.h @@ -67,7 +67,7 @@ class GuiExport View3DInventor : public MDIView, public ParameterGrp::ObserverTy TYPESYSTEM_HEADER(); public: - View3DInventor(Gui::Document* pcDocument, QWidget* parent, Qt::WFlags wflags=0); + View3DInventor(Gui::Document* pcDocument, QWidget* parent, Qt::WindowFlags wflags=0); ~View3DInventor(); /// Mesage handler diff --git a/src/Gui/View3DInventorViewer.cpp b/src/Gui/View3DInventorViewer.cpp index efff055f33cf..3e09ab8fa63f 100644 --- a/src/Gui/View3DInventorViewer.cpp +++ b/src/Gui/View3DInventorViewer.cpp @@ -80,6 +80,7 @@ # include # include # include +# include #endif #include @@ -1160,7 +1161,7 @@ void View3DInventorViewer::printDimension() unit = QLatin1String("nm"); } - QString dim = QString::fromAscii("%1 x %2 %3") + QString dim = QString::fromLatin1("%1 x %2 %3") .arg(fWidth / fFac,0,'f',2) .arg(fHeight / fFac,0,'f',2) .arg(unit); @@ -2202,7 +2203,7 @@ SoPath * View3DInventorViewer::pickFilterCB(void *viewer, const SoPickedPoint * ,pp->getPoint()[1] ,pp->getPoint()[2]); - getMainWindow()->showMessage(QString::fromAscii(buf),3000); + getMainWindow()->showMessage(QString::fromLatin1(buf),3000); } return pp->getPath(); } diff --git a/src/Gui/View3DPy.cpp b/src/Gui/View3DPy.cpp index 63899b9aa5a2..fa460e6f4592 100644 --- a/src/Gui/View3DPy.cpp +++ b/src/Gui/View3DPy.cpp @@ -2164,4 +2164,4 @@ Py::Object View3DInventorPy::hasAxisCross(const Py::Tuple& args) throw Py::Exception(); SbBool ok = _view->getViewer()->hasAxisCross(); return Py::Boolean(ok ? true : false); -} \ No newline at end of file +} diff --git a/src/Gui/ViewProviderAnnotation.cpp b/src/Gui/ViewProviderAnnotation.cpp index e0d98f3da398..567289cf382c 100644 --- a/src/Gui/ViewProviderAnnotation.cpp +++ b/src/Gui/ViewProviderAnnotation.cpp @@ -247,7 +247,7 @@ ViewProviderAnnotationLabel::ViewProviderAnnotationLabel() Justification.setEnums(JustificationEnums); QFont fn; ADD_PROPERTY(FontSize,(fn.pointSize())); - ADD_PROPERTY(FontName,((const char*)fn.family().toAscii())); + ADD_PROPERTY(FontName,((const char*)fn.family().toLatin1())); ADD_PROPERTY(Frame,(true)); pColor = new SoBaseColor(); @@ -439,7 +439,7 @@ void ViewProviderAnnotationLabel::drawImage(const std::vector& s) return; } - QFont font(QString::fromAscii(this->FontName.getValue()), (int)this->FontSize.getValue()); + QFont font(QString::fromLatin1(this->FontName.getValue()), (int)this->FontSize.getValue()); QFontMetrics fm(font); int w = 0; int h = fm.height() * s.size(); diff --git a/src/Gui/ViewProviderPythonFeature.cpp b/src/Gui/ViewProviderPythonFeature.cpp index 8b217757fabb..3c9f6c10134c 100644 --- a/src/Gui/ViewProviderPythonFeature.cpp +++ b/src/Gui/ViewProviderPythonFeature.cpp @@ -235,7 +235,7 @@ QIcon ViewProviderPythonFeatureImp::getIcon() const std::string content = str.as_std_string(); QPixmap icon; // Check if the passed string is a filename, otherwise treat as xpm data - QFileInfo fi(QString::fromAscii(content.c_str())); + QFileInfo fi(QString::fromLatin1(content.c_str())); if (fi.isFile() && fi.exists()) { icon.load(fi.absoluteFilePath()); } else { diff --git a/src/Gui/WidgetFactory.cpp b/src/Gui/WidgetFactory.cpp index 666c5e195003..11e7bc963a3e 100644 --- a/src/Gui/WidgetFactory.cpp +++ b/src/Gui/WidgetFactory.cpp @@ -27,8 +27,8 @@ #endif // Uncomment this block to remove PySide support and switch back to PyQt -// #undef HAVE_SHIBOKEN -// #undef HAVE_PYSIDE + #undef HAVE_SHIBOKEN + #undef HAVE_PYSIDE #ifdef FC_OS_WIN32 #undef max @@ -428,8 +428,8 @@ QWidget* UiLoader::createWidget(const QString & className, QWidget * parent, if (this->cw.contains(className)) return QUiLoader::createWidget(className, parent, name); QWidget* w = 0; - if (WidgetFactory().CanProduce((const char*)className.toAscii())) - w = WidgetFactory().createWidget((const char*)className.toAscii(), parent); + if (WidgetFactory().CanProduce((const char*)className.toLatin1())) + w = WidgetFactory().createWidget((const char*)className.toLatin1(), parent); if (w) w->setObjectName(name); return w; } @@ -551,8 +551,8 @@ Py::Object UiLoaderPy::createWidget(const Py::Tuple& args) } } - QWidget* widget = loader.createWidget(QString::fromAscii(className.c_str()), parent, - QString::fromAscii(objectName.c_str())); + QWidget* widget = loader.createWidget(QString::fromLatin1(className.c_str()), parent, + QString::fromLatin1(objectName.c_str())); if (!widget) { std::string err = "No such widget class '"; err += className; @@ -617,14 +617,14 @@ ContainerDialog::ContainerDialog( QWidget* templChild ) setWindowTitle( templChild->objectName() ); setObjectName( templChild->objectName() ); - setSizeGripEnabled( TRUE ); + setSizeGripEnabled(true); MyDialogLayout = new QGridLayout(this); buttonOk = new QPushButton(this); buttonOk->setObjectName(QLatin1String("buttonOK")); buttonOk->setText( tr( "&OK" ) ); - buttonOk->setAutoDefault( TRUE ); - buttonOk->setDefault( TRUE ); + buttonOk->setAutoDefault(true); + buttonOk->setDefault(true); MyDialogLayout->addWidget( buttonOk, 1, 0 ); QSpacerItem* spacer = new QSpacerItem( 210, 20, QSizePolicy::Expanding, QSizePolicy::Minimum ); @@ -633,7 +633,7 @@ ContainerDialog::ContainerDialog( QWidget* templChild ) buttonCancel = new QPushButton(this); buttonCancel->setObjectName(QLatin1String("buttonCancel")); buttonCancel->setText( tr( "&Cancel" ) ); - buttonCancel->setAutoDefault( TRUE ); + buttonCancel->setAutoDefault(true); MyDialogLayout->addWidget( buttonCancel, 1, 2 ); @@ -821,7 +821,7 @@ bool PyResource::connect(const char* sender, const char* signal, PyObject* cb) QList list = myDlg->findChildren(); QList::const_iterator it = list.begin(); QObject *obj; - QString sigStr = QString::fromAscii("2%1").arg(QString::fromAscii(signal)); + QString sigStr = QString::fromLatin1("2%1").arg(QString::fromLatin1(signal)); while ( it != list.end() ) { obj = *it; @@ -835,7 +835,7 @@ bool PyResource::connect(const char* sender, const char* signal, PyObject* cb) if (objS) { SignalConnect* sc = new SignalConnect(this, cb, objS); mySingals.push_back(sc); - return QObject::connect(objS, sigStr.toAscii(), sc, SLOT ( onExecute() ) ); + return QObject::connect(objS, sigStr.toLatin1(), sc, SLOT ( onExecute() ) ); } else qWarning( "'%s' does not exist.\n", sender ); @@ -945,14 +945,14 @@ PyObject *PyResource::value(PyObject *args) int nSize = str.count(); PyObject* slist = PyList_New(nSize); for (int i=0; i::ConstIterator it = items.begin(); it != items.end(); ++it) { if (it == items.begin()) +#if QT_VERSION >= 0x050000 + pixmap = (*it)->data(Qt::UserRole).value(); +#else pixmap = qVariantValue((*it)->data(Qt::UserRole)); +#endif dataStream << (*it)->text(); } QMimeData *mimeData = new QMimeData; - mimeData->setData(QString::fromAscii("text/x-action-items"), itemData); + mimeData->setData(QString::fromLatin1("text/x-action-items"), itemData); QDrag *drag = new QDrag(this); drag->setMimeData(mimeData); @@ -226,12 +230,21 @@ QString ActionSelector::availableLabel() const void ActionSelector::retranslateUi() { +#if QT_VERSION >= 0x050000 + labelAvailable->setText(QApplication::translate("Gui::ActionSelector", "Available:")); + labelSelected->setText(QApplication::translate("Gui::ActionSelector", "Selected:")); + addButton->setToolTip(QApplication::translate("Gui::ActionSelector", "Add")); + removeButton->setToolTip(QApplication::translate("Gui::ActionSelector", "Remove")); + upButton->setToolTip(QApplication::translate("Gui::ActionSelector", "Move up")); + downButton->setToolTip(QApplication::translate("Gui::ActionSelector", "Move down")); +#else labelAvailable->setText(QApplication::translate("Gui::ActionSelector", "Available:", 0, QApplication::UnicodeUTF8)); labelSelected->setText(QApplication::translate("Gui::ActionSelector", "Selected:", 0, QApplication::UnicodeUTF8)); addButton->setToolTip(QApplication::translate("Gui::ActionSelector", "Add", 0, QApplication::UnicodeUTF8)); removeButton->setToolTip(QApplication::translate("Gui::ActionSelector", "Remove", 0, QApplication::UnicodeUTF8)); upButton->setToolTip(QApplication::translate("Gui::ActionSelector", "Move up", 0, QApplication::UnicodeUTF8)); downButton->setToolTip(QApplication::translate("Gui::ActionSelector", "Move down", 0, QApplication::UnicodeUTF8)); +#endif } void ActionSelector::changeEvent(QEvent* event) @@ -388,49 +401,49 @@ void AccelLineEdit::keyPressEvent ( QKeyEvent * e) case Qt::ControlModifier: { QKeySequence ks(Qt::CTRL+key); - txt += (QString)(ks); + txt += ks.toString(); setText(txt); } break; case Qt::AltModifier: { QKeySequence ks(Qt::ALT+key); - txt += (QString)(ks); + txt += ks.toString(); setText(txt); } break; case Qt::ShiftModifier: { QKeySequence ks(Qt::SHIFT+key); - txt += (QString)(ks); + txt += ks.toString(); setText(txt); } break; case Qt::ControlModifier+Qt::AltModifier: { QKeySequence ks(Qt::CTRL+Qt::ALT+key); - txt += (QString)(ks); + txt += ks.toString(); setText(txt); } break; case Qt::ControlModifier+Qt::ShiftModifier: { QKeySequence ks(Qt::CTRL+Qt::SHIFT+key); - txt += (QString)(ks); + txt += ks.toString(); setText(txt); } break; case Qt::ShiftModifier+Qt::AltModifier: { QKeySequence ks(Qt::SHIFT+Qt::ALT+key); - txt += (QString)(ks); + txt += ks.toString(); setText(txt); } break; case Qt::ControlModifier+Qt::AltModifier+Qt::ShiftModifier: { QKeySequence ks(Qt::CTRL+Qt::ALT+Qt::SHIFT+key); - txt += (QString)(ks); + txt += ks.toString(); setText(txt); } break; default: { QKeySequence ks(key); - txt += (QString)(ks); + txt += ks.toString(); setText(txt); } break; } @@ -447,7 +460,7 @@ void AccelLineEdit::keyPressEvent ( QKeyEvent * e) * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -CheckListDialog::CheckListDialog( QWidget* parent, Qt::WFlags fl ) +CheckListDialog::CheckListDialog( QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl ) { ui.setupUi(this); @@ -672,10 +685,10 @@ void ColorButton::onRejected() // ------------------------------------------------------------------------------ -UrlLabel::UrlLabel(QWidget * parent, Qt::WFlags f) +UrlLabel::UrlLabel(QWidget * parent, Qt::WindowFlags f) : QLabel(parent, f) { - _url = QString::fromAscii("http://localhost"); + _url = QString::fromLatin1("http://localhost"); setToolTip(this->_url); } @@ -703,7 +716,7 @@ void UrlLabel::mouseReleaseEvent (QMouseEvent *) PyObject* dict = PyModule_GetDict(module); PyObject* func = PyDict_GetItemString(dict, "open"); if (func) { - PyObject* args = Py_BuildValue("(s)", (const char*)this->_url.toAscii()); + PyObject* args = Py_BuildValue("(s)", (const char*)this->_url.toLatin1()); PyObject* result = PyEval_CallObject(func,args); // decrement the args and module reference Py_XDECREF(result); diff --git a/src/Gui/Widgets.h b/src/Gui/Widgets.h index 70366a67f613..0263f67c9778 100644 --- a/src/Gui/Widgets.h +++ b/src/Gui/Widgets.h @@ -142,7 +142,7 @@ class GuiExport CheckListDialog : public QDialog Q_OBJECT public: - CheckListDialog( QWidget* parent = 0, Qt::WFlags fl = 0 ); + CheckListDialog( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~CheckListDialog(); void setCheckableItems( const QStringList& items ); @@ -220,7 +220,7 @@ class GuiExport UrlLabel : public QLabel Q_PROPERTY( QString url READ url WRITE setUrl) public: - UrlLabel ( QWidget * parent = 0, Qt::WFlags f = 0 ); + UrlLabel ( QWidget * parent = 0, Qt::WindowFlags f = 0 ); virtual ~UrlLabel(); QString url() const; diff --git a/src/Gui/Workbench.cpp b/src/Gui/Workbench.cpp index ee3be9a39d7f..d90da118a240 100644 --- a/src/Gui/Workbench.cpp +++ b/src/Gui/Workbench.cpp @@ -23,6 +23,9 @@ #include "PreCompiled.h" +#include +#include + #include "Workbench.h" #include "WorkbenchPy.h" #include "PythonWorkbenchPy.h" @@ -282,7 +285,7 @@ void Workbench::setupCustomShortcuts() const // may be UTF-8 encoded QString str = QString::fromUtf8(it->second.c_str()); QKeySequence shortcut = str; - cmd->getAction()->setShortcut(shortcut); + cmd->getAction()->setShortcut(shortcut.toString()); } } } diff --git a/src/Gui/propertyeditor/PropertyItem.cpp b/src/Gui/propertyeditor/PropertyItem.cpp index f8cefb6cafbf..bf31c3ddfd27 100644 --- a/src/Gui/propertyeditor/PropertyItem.cpp +++ b/src/Gui/propertyeditor/PropertyItem.cpp @@ -170,26 +170,26 @@ QString PropertyItem::pythonIdentifier(const App::Property* prop) const App::PropertyContainer* parent = prop->getContainer(); if (parent->getTypeId() == App::Document::getClassTypeId()) { App::Document* doc = static_cast(parent); - QString docName = QString::fromAscii(App::GetApplication().getDocumentName(doc)); - QString propName = QString::fromAscii(parent->getName(prop)); - return QString::fromAscii("FreeCAD.getDocument(\"%1\").%2").arg(docName).arg(propName); + QString docName = QString::fromLatin1(App::GetApplication().getDocumentName(doc)); + QString propName = QString::fromLatin1(parent->getName(prop)); + return QString::fromLatin1("FreeCAD.getDocument(\"%1\").%2").arg(docName).arg(propName); } if (parent->getTypeId().isDerivedFrom(App::DocumentObject::getClassTypeId())) { App::DocumentObject* obj = static_cast(parent); App::Document* doc = obj->getDocument(); - QString docName = QString::fromAscii(App::GetApplication().getDocumentName(doc)); - QString objName = QString::fromAscii(obj->getNameInDocument()); - QString propName = QString::fromAscii(parent->getName(prop)); - return QString::fromAscii("FreeCAD.getDocument(\"%1\").getObject(\"%2\").%3") + QString docName = QString::fromLatin1(App::GetApplication().getDocumentName(doc)); + QString objName = QString::fromLatin1(obj->getNameInDocument()); + QString propName = QString::fromLatin1(parent->getName(prop)); + return QString::fromLatin1("FreeCAD.getDocument(\"%1\").getObject(\"%2\").%3") .arg(docName).arg(objName).arg(propName); } if (parent->getTypeId().isDerivedFrom(Gui::ViewProviderDocumentObject::getClassTypeId())) { App::DocumentObject* obj = static_cast(parent)->getObject(); App::Document* doc = obj->getDocument(); - QString docName = QString::fromAscii(App::GetApplication().getDocumentName(doc)); - QString objName = QString::fromAscii(obj->getNameInDocument()); - QString propName = QString::fromAscii(parent->getName(prop)); - return QString::fromAscii("FreeCADGui.getDocument(\"%1\").getObject(\"%2\").%3") + QString docName = QString::fromLatin1(App::GetApplication().getDocumentName(doc)); + QString objName = QString::fromLatin1(obj->getNameInDocument()); + QString propName = QString::fromLatin1(parent->getName(prop)); + return QString::fromLatin1("FreeCADGui.getDocument(\"%1\").getObject(\"%2\").%3") .arg(docName).arg(objName).arg(propName); } return QString(); @@ -240,7 +240,7 @@ void PropertyItem::setPropertyValue(const QString& value) it != propertyItems.end(); ++it) { App::PropertyContainer* parent = (*it)->getContainer(); if (parent && !parent->isReadOnly(*it) && !(*it)->StatusBits.test(2)) { - QString cmd = QString::fromAscii("%1 = %2").arg(pythonIdentifier(*it)).arg(value); + QString cmd = QString::fromLatin1("%1 = %2").arg(pythonIdentifier(*it)).arg(value); Gui::Application::Instance->runPythonCode((const char*)cmd.toUtf8()); } } @@ -346,7 +346,7 @@ void PropertyStringItem::setValue(const QVariant& value) if (!value.canConvert(QVariant::String)) return; QString val = value.toString(); - QString data = QString::fromAscii("\"%1\"").arg(val); + QString data = QString::fromLatin1("\"%1\"").arg(val); setPropertyValue(data); } @@ -391,7 +391,7 @@ void PropertyFontItem::setValue(const QVariant& value) if (!value.canConvert(QVariant::String)) return; QString val = value.toString(); - QString data = QString::fromAscii("\"%1\"").arg(val); + QString data = QString::fromLatin1("\"%1\"").arg(val); setPropertyValue(data); } @@ -449,7 +449,7 @@ void PropertyIntegerItem::setValue(const QVariant& value) if (!value.canConvert(QVariant::Int)) return; int val = value.toInt(); - QString data = QString::fromAscii("%1").arg(val); + QString data = QString::fromLatin1("%1").arg(val); setPropertyValue(data); } @@ -495,7 +495,7 @@ void PropertyIntegerConstraintItem::setValue(const QVariant& value) if (!value.canConvert(QVariant::Int)) return; int val = value.toInt(); - QString data = QString::fromAscii("%1").arg(val); + QString data = QString::fromLatin1("%1").arg(val); setPropertyValue(data); } @@ -548,12 +548,12 @@ QVariant PropertyFloatItem::toString(const QVariant& prop) const const std::vector& props = getPropertyData(); if (!props.empty()) { if (props.front()->getTypeId().isDerivedFrom(App::PropertyDistance::getClassTypeId())) { - QString unit = QString::fromAscii("mm"); + QString unit = QString::fromLatin1("mm"); unit.prepend(QLatin1String(" ")); data += unit; } else if (props.front()->getTypeId().isDerivedFrom(App::PropertyLength::getClassTypeId())) { - QString unit = QString::fromAscii("mm"); + QString unit = QString::fromLatin1("mm"); unit.prepend(QLatin1String(" ")); data += unit; } @@ -563,7 +563,7 @@ QVariant PropertyFloatItem::toString(const QVariant& prop) const //data += unit; } else if (props.front()->getTypeId().isDerivedFrom(App::PropertyAcceleration::getClassTypeId())) { - QString unit = QString::fromAscii("mm/s^2"); + QString unit = QString::fromLatin1("mm/s^2"); unit.prepend(QLatin1String(" ")); data += unit; } @@ -585,7 +585,7 @@ void PropertyFloatItem::setValue(const QVariant& value) if (!value.canConvert(QVariant::Double)) return; double val = value.toDouble(); - QString data = QString::fromAscii("%1").arg(val,0,'f',decimals()); + QString data = QString::fromLatin1("%1").arg(val,0,'f',decimals()); setPropertyValue(data); } @@ -607,13 +607,13 @@ void PropertyFloatItem::setEditorData(QWidget *editor, const QVariant& data) con if (prop.empty()) return; else if (prop.front()->getTypeId().isDerivedFrom(App::PropertyDistance::getClassTypeId())) { - QString unit = QString::fromAscii("mm"); + QString unit = QString::fromLatin1("mm"); unit.prepend(QLatin1String(" ")); sb->setSuffix(unit); } else if (prop.front()->getTypeId().isDerivedFrom(App::PropertyLength::getClassTypeId())) { sb->setMinimum(0.0); - QString unit = QString::fromAscii("mm"); + QString unit = QString::fromLatin1("mm"); unit.prepend(QLatin1String(" ")); sb->setSuffix(unit); } @@ -625,7 +625,7 @@ void PropertyFloatItem::setEditorData(QWidget *editor, const QVariant& data) con } else if (prop.front()->getTypeId().isDerivedFrom(App::PropertyAcceleration::getClassTypeId())) { sb->setMinimum(0.0); - QString unit = QString::fromAscii("mm/s^2"); + QString unit = QString::fromLatin1("mm/s^2"); unit.prepend(QLatin1String(" ")); sb->setSuffix(unit); } @@ -730,7 +730,7 @@ void PropertyFloatConstraintItem::setValue(const QVariant& value) if (!value.canConvert(QVariant::Double)) return; double val = value.toDouble(); - QString data = QString::fromAscii("%1").arg(val,0,'f',decimals()); + QString data = QString::fromLatin1("%1").arg(val,0,'f',decimals()); setPropertyValue(data); } @@ -880,7 +880,7 @@ PropertyVectorItem::PropertyVectorItem() QVariant PropertyVectorItem::toString(const QVariant& prop) const { const Base::Vector3d& value = prop.value(); - QString data = QString::fromAscii("[%1 %2 %3]") + QString data = QString::fromLatin1("[%1 %2 %3]") .arg(QLocale::system().toString(value.x, 'f', 2)) .arg(QLocale::system().toString(value.y, 'f', 2)) .arg(QLocale::system().toString(value.z, 'f', 2)); @@ -900,7 +900,7 @@ void PropertyVectorItem::setValue(const QVariant& value) if (!value.canConvert()) return; const Base::Vector3d& val = value.value(); - QString data = QString::fromAscii("(%1, %2, %3)") + QString data = QString::fromLatin1("(%1, %2, %3)") .arg(val.x,0,'f',decimals()) .arg(val.y,0,'f',decimals()) .arg(val.z,0,'f',decimals()); @@ -919,7 +919,7 @@ void PropertyVectorItem::setEditorData(QWidget *editor, const QVariant& data) co { QLineEdit* le = qobject_cast(editor); const Base::Vector3d& value = data.value(); - QString text = QString::fromAscii("[%1 %2 %3]") + QString text = QString::fromLatin1("[%1 %2 %3]") .arg(QLocale::system().toString(value.x, 'f', 2)) .arg(QLocale::system().toString(value.y, 'f', 2)) .arg(QLocale::system().toString(value.z, 'f', 2)); @@ -1054,7 +1054,7 @@ PropertyMatrixItem::PropertyMatrixItem() QVariant PropertyMatrixItem::toString(const QVariant& prop) const { const Base::Matrix4D& value = prop.value(); - QString text = QString::fromAscii("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]") + QString text = QString::fromLatin1("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]") .arg(QLocale::system().toString(value[0][0], 'f', 2)) //(unsigned short usNdx) .arg(QLocale::system().toString(value[0][1], 'f', 2)) .arg(QLocale::system().toString(value[0][2], 'f', 2)) @@ -1096,7 +1096,7 @@ void PropertyMatrixItem::setValue(const QVariant& value) return; const Base::Matrix4D& val = value.value(); const int decimals=16; - QString data = QString::fromAscii("FreeCAD.Matrix(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16)") + QString data = QString::fromLatin1("FreeCAD.Matrix(%1, %2, %3, %4, %5, %6, %7, %8, %9, %10, %11, %12, %13, %14, %15, %16)") .arg(val[0][0],0, 'f', decimals) .arg(val[0][1],0, 'f', decimals) .arg(val[0][2],0, 'f', decimals) @@ -1128,7 +1128,7 @@ void PropertyMatrixItem::setEditorData(QWidget *editor, const QVariant& data) co { QLineEdit* le = qobject_cast(editor); const Base::Matrix4D& value = data.value(); - QString text = QString::fromAscii("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]") + QString text = QString::fromLatin1("[%1 %2 %3 %4 %5 %6 %7 %8 %9 %10 %11 %12 %13 %14 %15 %16]") .arg(QLocale::system().toString(value[0][0], 'f', 2)) //(unsigned short usNdx) .arg(QLocale::system().toString(value[0][1], 'f', 2)) .arg(QLocale::system().toString(value[0][2], 'f', 2)) @@ -1553,7 +1553,7 @@ void PropertyPlacementItem::setValue(const QVariant& value) const Base::Placement& val = value.value(); Base::Vector3d pos = val.getPosition(); const Base::Rotation& rt = val.getRotation(); - QString data = QString::fromAscii("App.Placement(" + QString data = QString::fromLatin1("App.Placement(" "App.Vector(%1,%2,%3)," "App.Rotation(%4,%5,%6,%7))") .arg(pos.x,0,'g',6) @@ -1615,7 +1615,7 @@ void PropertyEnumItem::setValue(const QVariant& value) QStringList items = value.toStringList(); if (!items.isEmpty()) { QString val = items.front(); - QString data = QString::fromAscii("\"%1\"").arg(val); + QString data = QString::fromLatin1("\"%1\"").arg(val); setPropertyValue(data); } } @@ -1690,14 +1690,14 @@ void PropertyStringListItem::setEditorData(QWidget *editor, const QVariant& data { Gui::LabelEditor *le = qobject_cast(editor); QStringList list = data.toStringList(); - le->setText(list.join(QChar::fromAscii('\n'))); + le->setText(list.join(QChar::fromLatin1('\n'))); } QVariant PropertyStringListItem::editorData(QWidget *editor) const { Gui::LabelEditor *le = qobject_cast(editor); QString complete = le->text(); - QStringList list = complete.split(QChar::fromAscii('\n')); + QStringList list = complete.split(QChar::fromLatin1('\n')); return QVariant(list); } @@ -1760,7 +1760,7 @@ QVariant PropertyColorItem::decoration(const App::Property* prop) const QVariant PropertyColorItem::toString(const QVariant& prop) const { QColor value = prop.value(); - QString color = QString::fromAscii("[%1, %2, %3]") + QString color = QString::fromLatin1("[%1, %2, %3]") .arg(value.red()).arg(value.green()).arg(value.blue()); return QVariant(color); } @@ -1782,7 +1782,7 @@ void PropertyColorItem::setValue(const QVariant& value) val.r = (float)col.red()/255.0f; val.g = (float)col.green()/255.0f; val.b = (float)col.blue()/255.0f; - QString data = QString::fromAscii("(%1,%2,%3)") + QString data = QString::fromLatin1("(%1,%2,%3)") .arg(val.r,0,'f',decimals()) .arg(val.g,0,'f',decimals()) .arg(val.b,0,'f',decimals()); @@ -1832,7 +1832,7 @@ void PropertyFileItem::setValue(const QVariant& value) if (!value.canConvert(QVariant::String)) return; QString val = value.toString(); - QString data = QString::fromAscii("\"%1\"").arg(val); + QString data = QString::fromLatin1("\"%1\"").arg(val); setPropertyValue(data); } @@ -1882,7 +1882,7 @@ void PropertyPathItem::setValue(const QVariant& value) if (!value.canConvert(QVariant::String)) return; QString val = value.toString(); - QString data = QString::fromAscii("\"%1\"").arg(val); + QString data = QString::fromLatin1("\"%1\"").arg(val); setPropertyValue(data); } @@ -1932,7 +1932,7 @@ void PropertyTransientFileItem::setValue(const QVariant& value) if (!value.canConvert(QVariant::String)) return; QString val = value.toString(); - QString data = QString::fromAscii("\"%1\"").arg(val); + QString data = QString::fromLatin1("\"%1\"").arg(val); setPropertyValue(data); } @@ -1977,7 +1977,7 @@ LinkLabel::~LinkLabel() void LinkLabel::setPropertyLink(const QStringList& o) { object = o; - QString text = QString::fromAscii( + QString text = QString::fromLatin1( "" @@ -2000,7 +2000,7 @@ void LinkLabel::onLinkActivated (const QString& s) if (s == QLatin1String("@__edit_link_prop__@")) QMessageBox::warning(this, QLatin1String("Not yet implemented"), QLatin1String("Not yet implemented")); else - Gui::Selection().addSelection((const char*)object[0].toAscii(), (const char*)object[1].toAscii()); + Gui::Selection().addSelection((const char*)object[0].toLatin1(), (const char*)object[1].toLatin1()); } TYPESYSTEM_SOURCE(Gui::PropertyEditor::PropertyLinkItem, Gui::PropertyEditor::PropertyItem); @@ -2023,21 +2023,21 @@ QVariant PropertyLinkItem::value(const App::Property* prop) const App::DocumentObject* obj = prop_link->getValue(); QStringList list; if (obj) { - list << QString::fromAscii(obj->getDocument()->getName()); - list << QString::fromAscii(obj->getNameInDocument()); + list << QString::fromLatin1(obj->getDocument()->getName()); + list << QString::fromLatin1(obj->getNameInDocument()); list << QString::fromUtf8(obj->Label.getValue()); } else { App::PropertyContainer* c = prop_link->getContainer(); if (c->getTypeId().isDerivedFrom(App::DocumentObject::getClassTypeId())) { App::DocumentObject* obj = static_cast(c); - list << QString::fromAscii(obj->getDocument()->getName()); + list << QString::fromLatin1(obj->getDocument()->getName()); } else { - list << QString::fromAscii(""); + list << QString::fromLatin1(""); } - list << QString::fromAscii("Null"); - list << QString::fromAscii(""); + list << QString::fromLatin1("Null"); + list << QString::fromLatin1(""); } return QVariant(list); @@ -2051,7 +2051,7 @@ void PropertyLinkItem::setValue(const QVariant& value) if (items.size() > 1) { QString d = items[0]; QString o = items[1]; - QString data = QString::fromAscii("App.getDocument('%1').getObject('%2')").arg(d).arg(o); + QString data = QString::fromLatin1("App.getDocument('%1').getObject('%2')").arg(d).arg(o); setPropertyValue(data); } } diff --git a/src/Gui/propertyeditor/PropertyModel.cpp b/src/Gui/propertyeditor/PropertyModel.cpp index 05c9e06a5d6b..500e1da63b10 100644 --- a/src/Gui/propertyeditor/PropertyModel.cpp +++ b/src/Gui/propertyeditor/PropertyModel.cpp @@ -201,6 +201,7 @@ QModelIndex PropertyModel::propertyIndexFromPath(const QStringList& path) const void PropertyModel::buildUp(const std::map >& props) { + beginResetModel(); // fill up the listview with the properties rootItem->reset(); @@ -222,13 +223,13 @@ void PropertyModel::buildUp(const std::map(PropertySeparatorItem::create()); group->setParent(rootItem); rootItem->appendChild(group); - group->setPropertyName(QString::fromAscii(kt->first.c_str())); + group->setPropertyName(QString::fromLatin1(kt->first.c_str())); // setup the items for the properties std::vector >::const_iterator it; for (it = kt->second.begin(); it != kt->second.end(); ++it) { App::Property* prop = it->front(); - QString editor = QString::fromAscii(prop->getEditorName()); + QString editor = QString::fromLatin1(prop->getEditorName()); if (!editor.isEmpty()) { Base::BaseClass* item = 0; try { @@ -245,14 +246,14 @@ void PropertyModel::buildUp(const std::mapsetParent(rootItem); rootItem->appendChild(child); - child->setPropertyName(QString::fromAscii(prop->getName())); + child->setPropertyName(QString::fromLatin1(prop->getName())); child->setPropertyData(*it); } } } } - reset(); + endResetModel(); } #include "moc_PropertyModel.cpp" diff --git a/src/Main/FreeCADGuiPy.cpp b/src/Main/FreeCADGuiPy.cpp index 7a19da8f9fc1..203fa6e42612 100644 --- a/src/Main/FreeCADGuiPy.cpp +++ b/src/Main/FreeCADGuiPy.cpp @@ -255,7 +255,7 @@ QWidget* setupMainWindow() if (!appName.isEmpty()) mw->setWindowTitle(appName); else - mw->setWindowTitle(QString::fromAscii(App::Application::Config()["ExeName"].c_str())); + mw->setWindowTitle(QString::fromLatin1(App::Application::Config()["ExeName"].c_str())); if (!SoDB::isInitialized()) { // init the Inventor subsystem @@ -286,7 +286,7 @@ QWidget* setupMainWindow() // if the auto workbench is not visible then force to use the default workbech // and replace the wrong entry in the parameters QStringList wb = Gui::Application::Instance->workbenches(); - if (!wb.contains(QString::fromAscii(start.c_str()))) { + if (!wb.contains(QString::fromLatin1(start.c_str()))) { start = App::Application::Config()["StartWorkbench"]; App::GetApplication().GetParameterGroupByPath("User parameter:BaseApp/Preferences/General")-> SetASCII("AutoloadModule", start.c_str()); diff --git a/src/Main/MainGui.cpp b/src/Main/MainGui.cpp index 641268fcfd3c..5b463fdbc3be 100644 --- a/src/Main/MainGui.cpp +++ b/src/Main/MainGui.cpp @@ -122,7 +122,7 @@ class Branding if (!root.isNull()) { child = root.firstChildElement(); while (!child.isNull()) { - std::string name = (const char*)child.localName().toAscii(); + std::string name = (const char*)child.localName().toLatin1(); std::string value = (const char*)child.text().toUtf8(); if (std::find(filter.begin(), filter.end(), name) != filter.end()) cfg[name] = value; @@ -238,16 +238,16 @@ int main( int argc, char ** argv ) } catch (const Base::UnknownProgramOption& e) { QApplication app(argc,argv); - QString appName = QString::fromAscii(App::Application::Config()["ExeName"].c_str()); - QString msg = QString::fromAscii(e.what()); + QString appName = QString::fromLatin1(App::Application::Config()["ExeName"].c_str()); + QString msg = QString::fromLatin1(e.what()); QString s = QLatin1String("

") + msg + QLatin1String("
"); QMessageBox::critical(0, appName, s); exit(1); } catch (const Base::ProgramInformation& e) { QApplication app(argc,argv); - QString appName = QString::fromAscii(App::Application::Config()["ExeName"].c_str()); - QString msg = QString::fromAscii(e.what()); + QString appName = QString::fromLatin1(App::Application::Config()["ExeName"].c_str()); + QString msg = QString::fromLatin1(e.what()); QString s = QLatin1String("
") + msg + QLatin1String("
"); QMessageBox::information(0, appName, s); exit(0); @@ -255,13 +255,13 @@ int main( int argc, char ** argv ) catch (const Base::Exception& e) { // Popup an own dialog box instead of that one of Windows QApplication app(argc,argv); - QString appName = QString::fromAscii(App::Application::Config()["ExeName"].c_str()); + QString appName = QString::fromLatin1(App::Application::Config()["ExeName"].c_str()); QString msg; msg = QObject::tr("While initializing %1 the following exception occurred: '%2'\n\n" "Python is searching for its files in the following directories:\n%3\n\n" "Python version information:\n%4\n") .arg(appName).arg(QString::fromUtf8(e.what())) - .arg(QString::fromUtf8(Py_GetPath())).arg(QString::fromAscii(Py_GetVersion())); + .arg(QString::fromUtf8(Py_GetPath())).arg(QString::fromLatin1(Py_GetVersion())); const char* pythonhome = getenv("PYTHONHOME"); if (pythonhome) { msg += QObject::tr("\nThe environment variable PYTHONHOME is set to '%1'.") @@ -278,7 +278,7 @@ int main( int argc, char ** argv ) catch (...) { // Popup an own dialog box instead of that one of Windows QApplication app(argc,argv); - QString appName = QString::fromAscii(App::Application::Config()["ExeName"].c_str()); + QString appName = QString::fromLatin1(App::Application::Config()["ExeName"].c_str()); QString msg = QObject::tr("Unknown runtime error occurred while initializing %1.\n\n" "Please contact the application's support team for more information.\n\n").arg(appName); QMessageBox::critical(0, QObject::tr("Initialization of %1 failed").arg(appName), msg); @@ -288,7 +288,7 @@ int main( int argc, char ** argv ) // Now it's time to read-in the file branding.xml if it exists Branding brand; QString path = QString::fromUtf8(App::GetApplication().GetHomePath()); - QFileInfo fi(path, QString::fromAscii("branding.xml")); + QFileInfo fi(path, QString::fromLatin1("branding.xml")); if (brand.readFile(fi.absoluteFilePath())) { Branding::XmlConfig cfg = brand.getUserDefines(); for (Branding::XmlConfig::iterator it = cfg.begin(); it != cfg.end(); ++it) { diff --git a/src/Mod/Part/Gui/CMakeLists.txt b/src/Mod/Part/Gui/CMakeLists.txt index 245e005d8ead..1bbd1287b361 100644 --- a/src/Mod/Part/Gui/CMakeLists.txt +++ b/src/Mod/Part/Gui/CMakeLists.txt @@ -48,10 +48,16 @@ set(PartGui_MOC_HDRS TaskDimension.h TaskCheckGeometry.h ) -fc_wrap_cpp(PartGui_MOC_SRCS ${PartGui_MOC_HDRS}) -SOURCE_GROUP("Moc" FILES ${PartGui_MOC_SRCS}) -qt4_add_resources(PartGui_QRC_SRCS Resources/Part.qrc) +if(FREECAD_USE_QT5) + fc_qt5_wrap_cpp(PartGui_MOC_SRCS ${PartGui_MOC_HDRS}) + qt5_add_resources(PartGui_QRC_SRCS Resources/Part.qrc) +else(FREECAD_USE_QT5) + fc_wrap_cpp(PartGui_MOC_SRCS ${PartGui_MOC_HDRS}) + qt4_add_resources(PartGui_QRC_SRCS Resources/Part.qrc) +endif(FREECAD_USE_QT5) + +SOURCE_GROUP("Moc" FILES ${PartGui_MOC_SRCS}) set(PartGui_UIC_SRCS CrossSections.ui @@ -75,7 +81,11 @@ set(PartGui_UIC_SRCS TaskOffset.ui TaskSweep.ui ) -qt4_wrap_ui(PartGui_UIC_HDRS ${PartGui_UIC_SRCS}) +if(FREECAD_USE_QT5) + qt5_wrap_ui(PartGui_UIC_HDRS ${PartGui_UIC_SRCS}) +else(FREECAD_USE_QT5) + qt4_wrap_ui(PartGui_UIC_HDRS ${PartGui_UIC_SRCS}) +endif(FREECAD_USE_QT5) SET(PartGui_SRCS ${PartGui_QRC_SRCS} diff --git a/src/Mod/Part/Gui/Command.cpp b/src/Mod/Part/Gui/Command.cpp index 1e47742d36d9..6cc44890e04c 100644 --- a/src/Mod/Part/Gui/Command.cpp +++ b/src/Mod/Part/Gui/Command.cpp @@ -556,11 +556,11 @@ CmdPartImport::CmdPartImport() void CmdPartImport::activated(int iMsg) { QStringList filter; - filter << QString::fromAscii("STEP (*.stp *.step)"); - filter << QString::fromAscii("STEP with colors (*.stp *.step)"); - filter << QString::fromAscii("IGES (*.igs *.iges)"); - filter << QString::fromAscii("IGES with colors (*.igs *.iges)"); - filter << QString::fromAscii("BREP (*.brp *.brep)"); + filter << QString::fromLatin1("STEP (*.stp *.step)"); + filter << QString::fromLatin1("STEP with colors (*.stp *.step)"); + filter << QString::fromLatin1("IGES (*.igs *.iges)"); + filter << QString::fromLatin1("IGES with colors (*.igs *.iges)"); + filter << QString::fromLatin1("BREP (*.brp *.brep)"); QString select; QString fn = Gui::FileDialog::getOpenFileName(Gui::getMainWindow(), QString(), QString(), filter.join(QLatin1String(";;")), &select); @@ -615,11 +615,11 @@ CmdPartExport::CmdPartExport() void CmdPartExport::activated(int iMsg) { QStringList filter; - filter << QString::fromAscii("STEP (*.stp *.step)"); - filter << QString::fromAscii("STEP with colors (*.stp *.step)"); - filter << QString::fromAscii("IGES (*.igs *.iges)"); - filter << QString::fromAscii("IGES with colors (*.igs *.iges)"); - filter << QString::fromAscii("BREP (*.brp *.brep)"); + filter << QString::fromLatin1("STEP (*.stp *.step)"); + filter << QString::fromLatin1("STEP with colors (*.stp *.step)"); + filter << QString::fromLatin1("IGES (*.igs *.iges)"); + filter << QString::fromLatin1("IGES with colors (*.igs *.iges)"); + filter << QString::fromLatin1("BREP (*.brp *.brep)"); QString select; QString fn = Gui::FileDialog::getSaveFileName(Gui::getMainWindow(), QString(), QString(), filter.join(QLatin1String(";;")), &select); @@ -671,8 +671,8 @@ void CmdPartImportCurveNet::activated(int iMsg) if (!fn.isEmpty()) { QFileInfo fi; fi.setFile(fn); openCommand("Part Import Curve Net"); - doCommand(Doc,"f = App.activeDocument().addObject(\"Part::CurveNet\",\"%s\")", (const char*)fi.baseName().toAscii()); - doCommand(Doc,"f.FileName = \"%s\"",(const char*)fn.toAscii()); + doCommand(Doc,"f = App.activeDocument().addObject(\"Part::CurveNet\",\"%s\")", (const char*)fi.baseName().toLatin1()); + doCommand(Doc,"f.FileName = \"%s\"",(const char*)fn.toLatin1()); commitCommand(); updateActive(); } @@ -717,7 +717,7 @@ void CmdPartMakeSolid::activated(int iMsg) (*it)->Label.getValue()); } else if (type == TopAbs_COMPOUND || type == TopAbs_COMPSOLID) { - str = QString::fromAscii( + str = QString::fromLatin1( "__s__=App.ActiveDocument.%1.Shape.Faces\n" "__s__=Part.Solid(Part.Shell(__s__))\n" "__o__=App.ActiveDocument.addObject(\"Part::Feature\",\"%1_solid\")\n" @@ -729,7 +729,7 @@ void CmdPartMakeSolid::activated(int iMsg) .arg(QLatin1String((*it)->Label.getValue())); } else if (type == TopAbs_SHELL) { - str = QString::fromAscii( + str = QString::fromLatin1( "__s__=App.ActiveDocument.%1.Shape\n" "__s__=Part.Solid(__s__)\n" "__o__=App.ActiveDocument.addObject(\"Part::Feature\",\"%1_solid\")\n" @@ -747,7 +747,7 @@ void CmdPartMakeSolid::activated(int iMsg) try { if (!str.isEmpty()) - doCommand(Doc, (const char*)str.toAscii()); + doCommand(Doc, (const char*)str.toLatin1()); } catch (const Base::Exception& e) { Base::Console().Error("Cannot convert %s because %s.\n", @@ -788,7 +788,7 @@ void CmdPartReverseShape::activated(int iMsg) for (std::vector::iterator it = objs.begin(); it != objs.end(); ++it) { const TopoDS_Shape& shape = static_cast(*it)->Shape.getValue(); if (!shape.IsNull()) { - QString str = QString::fromAscii( + QString str = QString::fromLatin1( "__s__=App.ActiveDocument.%1.Shape.copy()\n" "__s__.reverse()\n" "__o__=App.ActiveDocument.addObject(\"Part::Feature\",\"%1_rev\")\n" @@ -801,7 +801,7 @@ void CmdPartReverseShape::activated(int iMsg) try { if (!str.isEmpty()) - doCommand(Doc, (const char*)str.toAscii()); + doCommand(Doc, (const char*)str.toLatin1()); } catch (const Base::Exception& e) { Base::Console().Error("Cannot convert %s because %s.\n", diff --git a/src/Mod/Part/Gui/CrossSections.cpp b/src/Mod/Part/Gui/CrossSections.cpp index 69ca7c93e72b..6dfff281c904 100644 --- a/src/Mod/Part/Gui/CrossSections.cpp +++ b/src/Mod/Part/Gui/CrossSections.cpp @@ -118,7 +118,7 @@ class ViewProviderCrossSections : public Gui::ViewProvider }; } -CrossSections::CrossSections(const Base::BoundBox3d& bb, QWidget* parent, Qt::WFlags fl) +CrossSections::CrossSections(const Base::BoundBox3d& bb, QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl), bbox(bb) { ui = new Ui_CrossSections(); @@ -236,28 +236,28 @@ void CrossSections::apply() App::Document* doc = (*it)->getDocument(); std::string s = (*it)->getNameInDocument(); s += "_cs"; - app->runPythonCode(QString::fromAscii( + app->runPythonCode(QString::fromLatin1( "wires=list()\n" "shape=FreeCAD.getDocument(\"%1\").%2.Shape\n") .arg(QLatin1String(doc->getName())) - .arg(QLatin1String((*it)->getNameInDocument())).toAscii()); + .arg(QLatin1String((*it)->getNameInDocument())).toLatin1()); for (std::vector::iterator jt = d.begin(); jt != d.end(); ++jt) { - app->runPythonCode(QString::fromAscii( + app->runPythonCode(QString::fromLatin1( "for i in shape.slice(Base.Vector(%1,%2,%3),%4):\n" " wires.append(i)\n" - ).arg(a).arg(b).arg(c).arg(*jt).toAscii()); + ).arg(a).arg(b).arg(c).arg(*jt).toLatin1()); seq.next(); } - app->runPythonCode(QString::fromAscii( + app->runPythonCode(QString::fromLatin1( "comp=Part.Compound(wires)\n" "slice=FreeCAD.getDocument(\"%1\").addObject(\"Part::Feature\",\"%2\")\n" "slice.Shape=comp\n" "slice.purgeTouched()\n" "del slice,comp,wires,shape") .arg(QLatin1String(doc->getName())) - .arg(QLatin1String(s.c_str())).toAscii()); + .arg(QLatin1String(s.c_str())).toLatin1()); seq.next(); } diff --git a/src/Mod/Part/Gui/CrossSections.h b/src/Mod/Part/Gui/CrossSections.h index b0879b20fae7..379d1981d594 100644 --- a/src/Mod/Part/Gui/CrossSections.h +++ b/src/Mod/Part/Gui/CrossSections.h @@ -44,7 +44,7 @@ class CrossSections : public QDialog enum Plane { XY, XZ, YZ }; public: - CrossSections(const Base::BoundBox3d& bb, QWidget* parent = 0, Qt::WFlags fl = 0); + CrossSections(const Base::BoundBox3d& bb, QWidget* parent = 0, Qt::WindowFlags fl = 0); ~CrossSections(); void accept(); void apply(); diff --git a/src/Mod/Part/Gui/DlgBooleanOperation.cpp b/src/Mod/Part/Gui/DlgBooleanOperation.cpp index a85ddffa86e1..e9009c0d3c37 100644 --- a/src/Mod/Part/Gui/DlgBooleanOperation.cpp +++ b/src/Mod/Part/Gui/DlgBooleanOperation.cpp @@ -133,7 +133,7 @@ void DlgBooleanOperation::slotChangedObject(const App::DocumentObject& obj, if (!shape.IsNull()) { Gui::Document* activeGui = Gui::Application::Instance->getDocument(obj.getDocument()); QString label = QString::fromUtf8(obj.Label.getValue()); - QString name = QString::fromAscii(obj.getNameInDocument()); + QString name = QString::fromLatin1(obj.getNameInDocument()); QTreeWidgetItem* child = new BooleanOperationItem(); child->setCheckState(0, Qt::Unchecked); @@ -216,7 +216,7 @@ void DlgBooleanOperation::findShapes() const TopoDS_Shape& shape = static_cast(*it)->Shape.getValue(); if (!shape.IsNull()) { QString label = QString::fromUtf8((*it)->Label.getValue()); - QString name = QString::fromAscii((*it)->getNameInDocument()); + QString name = QString::fromLatin1((*it)->getNameInDocument()); QTreeWidgetItem* child = new BooleanOperationItem(); child->setCheckState(0, Qt::Unchecked); diff --git a/src/Mod/Part/Gui/DlgExtrusion.cpp b/src/Mod/Part/Gui/DlgExtrusion.cpp index 4d29526dbae7..c4c23f05ddaa 100644 --- a/src/Mod/Part/Gui/DlgExtrusion.cpp +++ b/src/Mod/Part/Gui/DlgExtrusion.cpp @@ -50,7 +50,7 @@ using namespace PartGui; -DlgExtrusion::DlgExtrusion(QWidget* parent, Qt::WFlags fl) +DlgExtrusion::DlgExtrusion(QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl), ui(new Ui_DlgExtrusion) { ui->setupUi(this); @@ -96,7 +96,7 @@ void DlgExtrusion::findShapes() if (canExtrude(shape)) { QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeWidget); item->setText(0, QString::fromUtf8((*it)->Label.getValue())); - item->setData(0, Qt::UserRole, QString::fromAscii((*it)->getNameInDocument())); + item->setData(0, Qt::UserRole, QString::fromLatin1((*it)->getNameInDocument())); Gui::ViewProvider* vp = activeGui->getViewProvider(*it); if (vp) item->setIcon(0, vp->getIcon()); @@ -161,14 +161,14 @@ void DlgExtrusion::apply() QList items = ui->treeWidget->selectedItems(); for (QList::iterator it = items.begin(); it != items.end(); ++it) { shape = (*it)->data(0, Qt::UserRole).toString(); - type = QString::fromAscii("Part::Extrusion"); + type = QString::fromLatin1("Part::Extrusion"); if (addBaseName) { QString baseName = QString::fromLatin1("Extrude_%1").arg(shape); label = QString::fromLatin1("%1_Extrude").arg((*it)->text(0)); - name = QString::fromAscii(activeDoc->getUniqueObjectName((const char*)baseName.toLatin1()).c_str()); + name = QString::fromLatin1(activeDoc->getUniqueObjectName((const char*)baseName.toLatin1()).c_str()); } else { - name = QString::fromAscii(activeDoc->getUniqueObjectName("Extrude").c_str()); + name = QString::fromLatin1(activeDoc->getUniqueObjectName("Extrude").c_str()); label = name; } @@ -180,7 +180,7 @@ void DlgExtrusion::apply() bool makeSolid = ui->makeSolid->isChecked(); // inspect geometry - App::DocumentObject* obj = activeDoc->getObject((const char*)shape.toAscii()); + App::DocumentObject* obj = activeDoc->getObject((const char*)shape.toLatin1()); if (!obj || !obj->isDerivedFrom(Part::Feature::getClassTypeId())) continue; Part::Feature* fea = static_cast(obj); const TopoDS_Shape& data = fea->Shape.getValue(); @@ -204,7 +204,7 @@ void DlgExtrusion::apply() } } - QString code = QString::fromAscii( + QString code = QString::fromLatin1( "FreeCAD.getDocument(\"%1\").addObject(\"%2\",\"%3\")\n" "FreeCAD.getDocument(\"%1\").%3.Base = FreeCAD.getDocument(\"%1\").%4\n" "FreeCAD.getDocument(\"%1\").%3.Dir = (%5,%6,%7)\n" @@ -212,7 +212,7 @@ void DlgExtrusion::apply() "FreeCAD.getDocument(\"%1\").%3.TaperAngle = (%9)\n" "FreeCADGui.getDocument(\"%1\").%4.Visibility = False\n" "FreeCAD.getDocument(\"%1\").%3.Label = '%10'\n") - .arg(QString::fromAscii(this->document.c_str())) + .arg(QString::fromLatin1(this->document.c_str())) .arg(type).arg(name).arg(shape) .arg(dirX*len) .arg(dirY*len) @@ -220,9 +220,9 @@ void DlgExtrusion::apply() .arg(makeSolid ? QLatin1String("True") : QLatin1String("False")) .arg(angle) .arg(label); - Gui::Application::Instance->runPythonCode((const char*)code.toAscii()); - QByteArray to = name.toAscii(); - QByteArray from = shape.toAscii(); + Gui::Application::Instance->runPythonCode((const char*)code.toLatin1()); + QByteArray to = name.toLatin1(); + QByteArray from = shape.toLatin1(); Gui::Command::copyVisual(to, "ShapeColor", from); Gui::Command::copyVisual(to, "LineColor", from); Gui::Command::copyVisual(to, "PointColor", from); @@ -232,21 +232,21 @@ void DlgExtrusion::apply() try { ui->statusLabel->clear(); activeDoc->recompute(); - ui->statusLabel->setText(QString::fromAscii + ui->statusLabel->setText(QString::fromLatin1 ("%1").arg(tr("Suceeded"))); } catch (const std::exception& e) { - ui->statusLabel->setText(QString::fromAscii + ui->statusLabel->setText(QString::fromLatin1 ("%1").arg(tr("Failed"))); Base::Console().Error("%s\n", e.what()); } catch (const Base::Exception& e) { - ui->statusLabel->setText(QString::fromAscii + ui->statusLabel->setText(QString::fromLatin1 ("%1").arg(tr("Failed"))); Base::Console().Error("%s\n", e.what()); } catch (...) { - ui->statusLabel->setText(QString::fromAscii + ui->statusLabel->setText(QString::fromLatin1 ("%1").arg(tr("Failed"))); Base::Console().Error("General error in extrusion\n"); } diff --git a/src/Mod/Part/Gui/DlgExtrusion.h b/src/Mod/Part/Gui/DlgExtrusion.h index 38423de6dd52..33380d23e38b 100644 --- a/src/Mod/Part/Gui/DlgExtrusion.h +++ b/src/Mod/Part/Gui/DlgExtrusion.h @@ -37,7 +37,7 @@ class DlgExtrusion : public QDialog Q_OBJECT public: - DlgExtrusion(QWidget* parent = 0, Qt::WFlags fl = 0); + DlgExtrusion(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DlgExtrusion(); void accept(); void apply(); diff --git a/src/Mod/Part/Gui/DlgFilletEdges.cpp b/src/Mod/Part/Gui/DlgFilletEdges.cpp index b51655090de9..93cf42a57130 100644 --- a/src/Mod/Part/Gui/DlgFilletEdges.cpp +++ b/src/Mod/Part/Gui/DlgFilletEdges.cpp @@ -105,7 +105,7 @@ void FilletRadiusDelegate::setModelData(QWidget *editor, QAbstractItemModel *mod QDoubleSpinBox *spinBox = static_cast(editor); spinBox->interpretText(); //double value = spinBox->value(); - //QString value = QString::fromAscii("%1").arg(spinBox->value(),0,'f',2); + //QString value = QString::fromLatin1("%1").arg(spinBox->value(),0,'f',2); QString value = QLocale::system().toString(spinBox->value(),'f',2); model->setData(index, value, Qt::EditRole); @@ -191,7 +191,7 @@ namespace PartGui { /* TRANSLATOR PartGui::DlgFilletEdges */ -DlgFilletEdges::DlgFilletEdges(FilletType type, Part::FilletBase* fillet, QWidget* parent, Qt::WFlags fl) +DlgFilletEdges::DlgFilletEdges(FilletType type, Part::FilletBase* fillet, QWidget* parent, Qt::WindowFlags fl) : QWidget(parent, fl), ui(new Ui_DlgFilletEdges()), d(new Private()) { ui->setupUi(this); @@ -233,9 +233,9 @@ DlgFilletEdges::DlgFilletEdges(FilletType type, Part::FilletBase* fillet, QWidge ui->treeView->setModel(model); QHeaderView* header = ui->treeView->header(); - header->setResizeMode(0, QHeaderView::Stretch); + header->setSectionResizeMode(0, QHeaderView::Stretch); header->setDefaultAlignment(Qt::AlignLeft); - header->setMovable(false); + header->setSectionsMovable(false); on_filletType_activated(0); findShapes(); } @@ -264,7 +264,7 @@ void DlgFilletEdges::onSelectionChanged(const Gui::SelectionChanges& msg) std::string docname = doc->getName(); std::string objname = d->object->getNameInDocument(); if (docname==msg.pDocName && objname==msg.pObjectName) { - QString subelement = QString::fromAscii(msg.pSubName); + QString subelement = QString::fromLatin1(msg.pSubName); if (subelement.startsWith(QLatin1String("Edge"))) { onSelectEdge(subelement, msg.Type); } @@ -358,7 +358,7 @@ void DlgFilletEdges::onSelectEdge(const QString& subelement, int type) QAbstractItemModel* model = ui->treeView->model(); for (int i=0; irowCount(); ++i) { int id = model->data(model->index(i,0), Qt::UserRole).toInt(); - QString name = QString::fromAscii("Edge%1").arg(id); + QString name = QString::fromLatin1("Edge%1").arg(id); if (name == subelement) { // ok, check the selected sub-element Qt::CheckState checkState = @@ -390,12 +390,12 @@ void DlgFilletEdges::onSelectEdgesOfFace(const QString& subelement, int type) for(int j = 1; j <= mapOfEdges.Extent(); ++j) { TopoDS_Edge edge = TopoDS::Edge(mapOfEdges.FindKey(j)); int id = d->all_edges.FindIndex(edge); - QString name = QString::fromAscii("Edge%1").arg(id); + QString name = QString::fromLatin1("Edge%1").arg(id); onSelectEdge(name, type); Gui::SelectionChanges::MsgType msgType = Gui::SelectionChanges::MsgType(type); if (msgType == Gui::SelectionChanges::AddSelection) { Gui::Selection().addSelection(d->object->getDocument()->getName(), - d->object->getNameInDocument(), (const char*)name.toAscii()); + d->object->getNameInDocument(), (const char*)name.toLatin1()); } } } @@ -422,7 +422,7 @@ void DlgFilletEdges::onDeleteObject(const App::DocumentObject& obj) on_shapeObject_activated(0); } else { - QString shape = QString::fromAscii(obj.getNameInDocument()); + QString shape = QString::fromLatin1(obj.getNameInDocument()); // start from the second item for (int i=1; ishapeObject->count(); i++) { if (ui->shapeObject->itemData(i).toString() == shape) { @@ -455,7 +455,7 @@ void DlgFilletEdges::toggleCheckState(const QModelIndex& index) return; QVariant check = index.data(Qt::CheckStateRole); int id = index.data(Qt::UserRole).toInt(); - QString name = QString::fromAscii("Edge%1").arg(id); + QString name = QString::fromLatin1("Edge%1").arg(id); Qt::CheckState checkState = static_cast(check.toInt()); bool block = this->blockConnection(false); @@ -465,13 +465,13 @@ void DlgFilletEdges::toggleCheckState(const QModelIndex& index) App::Document* doc = d->object->getDocument(); Gui::Selection().addSelection(doc->getName(), d->object->getNameInDocument(), - (const char*)name.toAscii()); + (const char*)name.toLatin1()); } else { App::Document* doc = d->object->getDocument(); Gui::Selection().rmvSelection(doc->getName(), d->object->getNameInDocument(), - (const char*)name.toAscii()); + (const char*)name.toLatin1()); } this->blockConnection(block); @@ -488,7 +488,7 @@ void DlgFilletEdges::findShapes() int current_index = 0; for (std::vector::iterator it = objs.begin(); it!=objs.end(); ++it, ++index) { ui->shapeObject->addItem(QString::fromUtf8((*it)->Label.getValue())); - ui->shapeObject->setItemData(index, QString::fromAscii((*it)->getNameInDocument())); + ui->shapeObject->setItemData(index, QString::fromLatin1((*it)->getNameInDocument())); if (current_index == 0) { if (Gui::Selection().isSelected(*it)) { current_index = index; @@ -570,7 +570,7 @@ void DlgFilletEdges::changeEvent(QEvent *e) int id = model->data(model->index(i, 0), Qt::UserRole).toInt(); model->setData(model->index(i, 0), QVariant(tr("Edge%1").arg(id))); } - } + } else { QWidget::changeEvent(e); } @@ -750,22 +750,22 @@ bool DlgFilletEdges::accept() std::string fillet = getFilletType(); int index = ui->shapeObject->currentIndex(); shape = ui->shapeObject->itemData(index).toString(); - type = QString::fromAscii("Part::%1").arg(QString::fromAscii(fillet.c_str())); + type = QString::fromLatin1("Part::%1").arg(QString::fromLatin1(fillet.c_str())); if (d->fillet) - name = QString::fromAscii(d->fillet->getNameInDocument()); + name = QString::fromLatin1(d->fillet->getNameInDocument()); else - name = QString::fromAscii(activeDoc->getUniqueObjectName(fillet.c_str()).c_str()); + name = QString::fromLatin1(activeDoc->getUniqueObjectName(fillet.c_str()).c_str()); activeDoc->openTransaction(fillet.c_str()); QString code; if (!d->fillet) { - code = QString::fromAscii( + code = QString::fromLatin1( "FreeCAD.ActiveDocument.addObject(\"%1\",\"%2\")\n" "FreeCAD.ActiveDocument.%2.Base = FreeCAD.ActiveDocument.%3\n") .arg(type).arg(name).arg(shape); } - code += QString::fromAscii("__fillets__ = []\n"); + code += QString::fromLatin1("__fillets__ = []\n"); for (int i=0; irowCount(); ++i) { QVariant value = model->index(i,0).data(Qt::CheckStateRole); Qt::CheckState checkState = static_cast(value.toInt()); @@ -778,7 +778,7 @@ bool DlgFilletEdges::accept() double r2 = r1; if (end_radius) r2 = model->index(i,2).data().toDouble(); - code += QString::fromAscii( + code += QString::fromLatin1( "__fillets__.append((%1,%2,%3))\n") .arg(id).arg(r1,0,'f',2).arg(r2,0,'f',2); todo = true; @@ -793,12 +793,12 @@ bool DlgFilletEdges::accept() } Gui::WaitCursor wc; - code += QString::fromAscii( + code += QString::fromLatin1( "FreeCAD.ActiveDocument.%1.Edges = __fillets__\n" "del __fillets__\n" "FreeCADGui.ActiveDocument.%2.Visibility = False\n") .arg(name).arg(shape); - Gui::Application::Instance->runPythonCode((const char*)code.toAscii()); + Gui::Application::Instance->runPythonCode((const char*)code.toLatin1()); activeDoc->commitTransaction(); activeDoc->recompute(); if (d->fillet) { @@ -807,8 +807,8 @@ bool DlgFilletEdges::accept() if (vp) vp->show(); } - QByteArray to = name.toAscii(); - QByteArray from = shape.toAscii(); + QByteArray to = name.toLatin1(); + QByteArray from = shape.toLatin1(); Gui::Command::copyVisual(to, "LineColor", from); Gui::Command::copyVisual(to, "PointColor", from); return true; @@ -816,7 +816,7 @@ bool DlgFilletEdges::accept() // --------------------------------------- -FilletEdgesDialog::FilletEdgesDialog(DlgFilletEdges::FilletType type, Part::FilletBase* fillet, QWidget* parent, Qt::WFlags fl) +FilletEdgesDialog::FilletEdgesDialog(DlgFilletEdges::FilletType type, Part::FilletBase* fillet, QWidget* parent, Qt::WindowFlags fl) : QDialog(parent, fl) { widget = new DlgFilletEdges(type, fillet, this); @@ -886,7 +886,7 @@ bool TaskFilletEdges::reject() /* TRANSLATOR PartGui::DlgChamferEdges */ -DlgChamferEdges::DlgChamferEdges(Part::FilletBase* chamfer, QWidget* parent, Qt::WFlags fl) +DlgChamferEdges::DlgChamferEdges(Part::FilletBase* chamfer, QWidget* parent, Qt::WindowFlags fl) : DlgFilletEdges(DlgFilletEdges::CHAMFER, chamfer, parent, fl) { this->setWindowTitle(tr("Chamfer Edges")); diff --git a/src/Mod/Part/Gui/DlgFilletEdges.h b/src/Mod/Part/Gui/DlgFilletEdges.h index ac376dcd6e59..db1fc75ea8a7 100644 --- a/src/Mod/Part/Gui/DlgFilletEdges.h +++ b/src/Mod/Part/Gui/DlgFilletEdges.h @@ -28,6 +28,7 @@ #include #include #include +#include namespace Part { class FilletBase; @@ -77,7 +78,7 @@ class DlgFilletEdges : public QWidget, public Gui::SelectionObserver public: enum FilletType { FILLET, CHAMFER }; - DlgFilletEdges(FilletType type, Part::FilletBase*, QWidget* parent = 0, Qt::WFlags fl = 0); + DlgFilletEdges(FilletType type, Part::FilletBase*, QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DlgFilletEdges(); bool accept(); @@ -88,11 +89,11 @@ class DlgFilletEdges : public QWidget, public Gui::SelectionObserver virtual const char* getFilletType() const; private: - void onSelectionChanged(const Gui::SelectionChanges& msg); - void onDeleteObject(const App::DocumentObject&); - void onDeleteDocument(const App::Document&); - void onSelectEdge(const QString& subelement, int type); - void onSelectEdgesOfFace(const QString& subelement, int type); + void onSelectionChanged(const Gui::SelectionChanges& msg); + void onDeleteObject(const App::DocumentObject&); + void onDeleteDocument(const App::Document&); + void onSelectEdge(const QString& subelement, int type); + void onSelectEdgesOfFace(const QString& subelement, int type); private Q_SLOTS: void on_shapeObject_activated(int); @@ -117,7 +118,7 @@ class FilletEdgesDialog : public QDialog Q_OBJECT public: - FilletEdgesDialog(DlgFilletEdges::FilletType type, Part::FilletBase* fillet, QWidget* parent = 0, Qt::WFlags fl = 0); + FilletEdgesDialog(DlgFilletEdges::FilletType type, Part::FilletBase* fillet, QWidget* parent = 0, Qt::WindowFlags fl = 0); ~FilletEdgesDialog(); void accept(); @@ -130,7 +131,7 @@ class DlgChamferEdges : public DlgFilletEdges Q_OBJECT public: - DlgChamferEdges(Part::FilletBase*, QWidget* parent = 0, Qt::WFlags fl = 0); + DlgChamferEdges(Part::FilletBase*, QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DlgChamferEdges(); protected: diff --git a/src/Mod/Part/Gui/DlgPartBoxImp.cpp b/src/Mod/Part/Gui/DlgPartBoxImp.cpp index b5816aec4759..6716d75ba9b4 100644 --- a/src/Mod/Part/Gui/DlgPartBoxImp.cpp +++ b/src/Mod/Part/Gui/DlgPartBoxImp.cpp @@ -36,7 +36,7 @@ using namespace PartGui; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgPartBoxImp::DlgPartBoxImp(QWidget* parent, Qt::WFlags fl) +DlgPartBoxImp::DlgPartBoxImp(QWidget* parent, Qt::WindowFlags fl) : Gui::LocationInterface(parent, fl) { } diff --git a/src/Mod/Part/Gui/DlgPartBoxImp.h b/src/Mod/Part/Gui/DlgPartBoxImp.h index 824c514b6059..8cad6abcd096 100644 --- a/src/Mod/Part/Gui/DlgPartBoxImp.h +++ b/src/Mod/Part/Gui/DlgPartBoxImp.h @@ -33,7 +33,7 @@ class DlgPartBoxImp : public Gui::LocationInterface Q_OBJECT public: - DlgPartBoxImp(QWidget* parent = 0, Qt::WFlags fl = 0); + DlgPartBoxImp(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DlgPartBoxImp(); }; diff --git a/src/Mod/Part/Gui/DlgPartCylinderImp.cpp b/src/Mod/Part/Gui/DlgPartCylinderImp.cpp index 94cae59cdb96..bb02dbedb574 100644 --- a/src/Mod/Part/Gui/DlgPartCylinderImp.cpp +++ b/src/Mod/Part/Gui/DlgPartCylinderImp.cpp @@ -36,7 +36,7 @@ using namespace PartGui; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgPartCylinderImp::DlgPartCylinderImp(QWidget* parent, Qt::WFlags fl) +DlgPartCylinderImp::DlgPartCylinderImp(QWidget* parent, Qt::WindowFlags fl) : Gui::LocationInterface(parent, fl) { } diff --git a/src/Mod/Part/Gui/DlgPartCylinderImp.h b/src/Mod/Part/Gui/DlgPartCylinderImp.h index 44cc5db345c4..8cf46ece9787 100644 --- a/src/Mod/Part/Gui/DlgPartCylinderImp.h +++ b/src/Mod/Part/Gui/DlgPartCylinderImp.h @@ -33,7 +33,7 @@ class DlgPartCylinderImp : public Gui::LocationInterface Q_OBJECT public: - DlgPartCylinderImp(QWidget* parent = 0, Qt::WFlags fl = 0); + DlgPartCylinderImp(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DlgPartCylinderImp(); }; diff --git a/src/Mod/Part/Gui/DlgPartImportIgesImp.cpp b/src/Mod/Part/Gui/DlgPartImportIgesImp.cpp index 855b847b3036..c1525fc06ac6 100644 --- a/src/Mod/Part/Gui/DlgPartImportIgesImp.cpp +++ b/src/Mod/Part/Gui/DlgPartImportIgesImp.cpp @@ -42,7 +42,7 @@ using namespace PartGui; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgPartImportIgesImp::DlgPartImportIgesImp( QWidget* parent, Qt::WFlags fl ) +DlgPartImportIgesImp::DlgPartImportIgesImp( QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl ) { this->setupUi(this); diff --git a/src/Mod/Part/Gui/DlgPartImportIgesImp.h b/src/Mod/Part/Gui/DlgPartImportIgesImp.h index 8ffb5e096cfa..87d934130805 100644 --- a/src/Mod/Part/Gui/DlgPartImportIgesImp.h +++ b/src/Mod/Part/Gui/DlgPartImportIgesImp.h @@ -33,7 +33,7 @@ class DlgPartImportIgesImp : public QDialog, public Ui_DlgPartImportIges Q_OBJECT public: - DlgPartImportIgesImp( QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgPartImportIgesImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~DlgPartImportIgesImp(); public Q_SLOTS: diff --git a/src/Mod/Part/Gui/DlgPartImportStepImp.cpp b/src/Mod/Part/Gui/DlgPartImportStepImp.cpp index 48cab445e466..65c0a471fdab 100644 --- a/src/Mod/Part/Gui/DlgPartImportStepImp.cpp +++ b/src/Mod/Part/Gui/DlgPartImportStepImp.cpp @@ -41,7 +41,7 @@ using namespace PartGui; * The dialog will by default be modeless, unless you set 'modal' to * TRUE to construct a modal dialog. */ -DlgPartImportStepImp::DlgPartImportStepImp( QWidget* parent, Qt::WFlags fl ) +DlgPartImportStepImp::DlgPartImportStepImp( QWidget* parent, Qt::WindowFlags fl ) : QDialog( parent, fl ) { this->setupUi(this); diff --git a/src/Mod/Part/Gui/DlgPartImportStepImp.h b/src/Mod/Part/Gui/DlgPartImportStepImp.h index 188ab09078f0..142d4f5a0cb6 100644 --- a/src/Mod/Part/Gui/DlgPartImportStepImp.h +++ b/src/Mod/Part/Gui/DlgPartImportStepImp.h @@ -33,7 +33,7 @@ class DlgPartImportStepImp : public QDialog, public Ui_DlgPartImportStep Q_OBJECT public: - DlgPartImportStepImp( QWidget* parent = 0, Qt::WFlags fl = 0 ); + DlgPartImportStepImp( QWidget* parent = 0, Qt::WindowFlags fl = 0 ); ~DlgPartImportStepImp(); public Q_SLOTS: diff --git a/src/Mod/Part/Gui/DlgPrimitives.cpp b/src/Mod/Part/Gui/DlgPrimitives.cpp index fdfdc33ac6a5..f71e2ac2af4f 100644 --- a/src/Mod/Part/Gui/DlgPrimitives.cpp +++ b/src/Mod/Part/Gui/DlgPrimitives.cpp @@ -102,7 +102,7 @@ void Picker::createPrimitive(QWidget* widget, const QString& descr, Gui::Documen // Execute the Python block doc->openCommand(descr.toUtf8()); - Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toAscii()); + Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toLatin1()); doc->commitCommand(); Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()"); Gui::Command::doCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); @@ -129,7 +129,7 @@ QString Picker::toPlacement(const gp_Ax2& axis) const Base::Rotation rot(Base::convertTo(theAxis), theAngle); gp_Pnt loc = axis.Location(); - return QString::fromAscii("Base.Placement(Base.Vector(%1,%2,%3),Base.Rotation(%4,%5,%6,%7))") + return QString::fromLatin1("Base.Placement(Base.Vector(%1,%2,%3),Base.Rotation(%4,%5,%6,%7))") .arg(loc.X(),0,'f',2) .arg(loc.Y(),0,'f',2) .arg(loc.Z(),0,'f',2) @@ -159,8 +159,8 @@ class CircleFromThreePoints : public Picker Handle_Geom_TrimmedCurve trim = arc.Value(); Handle_Geom_Circle circle = Handle_Geom_Circle::DownCast(trim->BasisCurve()); - QString name = QString::fromAscii(doc->getUniqueObjectName("Circle").c_str()); - return QString::fromAscii( + QString name = QString::fromLatin1(doc->getUniqueObjectName("Circle").c_str()); + return QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Circle\",\"%1\")\n" "App.ActiveDocument.%1.Radius=%2\n" "App.ActiveDocument.%1.Angle0=%3\n" @@ -348,8 +348,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) return; } if (ui.comboBox1->currentIndex() == 0) { // plane - name = QString::fromAscii(doc->getUniqueObjectName("Plane").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Plane").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Plane\",\"%1\")\n" "App.ActiveDocument.%1.Length=%2\n" "App.ActiveDocument.%1.Width=%3\n" @@ -362,8 +362,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Plane")); } else if (ui.comboBox1->currentIndex() == 1) { // box - name = QString::fromAscii(doc->getUniqueObjectName("Box").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Box").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Box\",\"%1\")\n" "App.ActiveDocument.%1.Length=%2\n" "App.ActiveDocument.%1.Width=%3\n" @@ -378,8 +378,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Box")); } else if (ui.comboBox1->currentIndex() == 2) { // cylinder - name = QString::fromAscii(doc->getUniqueObjectName("Cylinder").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Cylinder").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Cylinder\",\"%1\")\n" "App.ActiveDocument.%1.Radius=%2\n" "App.ActiveDocument.%1.Height=%3\n" @@ -394,8 +394,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Cylinder")); } else if (ui.comboBox1->currentIndex() == 3) { // cone - name = QString::fromAscii(doc->getUniqueObjectName("Cone").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Cone").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Cone\",\"%1\")\n" "App.ActiveDocument.%1.Radius1=%2\n" "App.ActiveDocument.%1.Radius2=%3\n" @@ -412,8 +412,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Cone")); } else if (ui.comboBox1->currentIndex() == 4) { // sphere - name = QString::fromAscii(doc->getUniqueObjectName("Sphere").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Sphere").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Sphere\",\"%1\")\n" "App.ActiveDocument.%1.Radius=%2\n" "App.ActiveDocument.%1.Angle1=%3\n" @@ -430,8 +430,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Sphere")); } else if (ui.comboBox1->currentIndex() == 5) { // ellipsoid - name = QString::fromAscii(doc->getUniqueObjectName("Ellipsoid").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Ellipsoid").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Ellipsoid\",\"%1\")\n" "App.ActiveDocument.%1.Radius1=%2\n" "App.ActiveDocument.%1.Radius2=%3\n" @@ -450,8 +450,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Ellipsoid")); } else if (ui.comboBox1->currentIndex() == 6) { // torus - name = QString::fromAscii(doc->getUniqueObjectName("Torus").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Torus").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Torus\",\"%1\")\n" "App.ActiveDocument.%1.Radius1=%2\n" "App.ActiveDocument.%1.Radius2=%3\n" @@ -470,8 +470,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Torus")); } else if (ui.comboBox1->currentIndex() == 7) { // prism - name = QString::fromAscii(doc->getUniqueObjectName("Prism").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Prism").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Prism\",\"%1\")\n" "App.ActiveDocument.%1.Polygon=%2\n" "App.ActiveDocument.%1.Circumradius=%3\n" @@ -486,8 +486,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Prism")); } else if (ui.comboBox1->currentIndex() == 8) { // wedge - name = QString::fromAscii(doc->getUniqueObjectName("Wedge").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Wedge").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Wedge\",\"%1\")\n" "App.ActiveDocument.%1.Xmin=%2\n" "App.ActiveDocument.%1.Ymin=%3\n" @@ -516,8 +516,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Wedge")); } else if (ui.comboBox1->currentIndex() == 9) { // helix - name = QString::fromAscii(doc->getUniqueObjectName("Helix").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Helix").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Helix\",\"%1\")\n" "App.ActiveDocument.%1.Pitch=%2\n" "App.ActiveDocument.%1.Height=%3\n" @@ -537,8 +537,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Helix")); } else if (ui.comboBox1->currentIndex() == 10) { // spiral - name = QString::fromAscii(doc->getUniqueObjectName("Spiral").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Spiral").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Spiral\",\"%1\")\n" "App.ActiveDocument.%1.Growth=%2\n" "App.ActiveDocument.%1.Rotations=%3\n" @@ -553,8 +553,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Spiral")); } else if (ui.comboBox1->currentIndex() == 11) { // circle - name = QString::fromAscii(doc->getUniqueObjectName("Circle").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Circle").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Circle\",\"%1\")\n" "App.ActiveDocument.%1.Radius=%2\n" "App.ActiveDocument.%1.Angle0=%3\n" @@ -569,8 +569,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Circle")); } else if (ui.comboBox1->currentIndex() == 12) { // ellipse - name = QString::fromAscii(doc->getUniqueObjectName("Ellipse").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Ellipse").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Ellipse\",\"%1\")\n" "App.ActiveDocument.%1.MajorRadius=%2\n" "App.ActiveDocument.%1.MinorRadius=%3\n" @@ -587,8 +587,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Ellipse")); } else if (ui.comboBox1->currentIndex() == 13) { // vertex - name = QString::fromAscii(doc->getUniqueObjectName("Vertex").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Vertex").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Vertex\",\"%1\")\n" "App.ActiveDocument.%1.X=%2\n" "App.ActiveDocument.%1.Y=%3\n" @@ -603,8 +603,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Vertex")); } else if (ui.comboBox1->currentIndex() == 14) { // line - name = QString::fromAscii(doc->getUniqueObjectName("Line").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("Line").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::Line\",\"%1\")\n" "App.ActiveDocument.%1.X1=%2\n" "App.ActiveDocument.%1.Y1=%3\n" @@ -625,8 +625,8 @@ void DlgPrimitives::createPrimitive(const QString& placement) .arg(tr("Line")); } else if (ui.comboBox1->currentIndex() == 15) { // RegularPolygon - name = QString::fromAscii(doc->getUniqueObjectName("RegularPolygon").c_str()); - cmd = QString::fromAscii( + name = QString::fromLatin1(doc->getUniqueObjectName("RegularPolygon").c_str()); + cmd = QString::fromLatin1( "App.ActiveDocument.addObject(\"Part::RegularPolygon\",\"%1\")\n" "App.ActiveDocument.%1.Polygon=%2\n" "App.ActiveDocument.%1.Circumradius=%3\n" @@ -642,7 +642,7 @@ void DlgPrimitives::createPrimitive(const QString& placement) // Execute the Python block QString prim = tr("Create %1").arg(ui.comboBox1->currentText()); Gui::Application::Instance->activeDocument()->openCommand(prim.toUtf8()); - Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toAscii()); + Gui::Command::doCommand(Gui::Command::Doc, (const char*)cmd.toLatin1()); Gui::Application::Instance->activeDocument()->commitCommand(); Gui::Command::doCommand(Gui::Command::Doc, "App.ActiveDocument.recompute()"); Gui::Command::doCommand(Gui::Command::Gui, "Gui.SendMsgToActiveView(\"ViewFit\")"); @@ -783,7 +783,7 @@ QString Location::toPlacement() const Base::Rotation rot(Base::convertTo(theAxis), theAngle); Base::Vector3d loc = ui.loc->getPosition(); - return QString::fromAscii("Base.Placement(Base.Vector(%1,%2,%3),Base.Rotation(%4,%5,%6,%7))") + return QString::fromLatin1("Base.Placement(Base.Vector(%1,%2,%3),Base.Rotation(%4,%5,%6,%7))") .arg(loc.x,0,'f',2) .arg(loc.y,0,'f',2) .arg(loc.z,0,'f',2) diff --git a/src/Mod/Part/Gui/DlgRevolution.cpp b/src/Mod/Part/Gui/DlgRevolution.cpp index 221fdcb60beb..b5f6ee8bab02 100644 --- a/src/Mod/Part/Gui/DlgRevolution.cpp +++ b/src/Mod/Part/Gui/DlgRevolution.cpp @@ -93,7 +93,7 @@ class DlgRevolution::EdgeSelection : public Gui::SelectionFilterGate } }; -DlgRevolution::DlgRevolution(QWidget* parent, Qt::WFlags fl) +DlgRevolution::DlgRevolution(QWidget* parent, Qt::WindowFlags fl) : Gui::LocationDialog(parent, fl), filter(0) { ui = new Ui_RevolutionComp(this); @@ -156,7 +156,7 @@ void DlgRevolution::findShapes() // So allowed are: vertex, edge, wire, face, shell and compound QTreeWidgetItem* item = new QTreeWidgetItem(ui->treeWidget); item->setText(0, QString::fromUtf8((*it)->Label.getValue())); - item->setData(0, Qt::UserRole, QString::fromAscii((*it)->getNameInDocument())); + item->setData(0, Qt::UserRole, QString::fromLatin1((*it)->getNameInDocument())); Gui::ViewProvider* vp = activeGui->getViewProvider(*it); if (vp) item->setIcon(0, vp->getIcon()); } @@ -178,11 +178,11 @@ void DlgRevolution::accept() QList items = ui->treeWidget->selectedItems(); for (QList::iterator it = items.begin(); it != items.end(); ++it) { shape = (*it)->data(0, Qt::UserRole).toString(); - type = QString::fromAscii("Part::Revolution"); - name = QString::fromAscii(activeDoc->getUniqueObjectName("Revolve").c_str()); + type = QString::fromLatin1("Part::Revolution"); + name = QString::fromLatin1(activeDoc->getUniqueObjectName("Revolve").c_str()); Base::Vector3d axis = this->getDirection(); - QString code = QString::fromAscii( + QString code = QString::fromLatin1( "FreeCAD.ActiveDocument.addObject(\"%1\",\"%2\")\n" "FreeCAD.ActiveDocument.%2.Source = FreeCAD.ActiveDocument.%3\n" "FreeCAD.ActiveDocument.%2.Axis = (%4,%5,%6)\n" @@ -197,9 +197,9 @@ void DlgRevolution::accept() .arg(ui->yPos->value(),0,'f',2) .arg(ui->zPos->value(),0,'f',2) .arg(ui->angle->value(),0,'f',2); - Gui::Application::Instance->runPythonCode((const char*)code.toAscii()); - QByteArray to = name.toAscii(); - QByteArray from = shape.toAscii(); + Gui::Application::Instance->runPythonCode((const char*)code.toLatin1()); + QByteArray to = name.toLatin1(); + QByteArray from = shape.toLatin1(); Gui::Command::copyVisual(to, "ShapeColor", from); Gui::Command::copyVisual(to, "LineColor", from); Gui::Command::copyVisual(to, "PointColor", from); diff --git a/src/Mod/Part/Gui/DlgRevolution.h b/src/Mod/Part/Gui/DlgRevolution.h index 7f3d648b838a..f88b35210cca 100644 --- a/src/Mod/Part/Gui/DlgRevolution.h +++ b/src/Mod/Part/Gui/DlgRevolution.h @@ -36,7 +36,7 @@ class DlgRevolution : public Gui::LocationDialog, public Gui::SelectionObserver Q_OBJECT public: - DlgRevolution(QWidget* parent = 0, Qt::WFlags fl = 0); + DlgRevolution(QWidget* parent = 0, Qt::WindowFlags fl = 0); ~DlgRevolution(); void accept(); diff --git a/src/Mod/Part/Gui/Mirroring.cpp b/src/Mod/Part/Gui/Mirroring.cpp index 6847e1e97e6f..09350b633efd 100644 --- a/src/Mod/Part/Gui/Mirroring.cpp +++ b/src/Mod/Part/Gui/Mirroring.cpp @@ -89,7 +89,7 @@ void Mirroring::findShapes() Gui::Document* activeGui = Gui::Application::Instance->getDocument(activeDoc); if (!activeGui) return; - this->document = QString::fromAscii(activeDoc->getName()); + this->document = QString::fromLatin1(activeDoc->getName()); std::vector objs = activeDoc->getObjectsOfType (Part::Feature::getClassTypeId()); @@ -97,7 +97,7 @@ void Mirroring::findShapes() const TopoDS_Shape& shape = static_cast(*it)->Shape.getValue(); if (!shape.IsNull()) { QString label = QString::fromUtf8((*it)->Label.getValue()); - QString name = QString::fromAscii((*it)->getNameInDocument()); + QString name = QString::fromLatin1((*it)->getNameInDocument()); QTreeWidgetItem* child = new QTreeWidgetItem(); child->setText(0, label); @@ -118,7 +118,7 @@ bool Mirroring::accept() return false; } - App::Document* activeDoc = App::GetApplication().getDocument((const char*)this->document.toAscii()); + App::Document* activeDoc = App::GetApplication().getDocument((const char*)this->document.toLatin1()); if (!activeDoc) { QMessageBox::critical(this, windowTitle(), tr("No such document '%1'.").arg(this->document)); @@ -130,7 +130,7 @@ bool Mirroring::accept() activeDoc->openTransaction("Mirroring"); QString shape, label; - QRegExp rx(QString::fromAscii(" \\(Mirror #\\d+\\)$")); + QRegExp rx(QString::fromLatin1(" \\(Mirror #\\d+\\)$")); QList items = ui->shapes->selectedItems(); float normx=0, normy=0, normz=0; int index = ui->comboBox->currentIndex(); @@ -151,9 +151,9 @@ bool Mirroring::accept() int pos = label.indexOf(rx); if (pos > -1) label = label.left(pos); - label.append(QString::fromAscii(" (Mirror #%1)").arg(++count)); + label.append(QString::fromLatin1(" (Mirror #%1)").arg(++count)); - QString code = QString::fromAscii( + QString code = QString::fromLatin1( "__doc__=FreeCAD.getDocument(\"%1\")\n" "__doc__.addObject(\"Part::Mirroring\")\n" "__doc__.ActiveObject.Source=__doc__.getObject(\"%2\")\n" @@ -164,8 +164,8 @@ bool Mirroring::accept() .arg(this->document).arg(shape).arg(label) .arg(normx).arg(normy).arg(normz) .arg(basex).arg(basey).arg(basez); - Gui::Application::Instance->runPythonCode((const char*)code.toAscii()); - QByteArray from = shape.toAscii(); + Gui::Application::Instance->runPythonCode((const char*)code.toLatin1()); + QByteArray from = shape.toLatin1(); Gui::Command::copyVisual("ActiveObject", "ShapeColor", from); Gui::Command::copyVisual("ActiveObject", "LineColor", from); Gui::Command::copyVisual("ActiveObject", "PointColor", from); diff --git a/src/Mod/Part/Gui/TaskCheckGeometry.cpp b/src/Mod/Part/Gui/TaskCheckGeometry.cpp index e7050f991110..585a7e9d3aad 100644 --- a/src/Mod/Part/Gui/TaskCheckGeometry.cpp +++ b/src/Mod/Part/Gui/TaskCheckGeometry.cpp @@ -21,6 +21,10 @@ ***************************************************************************/ #include "PreCompiled.h" + +#include +#include + #include #include #include @@ -475,7 +479,7 @@ void TaskCheckGeometryResults::currentRowChanged (const QModelIndex ¤t, co QString doc, object, sub; if (!this->split((*stringIt), doc, object, sub)) continue; - Gui::Selection().addSelection(doc.toAscii(), object.toAscii(), sub.toAscii()); + Gui::Selection().addSelection(doc.toLatin1(), object.toLatin1(), sub.toLatin1()); } } } @@ -483,7 +487,7 @@ void TaskCheckGeometryResults::currentRowChanged (const QModelIndex ¤t, co bool TaskCheckGeometryResults::split(QString &input, QString &doc, QString &object, QString &sub) { - QStringList strings = input.split(QString::fromAscii(".")); + QStringList strings = input.split(QString::fromLatin1(".")); if (strings.size() != 3) return false; doc = strings.at(0); diff --git a/src/Mod/Part/Gui/TaskDimension.cpp b/src/Mod/Part/Gui/TaskDimension.cpp index edad71c887ea..fa72ff615214 100644 --- a/src/Mod/Part/Gui/TaskDimension.cpp +++ b/src/Mod/Part/Gui/TaskDimension.cpp @@ -24,6 +24,11 @@ #include +#include +#include +#include +#include + #include #include #include diff --git a/src/Mod/Part/Gui/TaskFaceColors.cpp b/src/Mod/Part/Gui/TaskFaceColors.cpp index 88cbbcebcebc..7f33cb81cb45 100644 --- a/src/Mod/Part/Gui/TaskFaceColors.cpp +++ b/src/Mod/Part/Gui/TaskFaceColors.cpp @@ -369,14 +369,14 @@ void FaceColors::onSelectionChanged(const Gui::SelectionChanges& msg) } if (selection_changed) { - QString faces = QString::fromAscii("["); + QString faces = QString::fromLatin1("["); int size = d->index.size(); for (QSet::iterator it = d->index.begin(); it != d->index.end(); ++it) { faces += QString::number(*it + 1); if (--size > 0) - faces += QString::fromAscii(","); + faces += QString::fromLatin1(","); } - faces += QString::fromAscii("]"); + faces += QString::fromLatin1("]"); d->ui->labelElement->setText(faces); d->ui->colorButton->setDisabled(d->index.isEmpty()); } diff --git a/src/Mod/Part/Gui/TaskLoft.cpp b/src/Mod/Part/Gui/TaskLoft.cpp index 6f4b5371e797..e243df4c68b9 100644 --- a/src/Mod/Part/Gui/TaskLoft.cpp +++ b/src/Mod/Part/Gui/TaskLoft.cpp @@ -103,7 +103,7 @@ void LoftWidget::findShapes() shape.ShapeType() == TopAbs_EDGE || shape.ShapeType() == TopAbs_VERTEX) { QString label = QString::fromUtf8((*it)->Label.getValue()); - QString name = QString::fromAscii((*it)->getNameInDocument()); + QString name = QString::fromLatin1((*it)->getNameInDocument()); QTreeWidgetItem* child = new QTreeWidgetItem(); child->setText(0, label); @@ -120,14 +120,14 @@ bool LoftWidget::accept() { QString list, solid, ruled; if (d->ui.checkSolid->isChecked()) - solid = QString::fromAscii("True"); + solid = QString::fromLatin1("True"); else - solid = QString::fromAscii("False"); + solid = QString::fromLatin1("False"); if (d->ui.checkRuledSurface->isChecked()) - ruled = QString::fromAscii("True"); + ruled = QString::fromLatin1("True"); else - ruled = QString::fromAscii("False"); + ruled = QString::fromLatin1("False"); QTextStream str(&list); @@ -144,17 +144,17 @@ bool LoftWidget::accept() try { QString cmd; - cmd = QString::fromAscii( + cmd = QString::fromLatin1( "App.getDocument('%4').addObject('Part::Loft','Loft')\n" "App.getDocument('%4').ActiveObject.Sections=[%1]\n" "App.getDocument('%4').ActiveObject.Solid=%2\n" "App.getDocument('%4').ActiveObject.Ruled=%3\n" - ).arg(list).arg(solid).arg(ruled).arg(QString::fromAscii(d->document.c_str())); + ).arg(list).arg(solid).arg(ruled).arg(QString::fromLatin1(d->document.c_str())); Gui::Document* doc = Gui::Application::Instance->getDocument(d->document.c_str()); if (!doc) throw Base::Exception("Document doesn't exist anymore"); doc->openCommand("Loft"); - Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false); + Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false); doc->getDocument()->recompute(); App::DocumentObject* obj = doc->getDocument()->getActiveObject(); if (obj && !obj->isValid()) { @@ -165,7 +165,7 @@ bool LoftWidget::accept() doc->commitCommand(); } catch (const Base::Exception& e) { - QMessageBox::warning(this, tr("Input error"), QString::fromAscii(e.what())); + QMessageBox::warning(this, tr("Input error"), QString::fromLatin1(e.what())); return false; } diff --git a/src/Mod/Part/Gui/TaskOffset.cpp b/src/Mod/Part/Gui/TaskOffset.cpp index 5da9253032ad..c83abbc9a5f2 100644 --- a/src/Mod/Part/Gui/TaskOffset.cpp +++ b/src/Mod/Part/Gui/TaskOffset.cpp @@ -160,7 +160,7 @@ bool OffsetWidget::accept() Gui::Command::commitCommand(); } catch (const Base::Exception& e) { - QMessageBox::warning(this, tr("Input error"), QString::fromAscii(e.what())); + QMessageBox::warning(this, tr("Input error"), QString::fromLatin1(e.what())); return false; } diff --git a/src/Mod/Part/Gui/TaskShapeBuilder.cpp b/src/Mod/Part/Gui/TaskShapeBuilder.cpp index 1d37534be7bc..7360a844354a 100644 --- a/src/Mod/Part/Gui/TaskShapeBuilder.cpp +++ b/src/Mod/Part/Gui/TaskShapeBuilder.cpp @@ -187,7 +187,7 @@ void ShapeBuilderWidget::createEdge() } QString cmd; - cmd = QString::fromAscii( + cmd = QString::fromLatin1( "_=Part.makeLine(%1, %2)\n" "if _.isNull(): raise Exception('Failed to create edge')\n" "App.ActiveDocument.addObject('Part::Feature','Edge').Shape=_\n" @@ -195,7 +195,7 @@ void ShapeBuilderWidget::createEdge() ).arg(elements[0]).arg(elements[1]); Gui::Application::Instance->activeDocument()->openCommand("Edge"); - Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false); + Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false); Gui::Application::Instance->activeDocument()->commitCommand(); } @@ -224,7 +224,7 @@ void ShapeBuilderWidget::createFace() QString cmd; if (d->ui.checkPlanar->isChecked()) { - cmd = QString::fromAscii( + cmd = QString::fromLatin1( "_=Part.Face(Part.Wire(Part.__sortEdges__(%1)))\n" "if _.isNull(): raise Exception('Failed to create face')\n" "App.ActiveDocument.addObject('Part::Feature','Face').Shape=_\n" @@ -232,7 +232,7 @@ void ShapeBuilderWidget::createFace() ).arg(list); } else { - cmd = QString::fromAscii( + cmd = QString::fromLatin1( "_=Part.makeFilledFace(Part.__sortEdges__(%1))\n" "if _.isNull(): raise Exception('Failed to create face')\n" "App.ActiveDocument.addObject('Part::Feature','Face').Shape=_\n" @@ -241,7 +241,7 @@ void ShapeBuilderWidget::createFace() } Gui::Application::Instance->activeDocument()->openCommand("Face"); - Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false); + Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false); Gui::Application::Instance->activeDocument()->commitCommand(); } @@ -280,7 +280,7 @@ void ShapeBuilderWidget::createShell() } QString cmd; - cmd = QString::fromAscii( + cmd = QString::fromLatin1( "_=Part.Shell(%1)\n" "if _.isNull(): raise Exception('Failed to create shell')\n" "App.ActiveDocument.addObject('Part::Feature','Shell').Shape=_.removeSplitter()\n" @@ -288,7 +288,7 @@ void ShapeBuilderWidget::createShell() ).arg(list); Gui::Application::Instance->activeDocument()->openCommand("Shell"); - Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false); + Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false); Gui::Application::Instance->activeDocument()->commitCommand(); } @@ -312,7 +312,7 @@ void ShapeBuilderWidget::createSolid() } QString cmd; - cmd = QString::fromAscii( + cmd = QString::fromLatin1( "shell=%1\n" "if shell.ShapeType != 'Shell': raise Exception('Part object is not a shell')\n" "_=Part.Solid(shell)\n" @@ -322,7 +322,7 @@ void ShapeBuilderWidget::createSolid() ).arg(line); Gui::Application::Instance->activeDocument()->openCommand("Solid"); - Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false); + Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false); Gui::Application::Instance->activeDocument()->commitCommand(); } diff --git a/src/Mod/Part/Gui/TaskSweep.cpp b/src/Mod/Part/Gui/TaskSweep.cpp index fb1c899abefc..be76fb05f180 100644 --- a/src/Mod/Part/Gui/TaskSweep.cpp +++ b/src/Mod/Part/Gui/TaskSweep.cpp @@ -104,7 +104,7 @@ void SweepWidget::findShapes() shape.ShapeType() == TopAbs_EDGE || shape.ShapeType() == TopAbs_VERTEX) { QString label = QString::fromUtf8((*it)->Label.getValue()); - QString name = QString::fromAscii((*it)->getNameInDocument()); + QString name = QString::fromLatin1((*it)->getNameInDocument()); QTreeWidgetItem* child = new QTreeWidgetItem(); child->setText(0, label); @@ -141,14 +141,14 @@ bool SweepWidget::accept() QString list, solid, frenet; if (d->ui.checkSolid->isChecked()) - solid = QString::fromAscii("True"); + solid = QString::fromLatin1("True"); else - solid = QString::fromAscii("False"); + solid = QString::fromLatin1("False"); if (d->ui.checkFrenet->isChecked()) - frenet = QString::fromAscii("True"); + frenet = QString::fromLatin1("True"); else - frenet = QString::fromAscii("False"); + frenet = QString::fromLatin1("False"); QTextStream str(&list); @@ -165,7 +165,7 @@ bool SweepWidget::accept() try { QString cmd; - cmd = QString::fromAscii( + cmd = QString::fromLatin1( "App.getDocument('%5').addObject('Part::Sweep','Sweep')\n" "App.getDocument('%5').ActiveObject.Sections=[%1]\n" "App.getDocument('%5').ActiveObject.Spine=%2\n" @@ -176,12 +176,12 @@ bool SweepWidget::accept() .arg(QLatin1String(selection.c_str())) .arg(solid) .arg(frenet) - .arg(QString::fromAscii(d->document.c_str())); + .arg(QString::fromLatin1(d->document.c_str())); Gui::Document* doc = Gui::Application::Instance->getDocument(d->document.c_str()); if (!doc) throw Base::Exception("Document doesn't exist anymore"); doc->openCommand("Sweep"); - Gui::Application::Instance->runPythonCode((const char*)cmd.toAscii(), false, false); + Gui::Application::Instance->runPythonCode((const char*)cmd.toLatin1(), false, false); doc->getDocument()->recompute(); App::DocumentObject* obj = doc->getDocument()->getActiveObject(); if (obj && !obj->isValid()) { @@ -192,7 +192,7 @@ bool SweepWidget::accept() doc->commitCommand(); } catch (const Base::Exception& e) { - QMessageBox::warning(this, tr("Input error"), QString::fromAscii(e.what())); + QMessageBox::warning(this, tr("Input error"), QString::fromLatin1(e.what())); return false; } diff --git a/src/Mod/Part/Gui/TaskThickness.cpp b/src/Mod/Part/Gui/TaskThickness.cpp index 5a2370f67a44..380ea3a91c44 100644 --- a/src/Mod/Part/Gui/TaskThickness.cpp +++ b/src/Mod/Part/Gui/TaskThickness.cpp @@ -228,7 +228,7 @@ bool ThicknessWidget::accept() Gui::Command::commitCommand(); } catch (const Base::Exception& e) { - QMessageBox::warning(this, tr("Input error"), QString::fromAscii(e.what())); + QMessageBox::warning(this, tr("Input error"), QString::fromLatin1(e.what())); return false; }