Qt6 port:

* Constructor of QFontDatabase is deprecated, use static functions instead
* Fix QuantitySpinBox::selectNumber()
* Fix InputField::selectNumber()
* Make InputField::fixup() compatible with Qt6
* QFont::setWeight requires an enum now
* QInputEvent reuires a pointing device now
* QAbstractItemView::viewOptions() has been renamed to QAbstractItemView::initViewItemOption()
This commit is contained in:
wmayer
2022-11-03 12:38:11 +01:00
parent 6118dfd7bd
commit abc4e6bf39
9 changed files with 105 additions and 72 deletions

View File

@@ -362,6 +362,26 @@ char* NaviCubeImplementation::enum2str(int e) {
}
}
auto convertWeights = [](int weight) -> QFont::Weight {
if (weight >= 87)
return QFont::Black;
if (weight >= 81)
return QFont::ExtraBold;
if (weight >= 75)
return QFont::Bold;
if (weight >= 63)
return QFont::DemiBold;
if (weight >= 57)
return QFont::Medium;
if (weight >= 50)
return QFont::Normal;
if (weight >= 25)
return QFont::Light;
if (weight >= 12)
return QFont::ExtraLight;
return QFont::Thin;
};
GLuint NaviCubeImplementation::createCubeFaceTex(QtGLWidget* gl, float gap, const char* text, int shape) {
int texSize = m_CubeWidgetSize * m_OverSample;
float gapi = texSize * gap;
@@ -379,7 +399,7 @@ GLuint NaviCubeImplementation::createCubeFaceTex(QtGLWidget* gl, float gap, cons
QString fontString = QString::fromUtf8((hGrp->GetASCII("FontString")).c_str());
if (fontString.isEmpty()) {
// Improving readability
sansFont.setWeight(hGrp->GetInt("FontWeight", 87));
sansFont.setWeight(convertWeights(hGrp->GetInt("FontWeight", 87)));
sansFont.setStretch(hGrp->GetInt("FontStretch", 62));
}
else {
@@ -387,7 +407,7 @@ GLuint NaviCubeImplementation::createCubeFaceTex(QtGLWidget* gl, float gap, cons
}
// Override fromString
if (hGrp->GetInt("FontWeight") > 0) {
sansFont.setWeight(hGrp->GetInt("FontWeight"));
sansFont.setWeight(convertWeights(hGrp->GetInt("FontWeight")));
}
if (hGrp->GetInt("FontStretch") > 0) {
sansFont.setStretch(hGrp->GetInt("FontStretch"));