Skip to content

Instantly share code, notes, and snippets.

@lauromoura
lauromoura / gist:1344961
Created Nov 7, 2011
Quiz de listas do pug-pe challenge
View gist:1344961
import unittest
def search_list(data, target):
return [[i for i, d in enumerate(data) if d == t] for t in target]
class TestIt(unittest.TestCase):
def testIt(self):
self.assertEqual([[0, 2], [10], [5, 6, 7]],
search_list([1,4,1,4, 6, 5, 5, 5, 4, 2, 3], [1, 3, 5]))
View qml.pri
equals(QT_MAJOR_VERSION, 5):if(!debug_and_release|CONFIG(release, debug|release)) {
bump_qml_version_installed.CONFIG += no_path
bump_qml_version_installed.commands = test -d $$[QT_INSTALL_IMPORTS]
for(install, INSTALLS) {
isEmpty($${install}.files): next()
bump_qml_version_installed.depends += install_$${install}
bump_qml_version_installed.commands += && $$bumpQmlVersion($$eval($${install}.path), 2.0)
}
@lauromoura
lauromoura / install_root.patch
Created Feb 15, 2012
Patch qt-components to check $INSTALL_ROOT when bumping the qml files.
View install_root.patch
commit 28d31cf7a98462553e599acd0a9121bd13667eef
Author: Lauro Neto <lauro.neto@openbossa.org>
Date: Wed Feb 15 16:15:51 2012 +0100
Use INSTALL_ROOT to bump the QML files version.
When installing with INSTALL_ROOT, Makefile searched the
original path for the files to change, making the command useless.
diff --git a/qml.pri b/qml.pri
@lauromoura
lauromoura / gist:2024513
Created Mar 12, 2012
Use __arm__ to check if building for the device
View gist:2024513
diff --git a/src/main.cpp b/src/main.cpp
index 74c0cf2..9b2104d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -58,7 +58,11 @@ int main(int argc, char** argv)
window = new BrowserWindow(arguments);
}
+#if defined(__arm__)
+ window->showFullScreen();
@lauromoura
lauromoura / main.qml
Created Mar 16, 2012
Colorizer shader
View main.qml
import QtQuick 2.0
import QtWebKit 3.0
Rectangle {
id: background
height: 480
width: 854
@lauromoura
lauromoura / gist:2127190
Created Mar 19, 2012
Rect inside WebView
View gist:2127190
import QtQuick 2.0
import QtWebKit 3.0
Rectangle {
id: background
height: 480
width: 640
color: "brown"
@lauromoura
lauromoura / gist:2161323
Created Mar 22, 2012
Random error running snowshoe mobile
View gist:2161323
ASSERTION FAILED: !m_suspendCount
/home/lauro/dev/webkit/webkit/Source/WebKit2/UIProcess/qt/QtViewportInteractionEngine.cpp(406) : void WebKit::QtViewportInteractionEngine::reset()
1 0x7f80e081beaf /home/lauro/dev/webkit/webkit/WebKitBuild/Debug/lib/libQtWebKit.so.5(_ZN6WebKit27QtViewportInteractionEngine5resetEv+0x3b) [0x7f80e081beaf]
2 0x7f80e081bf2d /home/lauro/dev/webkit/webkit/WebKitBuild/Debug/lib/libQtWebKit.so.5(_ZN6WebKit27QtViewportInteractionEngine16applyConstraintsERKNS0_11ConstraintsE+0x1d) [0x7f80e081bf2d]
3 0x7f80e073d053 /home/lauro/dev/webkit/webkit/WebKitBuild/Debug/lib/libQtWebKit.so.5(_ZN29QQuickWebViewFlickablePrivate27didChangeViewportPropertiesERKN7WebCore17ViewportArgumentsE+0x77) [0x7f80e073d053]
4 0x7f80e0811ef6 /home/lauro/dev/webkit/webkit/WebKitBuild/Debug/lib/libQtWebKit.so.5(_ZN12QtPageClient27didChangeViewportPropertiesERKN7WebCore17ViewportArgumentsE+0x36) [0x7f80e0811ef6]
5 0x7f80e07bfdc6 /home/lauro/dev/webkit/webkit/WebKitBuild/Debug/lib/libQtWebKit.so.5(_ZN6WebKi
@lauromoura
lauromoura / gist:2208905
Created Mar 26, 2012
-O2 build error on scratchbox
View gist:2208905
cd src/widgets/ && /scratchbox/tools/bin/make -f Makefile
make[2]: Entering directory `/home/lauro/qt/qt5-debs/qtbase/src/widgets'
/home/lauro/qt/qt5-debs/qtbase/bin/uic dialogs/qfiledialog.ui -o .uic/release-shared/ui_qfiledialog.h
unable to dump 001be800
make[2]: *** [.uic/release-shared/ui_qfiledialog.h] Error 126
make[2]: Leaving directory `/home/lauro/qt/qt5-debs/qtbase/src/widgets'
make[1]: *** [sub-widgets-make_default-ordered] Error 2
make[1]: Leaving directory `/home/lauro/qt/qt5-debs/qtbase'
dh_auto_build: make -j1 returned exit code 2
make: *** [build] Error 9
View gist:2209109
Project MESSAGE: Fixing uic flags
cd "/home/lauro/qt/qt5-debs/qtbase/./src/tools/uic"
/scratchbox/tools/bin/make Makefile
make[3]: Entering directory `/home/lauro/qt/qt5-debs/qtbase/src/tools/uic'
make[3]: `Makefile' is up to date.
make[3]: Leaving directory `/home/lauro/qt/qt5-debs/qtbase/src/tools/uic'
make[2]: Leaving directory `/home/lauro/qt/qt5-debs/qtbase/src/tools/uic'
make[2]: Entering directory `/home/lauro/qt/qt5-debs/qtbase/src/tools/uic'
arm-linux-gnueabi-g++ -c -g -O2 -Wall -W -fPIE -DQT_NO_LIBUDEV -DQT_UIC -DQT_UIC_CPP_GENERATOR -DQT_BOOTSTRAPPED -DQT_LITE_UNICODE -DQT_TEXTCODEC -DQT_NO_CAST_FROM_ASCII -DQT_NO_CAST_TO_ASCII -DQT_NO_CODECS -DQT_NO_DATASTREAM -DQT_NO_GEOM_VARIANT -DQT_NO_LIBRARY -DQT_NO_QOBJECT -DQT_NO_STL -DQT_NO_SYSTEMLOCALE -DQT_NO_THREAD -DQT_NO_UNICODETABLES -DQT_NO_USING_NAMESPACE -DQT_NO_DEPRECATED -D_LARGEFILE64_SOURCE -D_LARGEFILE_SOURCE -I../../../mkspecs/linux-g++-maemo -I. -I. -I. -Icpp -I. -I../../../include -I../../../include/QtCore -I../../../include/QtCore/5.0.0 -
View gist:2230414
import QtQuick 2.0
import QtWebKit 3.0
import com.nokia.meego 2.0
PageStackWindow {
id: mainWindow
initialPage: Page {