#include <QMessageBox>
#include <QAction>
#include <QTextCodec>
+#include <QWindow>
+#include <QScreen>
#include <sstream>
#include <string>
{
theWidget->setFocus();
// rectangle of focus is not visible on tool button widgets
- theWidget->repaint();
+ theWidget->update();
#ifdef DEBUG_SET_FOCUS
qDebug(QString("setFocus: %1").arg(theInfo).toStdString().c_str());
#endif
void setSpinValue(ModuleBase_ParamSpinBox* theSpin, double theValue)
{
- if (fabs(theSpin->value() - theValue) < tolerance)
+ if (!theSpin->text().isEmpty() && fabs(theSpin->value() - theValue) < tolerance)
return;
bool isBlocked = theSpin->blockSignals(true);
theSpin->setValue(theValue);
if (!ModelAPI_Tools::allDocumentsActivated(aNotActivatedNames)) {
if (ModuleBase_Tools::hasModuleDocumentFeature(theFeatures))
aNotActivatedDocWrn =
- QObject::tr("Selected objects can be used in Part documents which are not loaded:%1.\n")
+ QObject::tr("Selected objects can be used in Part documents which are not loaded: %1.\n")
.arg(aNotActivatedNames.c_str());
}
return true;
}
+qreal currentPixelRatio()
+{
+ QWindowList aWnds = qApp->topLevelWindows();
+ if (aWnds.size() > 0)
+ return aWnds.first()->devicePixelRatio();
+ return qApp->primaryScreen()->devicePixelRatio();
+}
+
} // namespace ModuleBase_Tools