Skip to content

Commit

Permalink
Fix compilation on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
oclero committed May 2, 2024
1 parent ab73a9f commit e5a77a3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/style/EventFilters.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ bool TextEditEventFilter::eventFilter(QObject* watchedObject, QEvent* evt) {
switch (frameShape) {
case QFrame::Shape::StyledPanel: {
QStyleOptionFrame opt;
opt.init(_textEdit);
opt.initFrom(_textEdit);
opt.rect = _textEdit->rect();
QPainter p(_textEdit);
qlementineStyle->drawPrimitive(QStyle::PE_PanelLineEdit, &opt, &p, _textEdit);
Expand Down
10 changes: 10 additions & 0 deletions sandbox/src/SandboxWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1544,9 +1544,15 @@ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deseru
const auto cb = []() {
qDebug() << "Clicked";
};

const auto clickPos = e->pos();
const auto clickPosStr = QString("(%1, %2)").arg(clickPos.x()).arg(clickPos.y());

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
menu.addAction(QString("Pos: %1").arg(clickPosStr), cb, Qt::CTRL + Qt::Key_A);
#else
menu.addAction(QString("Pos: %1").arg(clickPosStr), Qt::CTRL | Qt::Key_A, cb);
#endif

const auto randomCount = getRandomInt(1, 10);
for (auto i = 0; i < randomCount; ++i) {
Expand All @@ -1556,7 +1562,11 @@ Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deseru
textList.append("A");
}

#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
menu.addAction(textList.join("") + QString(" %1").arg(i), cb, Qt::ALT + Qt::SHIFT + Qt::Key_0 + i);
#else
menu.addAction(textList.join("") + QString(" %1").arg(i), Qt::ALT | Qt::SHIFT | Qt::Key_0 + i, cb);
#endif
}

// Show menu.
Expand Down

0 comments on commit e5a77a3

Please sign in to comment.