Solved Get screensize
-
Yeah I'm right but I shouldn't be :D RTL should not invert numbers, as far as I know, only regular text.
Perhaps this will work better (https://doc.qt.io/qt-5/qlocale.html#toString-6):
QLocale::toString(size.width()) + " x " + QLocale::toStringsize.height())
-
@JonB said in Get screensize:
I think somewhere you have indeed set for Right-to-Left text output! Change your string" x "
over to" <<< "
and see which direction those chevrons come out --- is it indeed>>>
?!thank you for your answer.
chevrons?
what do i need to do?
-
@Natural_Bugger said in Get screensize:
what do i need to do?
I told you. Change your string
" x "
to" <<< "
, how much clearer can I be?msgBox.setText(QString::number(size.width()) + " <<< " + QString::number(size.height()));
EDIT I'm sorry, my bad, I've just realized I was thinking too literally, like a mirror!
Try:
msgBox.setText(QString::number(size.width()) + " abc " + QString::number(size.height()));
I want to know whether that comes out as
abc
or ascba
? -
@sierdzio said in Get screensize:
Yeah I'm right but I shouldn't be :D RTL should not invert numbers, as far as I know, only regular text.
Perhaps this will work better (https://doc.qt.io/qt-5/qlocale.html#toString-6):
QLocale::toString(size.width()) + " x " + QLocale::toStringsize.height())
#include <QLocale>
returns
error: cannot call member function ‘QString QLocale::toString(int) const’ without object ^
-
it return: cba
-
@Natural_Bugger
Yup! So we are all agreed: there is right-to-left going on here, the results of the screen size are correct but are being printed right-to-left! Not my area, but that is what needs sorting out.... -
@Natural_Bugger ok it's not a static method, eh.
Then:
QLocale locale; msgBox.setText(locale.toString(size.width()) + " x " + locale.toStringsize.height()));
-
-
@Natural_Bugger
Using a custom button which callsreverse
is not a good place to start from....But I don't understand, the code you gave us uses
QMessageBox::setText()
, which is what we looked at, what has that got to do with any custom button, or thereverseText()
method? -
Hah, ok good that you've found it. Happy coding!