Remove old qt code
new round of removal following the report of @benj5378 . .
This commit is contained in:
@@ -146,11 +146,8 @@ FileChooser::FileChooser(QWidget* parent)
|
||||
connect(lineEdit, &QLineEdit::textChanged, this, &FileChooser::fileNameChanged);
|
||||
|
||||
button = new QPushButton("...", this);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
button->setFixedWidth(2 * button->fontMetrics().horizontalAdvance(" ... "));
|
||||
#else
|
||||
button->setFixedWidth(2 * button->fontMetrics().width(" ... "));
|
||||
#endif
|
||||
|
||||
layout->addWidget(button);
|
||||
|
||||
connect(button, &QPushButton::clicked, this, &FileChooser::chooseFile);
|
||||
@@ -220,13 +217,10 @@ void FileChooser::setFilter(const QString& filter)
|
||||
void FileChooser::setButtonText(const QString& txt)
|
||||
{
|
||||
button->setText(txt);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
|
||||
int w1 = 2 * button->fontMetrics().horizontalAdvance(txt);
|
||||
int w2 = 2 * button->fontMetrics().horizontalAdvance(" ... ");
|
||||
#else
|
||||
int w1 = 2 * button->fontMetrics().width(txt);
|
||||
int w2 = 2 * button->fontMetrics().width(" ... ");
|
||||
#endif
|
||||
|
||||
button->setFixedWidth((w1 > w2 ? w1 : w2));
|
||||
}
|
||||
|
||||
@@ -1175,12 +1169,7 @@ QSize QuantitySpinBox::sizeHint() const
|
||||
QString fixedContent = QLatin1String(" ");
|
||||
s += fixedContent;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
w = fm.horizontalAdvance(s);
|
||||
#else
|
||||
w = fm.width(s);
|
||||
#endif
|
||||
|
||||
w += 2; // cursor blinking space
|
||||
w += iconHeight;
|
||||
|
||||
@@ -1205,12 +1194,7 @@ QSize QuantitySpinBox::minimumSizeHint() const
|
||||
QString fixedContent = QLatin1String(" ");
|
||||
s += fixedContent;
|
||||
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(5, 11, 0)
|
||||
w = fm.horizontalAdvance(s);
|
||||
#else
|
||||
w = fm.width(s);
|
||||
#endif
|
||||
|
||||
w += 2; // cursor blinking space
|
||||
w += iconHeight;
|
||||
|
||||
@@ -1246,31 +1230,6 @@ void QuantitySpinBox::closeEvent(QCloseEvent* event)
|
||||
QAbstractSpinBox::closeEvent(event);
|
||||
}
|
||||
|
||||
bool QuantitySpinBox::event(QEvent* event)
|
||||
{
|
||||
// issue #0004059: Tooltips for Gui::QuantitySpinBox not showing
|
||||
// Here we must not try to show the tooltip of the icon label
|
||||
// because it would override a custom tooltip set to this widget.
|
||||
//
|
||||
// We could also check if the text of this tooltip is empty but
|
||||
// it will fail in cases where the widget is embedded into the
|
||||
// property editor and the corresponding item has set a tooltip.
|
||||
// Instead of showing the item's tooltip it will again show the
|
||||
// tooltip of the icon label.
|
||||
#if 0
|
||||
if (event->type() == QEvent::ToolTip) {
|
||||
if (isBound() && getExpression() && lineEdit()->isReadOnly()) {
|
||||
QHelpEvent * helpEvent = static_cast<QHelpEvent*>(event);
|
||||
|
||||
QToolTip::showText( helpEvent->globalPos(), Base::Tools::fromStdString(getExpression()->toString()), this);
|
||||
event->accept();
|
||||
return true;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return QAbstractSpinBox::event(event);
|
||||
}
|
||||
|
||||
void QuantitySpinBox::focusInEvent(QFocusEvent* event)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user