Probably QT “Fusion” is not an appropriate style for Android apps, because its buttons height is not enough:

Probably QT “Fusion” is not an appropriate style for Android apps, because its buttons height is not enough:
The task is to write one_edit_apart
function that determines is it possible to make two given strings equal by replacing, adding or removing one symbol. The equal strings are considered to be equal, for example:
one_edit_apart("cat", "at") == true
one_edit_apart("cat", "cats") == true
one_edit_apart("cat", "cast") == true
one_edit_apart("cast", "cats") == false
one_edit_apart("cat", "cut") == true
one_edit_apart("cat", "dog") == false
The task is trivial, but Yandex interviewers require all the calculation to be done exactly in their inline editor without debugging and compiling and they do not accept the solution until it works for all possible input. The obvious solution is to truncate equal heads and equal tails and check if the lengths of remaining strings are not greater than 1, but if you forgot to handle the case when heads and tails intersect (with “a” and “aa”, for example) they will say “ooops…., you did a newbie mistake that 1-st year students usually do” and if this all takes more than 40 minutes you fail to pass the test. Below I provided the source code they are most likely to accept:
(more…)For example, there is the following content in qt-everywhere-src-6.4.1\qttranslations\translations\linguist_ru.ts
:
<message numerus="yes">
<source>Dropped %n message(s) which had no ID.</source>
<translation>
<numerusform>Удалено %n сообщение, у которого не было ID.</numerusform>
<numerusform>Удалено %n сообщения, у которых не было ID.</numerusform>
<numerusform>Удалено %n сообщений, у которых не было ID.</numerusform>
</translation>
</message>
Build QT6.4.1 for Windows and then build it for Android as follows:
set MY_DRIVE=D:
cd %MY_DRIVE%\dev\build\qta
%MY_DRIVE%
set "CMAKE_ROOT=%MY_DRIVE%\dev\tools\cmake-3.24.2-windows-x86_64\bin"
set "NINJA_ROOT=%MY_DRIVE%\dev\tools\ninja-win"
set "PERL_ROOT=%MY_DRIVE%\dev\tools\Strawberry\perl\bin"
set "MINGW_ROOT=%MY_DRIVE%\dev\tools\x86_64-12.2.0-release-win32-seh-rt_v10-rev0\mingw64\bin"
set "PYTHON_ROOT=%MY_DRIVE%\dev\tools\Python35"
set "JDK_ROOT=C:\Program Files\Android\Android Studio\jre\bin"
set PATH=C:\WINDOWS\system32;C:\WINDOWS
set PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%MINGW_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=%PYTHON_ROOT%;%PATH%
set PATH=%JDK_ROOT%;%PATH%
Extract QT sources:
cd /d/dev/repos
tar -xf ../distrib/qt-everywhere-src-6.4.1.tar.xz
Configure QT as follows:
"C:\Program Files\Microsoft Visual Studio\2022\Professional\VC\Auxiliary\Build\vcvarsall.bat" amd64
set MY_DRIVE=D:
%MY_DRIVE%
cd %MY_DRIVE%\dev\build\qt
set "CMAKE_ROOT=%MY_DRIVE%\dev\tools\cmake-3.24.2-windows-x86_64\bin"
set "NINJA_ROOT=%MY_DRIVE%\dev\tools\ninja-win"
set "PERL_ROOT=%MY_DRIVE%\dev\tools\Strawberry\perl\bin"
set PATH=%CMAKE_ROOT%;%PATH%
set PATH=%NINJA_ROOT%;%PATH%
set PATH=%PERL_ROOT%;%PATH%
set PATH=%MY_DRIVE%\dev\tools\Python35;%PATH%
Found the following code in qt-everywhere-src-6.4.0\qtbase\src\plugins\platforms\android\qandroidplatformtheme.cpp
:
QString QAndroidPlatformTheme::standardButtonText(int button) const
{
switch (button) {
case QPlatformDialogHelper::Yes:
return QCoreApplication::translate("QAndroidPlatformTheme", "Yes");
case QPlatformDialogHelper::YesToAll:
return QCoreApplication::translate("QAndroidPlatformTheme", "Yes to All");
case QPlatformDialogHelper::No:
return QCoreApplication::translate("QAndroidPlatformTheme", "No");
case QPlatformDialogHelper::NoToAll:
return QCoreApplication::translate("QAndroidPlatformTheme", "No to All");
}
return QPlatformTheme::standardButtonText(button);
}
The compiler deduces U
as std::string&
or as std::string
depending on value category of the argument:
template <class U>
void f(U&& s)
{
static_assert(std::is_same_v<U, const std::string&>);
std::cout << std::forward<U>(s) << std::endl;
}
int main()
{
const std::string& s = "abc";
f(s);
return 0;
}
Install magick
tool:
sudo apt update
sudo apt install imagemagick
Copy *.png
files to a folder, for example:
win16x16.png
win32x32.png
win48x48.png
win64x64.png
and run the following command:
convert *.png winapp.ico
We can’t do this in QT:
class Global
{
public:
~Global()
{
qDebug() << "Global destructor.";
}
};
Global g;
There was qtquickcontrols2.conf
in the root directory of my app sources with the following content:
; This file can be edited to change the style of the application
; See Styling Qt Quick Controls 2 in the documentation for details:
; https://doc.qt.io/qt-6/qtquickcontrols2-styles.html
[Controls]
;Style=Default
;Style=Universal
;Style=Material
Style=Fusion
;Style=iOS
[Universal]
Theme=Light
Accent=Steel
[Material]
;Theme=Light
Theme=Dark
;Accent=BlueGrey
;Primary=BlueGray