Posts

Showing posts from March, 2014

Using QML with C++

Source code  here Original article:  http://www.ics.com/blog/integrating-c-qml Recently I stumbled onto an example where the front end of a small application was written in QML and the backend was done in C++. That was the exact thing I was searching for and it provided a great example of how to get QML and C++ working together. Lets start with the qml:  //-------------------------------------------------------------------------- // SSH key generator UI import QtQuick 2.1 import QtQuick.Controls 1.0 import QtQuick.Layouts 1.0 import QtQuick.Dialogs 1.0 import com.ics.demo 1.0

Moto G USB OTG

Image
Works with USB drive

Retired

Image
Sent from my Windows Phone

Doesn't work

Image

A tale of specificity

Image
I try to be perfect. And I don't feel right till I have finished something completely. So this following tale relates to the relation of specificity and perfection.  The current project I am working on has a list of lineEdits that I have put into a scrollarea.    This image shows what I was out to achieve.  First task was to get the scrollarea right. There I encountered first hurdle. See, the thing is the scrolled widget has a fixed size but here the size changes depending on the no of lineEdits added to the scroll Area. At first I settled on a fixed size and put in a spacer. But it wasn't perfect. There were some edge cases where that failed. So after a lot of thinking I settled on a minimum size, and set size constraint to SetMinimumSize. Later when I added one widget I would increase minimum size and this proved to be a good solution. Next step was to increase scrollbar width for use on touch screen. I hunted some CSS on net that let me increase the scrollbar width and

Another QScrollBar style

Image
Stumbled onto this nice QScrollBar style: QString styleString="QScrollBar:vertical {"     "    border: 1px solid #999999;"     "    background:white;"     "    width:30px;    "     "    margin: 0px 0px 0px 0px;"     "}"     "QScrollBar::handle:vertical {"     "    background: qlineargradient(x1:0, y1:0, x2:1, y2:0,"     "    stop: 0  rgb(32, 47, 130), stop: 0.5 rgb(32, 47, 130),  stop:1 rgb(32, 47, 130));"     "    min-height: 0px;"     ""     "}"     "QScrollBar::add-line:vertical {"     "    background: qlineargradient(x1:0, y1:0, x2:1, y2:0,"     "    stop: 0  rgb(32, 47, 130), stop: 0.5 rgb(32, 47, 130),  stop:1 rgb(32, 47, 130));"     "    height: 0px;"     "    subcontrol-position: bottom;"     "    subcontrol-origin: margin;"     "}"     "QScrollBar::sub-line:vertical {"  

Building Qt5 on CentOS 6.3

I am using following method to build Qt5 on CentOS6.3. Make two dir's. Extract Qt source in source dir. Keep following script in home dir. Execute it from there. Also go through configure, make and make install phases one-by-one. #!/bin/sh export QTBUILD=/home/user/qtsource/qt-everywhere-opensource-build-5.0.2 export QTSOURCE=/home/user/qtsource/qt-everywhere-opensource-src-5.0.2 cd $QTBUILD $QTSOURCE/configure -opensource -confirm-license -qt-sql-psql -platform linux-g++ -prefix /opt/Qt-5.0.2 -nomake examples -nomake tests -no-gtkstyle #make -j4 all #make install cd -