Skip to content

Instantly share code, notes, and snippets.

**
** Copyright (C) 2019 Volker Krause <vkrause@kde.org>
** Contact: https://www.qt.io/licensing/
**
** This file is part of the plugins of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:LGPL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
diff --git a/src/plugins/platforms/android/androidjniinput.cpp b/src/plugins/platforms/android/androidjniinput.cpp
index 257d013fa8..f1ecf7318f 100644
--- a/src/plugins/platforms/android/androidjniinput.cpp
+++ b/src/plugins/platforms/android/androidjniinput.cpp
@@ -353,6 +353,8 @@ namespace QtAndroidInput
jint modifiers)
{
#if QT_CONFIG(tabletevent)
+ static const bool s_emulateTabletButtonPressAsKeyPress = qgetenv("QT_ANDROID_SYNTHESIZED_TABLET_KEYPRESS").toInt();
+

Building clang-tidy

  • cd to llvm-project and then run cmake.
cmake -B build -G Ninja -DLLVM_ENABLE_PROJECTS="clang-tools-extra;clang" \

QFileInfo::fileName()

fileName()

suffix()/completeSuffix()

baseName()

These methods usually find parse the filename (full path). But for Android, we can’t do that for all cases, so if the file starts with content:// the Uri is first opened and then queried for filename. Then that fileName is used for all operations

QUrl::fileName()

Once again, we do the same thing with content://, we call QFileInfo::fileName

imports = {
lighttouch-base = "lighttouch-base/",
lighttouch-logging = "packages/lighttouch-logging",
lighttouch-json-interface = "packages/lighttouch-json-interface",
lighttouch-html-interface = "packages/lighttouch-html-interface",
homepage-package = "packages/homepage-package",
send-file-package = "packages/send-file-package",
lighttouch-change-management = "packages/lighttouch-change-management",
base-theme = "themes/base-theme",
studio-theme = "themes/studio-theme",
@sh-zam
sh-zam / android-rust-build.sh
Created November 8, 2018 22:35
Builds a binary for Android using with Rust.
# Rust & Cargo
curl https://sh.rustup.rs -sSf | sh -s -- -y
export PATH="~/.cargo/bin:$PATH"
rustup target add aarch64-linux-android armv7-linux-androideabi arm-linux-androideabi
# Android NDK and toolchain
wget -q https://dl.google.com/android/repository/android-ndk-r18b-linux-x86_64.zip && \
unzip -qq android-ndk-r18b-linux-x86_64.zip && \
rm android-ndk-r18b-linux-x86_64.zip
export NDK_HOME="$PWD/android-ndk-r18b"
import java.util.Scanner;
public class ProgressCounter {
private int counter = 0;
private void progressPercentage(int remain) {
if (remain > counter) {
throw new IllegalArgumentException();
}
@sh-zam
sh-zam / l2norm.cpp
Last active October 28, 2018 15:22
l2 norms
//
// Created by sh_zam on 28/10/18.
//
#include <iostream>
#include <vector>
#include <cmath>
using namespace std;
@sh-zam
sh-zam / InfiniteScrollCustomAdapter
Last active July 14, 2018 12:20
Infinite gridView scrolling android with custom adapter
public class InfiniteScrollCustomAdapter extends ArrayAdapter<DataItems> {
// .... your code .....
@NonNull
@Override
public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {
int MAX_ITEM_PER_PAGE = 100;
// so data is retrieved before the page ends and user doesn't have to wait
if (position > (MAX_ITEM_PER_PAGE - 10)) {
// dataFetcher.next() should add to original list
@sh-zam
sh-zam / robo-maze-solution
Created June 19, 2018 14:55
Robomaze puzzle solution using wall follower algorithm.
class RoboAI_Demo
{
using TT = TileMap::TileType;
using Action = Robo::Action;
bool isRightWallEnding = false;
bool isRightWall = true;
bool isLeftWall = true;
bool hasGoalReached = false;