Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Gui: Qt5 fixes for MessageBox #967

Open
wants to merge 1 commit into
base: RB-2.6
Choose a base branch
from

Conversation

rodlie
Copy link
Contributor

@rodlie rodlie commented Apr 28, 2024

QTextEdit in QMessageBox workaround only works in Qt4. Instead use the Natron MessageBox (after some fixes).

Tested on Windows 10 with Qt 5.15.13.

natron-26-mbox

QTextEdit in QMessageBox workaround only works in Qt4. Instead use the Natron MessageBox (after some fixes).
Copy link
Collaborator

@acolwell acolwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM w/ small suggestion

_imp->infoEdit = new QTextEdit;
_imp->infoEdit->setFocusPolicy(Qt::NoFocus);
_imp->infoEdit->setReadOnly(true);
_imp->infoEdit->setAlignment(Qt::AlignVCenter | Qt::AlignLeft);
_imp->infoEdit->append(message);
_imp->infoEdit->setWordWrapMode(QTextOption::WordWrap);
_imp->infoEdit->setHtml(message);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks the label path above will auto detect rich text or not. I wonder if this code should be something like the following to mimic that behavior.
if (Qt::mightBeRichText(message)) {
_imp->infoEdit->setHtml(message);
} else {
_imp->infoEdit->setPlainText(message);
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the late reply, I will add check for rich text sometime tomorrow after work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants