};
Settings::Settings(DeviceManager &device_manager, QWidget *parent) :
- QDialog(parent, nullptr),
+ QDialog(parent),
device_manager_(device_manager)
{
resize(600, 400);
if (current_style.isEmpty())
style_cb->setCurrentIndex(0);
else
- style_cb->setCurrentIndex(style_cb->findText(current_style, nullptr));
+ style_cb->setCurrentIndex(style_cb->findText(current_style));
connect(style_cb, SIGNAL(currentIndexChanged(int)),
this, SLOT(on_general_style_changed(int)));
char *text = g_strdup_vprintf(format, args);
QString s = QString::fromUtf8(text);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
+ for (QString& substring : s.split("\n", Qt::SkipEmptyParts))
+ logging.log(substring, LogSource_srd);
+#else
for (QString& substring : s.split("\n", QString::SkipEmptyParts))
logging.log(substring, LogSource_srd);
+#endif
g_free(text);
return SR_OK;
Qt::ItemFlags DecoderCollectionModel::flags(const QModelIndex& index) const
{
if (!index.isValid())
- return nullptr;
+ return Qt::NoItemFlags;
return Qt::ItemIsEnabled | Qt::ItemIsSelectable;
}
while (offset < selection.second) {
size_t end = std::min((uint64_t)(selection.second), offset + n);
offset = hex_view_->create_hex_line(offset, end, &s, with_offset, with_ascii);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+ out_stream << s << Qt::endl;
+#else
out_stream << s << endl;
+#endif
}
+#if QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)
+ out_stream << Qt::endl;
+#else
out_stream << endl;
+#endif
if (out_stream.status() != QTextStream::Ok) {
QMessageBox msg(parent_);
root_layout->addWidget(button_box);
// Set tab width to 4 characters
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ expr_edit_->setTabStopDistance(util::text_width(QFontMetrics(font()), "XXXX"));
+#else
expr_edit_->setTabStopWidth(util::text_width(QFontMetrics(font()), "XXXX"));
+#endif
connect(button_box, SIGNAL(accepted()), this, SLOT(accept()));
connect(button_box, SIGNAL(rejected()), this, SLOT(reject()));
{
assert(event);
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
+ int delta = (event->angleDelta().x() != 0) ? event->angleDelta().x() : event->angleDelta().y();
+#else
+ int delta = event->delta();
+#endif
+
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
+ if (event->angleDelta().y() != 0) {
+#else
if (event->orientation() == Qt::Vertical) {
+#endif
if (event->modifiers() & Qt::ControlModifier) {
// Vertical scrolling with the control key pressed
// is intrepretted as vertical scrolling
view_.set_v_offset(-view_.owner_visual_v_offset() -
- (event->delta() * height()) / (8 * 120));
+ (delta * height()) / (8 * 120));
} else {
// Vertical scrolling is interpreted as zooming in/out
- view_.zoom(event->delta() / 120.0, event->x());
+ view_.zoom(delta / 120.0, event->position().x());
}
+#if QT_VERSION >= QT_VERSION_CHECK(5, 12, 0)
+ } else if (event->angleDelta().x() != 0) {
+#else
} else if (event->orientation() == Qt::Horizontal) {
+#endif
// Horizontal scrolling is interpreted as moving left/right
view_.set_scale_offset(view_.scale(),
- event->delta() * view_.scale() + view_.offset());
+ delta * view_.scale() + view_.offset());
}
}
{
QPoint o;
+#if QT_VERSION >= QT_VERSION_CHECK(5, 10, 0)
+ const QRect screen_rect = QApplication::screenAt(point_)->availableGeometry();
+#else
const QRect screen_rect = QApplication::desktop()->availableGeometry(
QApplication::desktop()->screenNumber(point_));
+#endif
if (pos_ == Right || pos_ == Left)
o.ry() = -height() / 2;