Tuesday, September 09, 2014

Hide the tick box of QCheckbox

I was looking for a way to hide the tick box after it had been ticked. The checkbox was an item in a QListWidgetItem. I found that this did the job.

item->setData(Qt::CheckStateRole, QVariant());

Wednesday, January 23, 2013

Missing modprobe list. A workaround

Frustratingly a very useful feature of modprobe has been removed, the ability to list all unloaded kernel modules in a simple command no longer exists. When I last worked with modprobe it was possible to list all unloaded kernel modules with "modprobe -l". Very useful for a newbie when learning how to create kernel modules, especially when cross-compiling and you don't want to keep rebuilding the kernel but would rather load kernel modules by hand.

So just add this to the bottom of your bashrc file and you can list unloaded modules as before be calling fmod.
function fmod() { 

[ "$1" = '' ] && find /lib/modules/$(uname -r) -iname *.ko -print | awk -F $(uname -r)/ '{print $NF}' 

[ "$1" != '' ] && find /lib/modules/$(uname -r) -iname "$1".ko -print | awk -F $(uname -r)/ '{print $NF}' 

Courtesy of gentoo forums

Sunday, November 11, 2012

How to change the brake pads on a Corsa C

Here we are again, another quick guide sharing my experience of changing the brake pads on my 2002 Corsa C. So lets begin, pretty straight-forward.

1. Jack the car up and get that wheel off, to help you access the calipers more easily I would turn the steering wheel all the way round in the direction of the side you are working on.

2. First thing to do is to gently but forcefully push the piston, which engages the brake, all the way back. You can do this by getting a screw driver behind the inside brake pad and using some leverage push the piston back. The separated piston is marked by the red arrow. Make sure it is all the way back to ensure the there is enough room for the caliper to slip over the new thicker brake pads.

3. You can either remove the two bolts marked by the blue arrows, or loosen the top one and remove the bottom and swing the caliper up. I removed both to give me some room.

4. With the caliper off, what you need to do is slide the old brake pads out. Then remove the four anti-rattle clips that hold the pads in place, marked by the red arrows below. As you remove each clip, take note of the clips orientation as you will need to replace them with the new ones that would have come with your new pads.

5. Now do the reverse, replace the four clips with the new ones in your kit. Slip in the pads, make sure you are using the correct pair of pads, I noticed in my kit that the inside pad was slightly different to the outside one. Compare them against the pads you just removed.

6. Slip the caliper back other the new pads lining up the bolt holes. The bolt holes are actually pistons that can be pushed back to compensate for the thicker pad. Tighten up the bolts and you are done, once you put that wheel back on.

Easy enough? Any questions then hit the comments.

Wednesday, June 27, 2012

Qt: Hide QTabBar close button on inactive tabs

Just a quick one here. I have been trying to hijack the close button that can be enabled on each of the tabs on a QTabWidget. I just wanted to have the close button visible on the active tab. Due to QTabBar being a protected function this is a nice work around for modifying the close button or any other element of QTabWidget.

QTabBar* tabBar = ui.tabs->findChild < QTabBar* >(QLatin1String("qt_tabwidget_tabbar"));
tabBar->tabButton(1, QTabBar::RightSide)->resize(0,0);

From here you'll be able to do a whole range of tasks on a per tab basis.