I’ve seen some strange things when trying to remove QWidgets from a QLayout while using code such as:

Code:

MyWidget->layout()->removeWidget(AnotherWidget);

Sometimes AnotherWidget wouldn’t be removed, sometimes it would display only part of it.

After a bit of searching I came across a different solution that worked a treat. The below code removes all widgets MyWidget’s layout.

Code:

while((QLayoutItem *child = MyWidget->layout()->takeAt(0)) != 0)
{
    delete child->widget();
    delete child;
}

And if you wanted to only remove a single widget from the layout:

Code:

while((QLayoutItem *child = MyWidget->layout()->takeAt(0)) != 0)
{
    if(child == AnotherWidget)
    {
        delete child->widget();
        delete child;
    }
}

Source: http://www.qtcentre.org/archive/index.php/t-21561.html


Posted by Kieren Searle on the 03/11/11

Using 3CXPhone with Sipgate

Sipgate’s own software phone doesn’t work on Windows 7 so I had to find an alternative and chose 3CXPhone.

It’s taken a little time to get it to connect to my Sipgate account so here is the configuration I used to get it to work:

3CXPhone Configuration for Sipgate

Account name and Caller ID can be anything you like.

Change “Extension” and “ID” to your Sipgate ID.

You also need to set the STUN server by clicking on “Advanced Settings” from the Configuration window:

3CXPhone Advanced Settings for Sipgate


I recently purchased a One for All remote (URC-7940 in this case) to use with my DVD player. All was going well until I wanted to program individual keys to some functions that weren’t working.

The user manual that came with the remote boasted that it had a “Key Magic” function that allowed me to do just this! However it neglected to tell me how. After more searching than should have been required I finally found a post on a forum that mentioned how to program a button.

To program a button you must first get a 5 digit function for the device you’re trying to program the remote for. These functions are called “EFCs” and you can usually find them using a search engine. For instance I found my device’s EFCs here.

Anyway the procedure is as follows:

1. Hold the ‘M’ button (Key Magic) until the red light on the control blinks twice
2. On the remote press the buttons “994″. The red light should blink twice.
3. Press ‘M’ again. The red light will blink once more. You are now in Key Magic mode
4. Enter your 5 digit code for the function.
5. Finally press the key you want to assign the function to. The red light will blink twice more to confirm you’re back in normal mode

You should now be able to use the programmed key


If you want to get the current time in QT including the milliseconds you can do so with QTime:

QTime::currentTime().toString("ss.zzz");

This is very useful when debugging


This week I got updated my phone to the HTC Desire. It’s a great phone and I was happy when I discovered that I could link my contacts to their Facebook profile so that their photos and information will appear in my phone book.

My happiness was short lived however as HTC Sense (the application responsible for linking my contacts to their Facebook accounts) had also added all of my “friends” who had listed their phone number on Facebook to my phone book. After some searching I discovered that lots of other people were also having the same problem and there was no fix. It was either no links at all or linking everyone on Facebook.

However I have come across another application called SyncMyPix that can handle linking Facebook accounts to my phone book contacts without adding people to my phone book. It’s available in the Market so it’s easy to install and it’s also free although there is an option to donate if you find the application useful.


1 2 3 4 5 6 7 8 9 10 >>

My name is Kieren and this is my blog. I use it mostly to document any solutions to problems I come across in computing.

Search

XML Feeds