ChaniBlog











I’m using a lot of QTreeViews at work. So many damn QTreeViews. :P One of the problems I ran into was that QHeaderView::ResizeToContents and QHeaderView::Stretch are mutually exclusive. I had my own custom RichTextDelegate (not Andre’s RichTextDelegate, it wasn’t quite what I wanted) as the only column of a treeview, and I wanted a scrollbar when the contents didn’t fit, but I didn’t want the column to shrink smaller than the view because that looks goofy (especially with alternatingRowColors on mac).

You can’t just setStretchLastSection(), because that just changes the resizeMode from ResizeToContents to Stretch and you lose your scrollbar. QHeaderView’s resize modes are all mutually exclusive, which is a real shame (especially if you wanted them user-resizable, but thankfully I don’t).

I made an attempt to tackle this problem again on friday, not really expecting to make progress. It turned out sandsmark was trying to solve the same problem too – he was thinking of subclassing QHeaderView, and I was hoping I could just subclass QTreeView (which I was going to need to do for some moveCommand stuff anyways). Surprisingly, I could. :)

It turns out QHeaderView relies a lot on its view’s sizeHintForColumn(). So, after subclassing the view, I just reimplemented that function and had it never return a width smaller than the view’s width:


int CustomTreeView::sizeHintForColumn(int column) const
{
int viewSize = viewport()->width();
int colSize = QTreeView::sizeHintForColumn(column);
return qMax(viewSize, colSize);
}

(damnit wordpress, why doesn’t the <code> tag let me indent easily?)

of course it’ll get more complicated if you have more columns, but when it’s just a one-column tree, this is a really nice trick. :)

[edit: wow, this is my 300th post. hard to believe I’ve written that much in.. what, 6 years?]



{November 25, 2012}   On deep frying

I tried out deep frying for the first time on friday. It was… a learning experience.

I wanted to make sweet & sour tofu for a potluck. I didn’t have equipment appropriate for deep frying (all my slotted spoons were plastic, for one), but the birthday boy said he could borrow a deep fryer, so I got oil and all the other ingredients and went over to the party to cook it. It turned out that the deep fryer was some sort of fancy gadget that would spin the food to get oil off after cooking… luckily the internet had instructions for using it. Once I got the hang of all the buttons and dials, I tried deep frying my tofu. It.. .didn’t go quite perfectly. I did get food out of it, though.

Lesson 1: batter and those deep-frying mesh baskets do not mix. The batter will go through the mesh and fuse on the other side, even if you lower the basket first and drop the food into the oil. This was not fun to clean up, I nearly burned myself many times cutting the tofu off, and ended up with some really messy-looking food.

Lesson 2: tofu actually fries pretty well with just seasoning salt. For the second batch, I’d given up on batter and just tossed the tofu in alone, with a sprinkling of whatever seasoning they had available. they came out nice and golden brown, and not stuck to each other or the basket (much). :)

There must be a way to properly deep fry things with batter, but none of the recipes I read mentioned it. Now that I know what to google for… it suggests lowering things slowly with tongs (way too slow for ~20 pieces of tofu), shaking the basket (that basket… may or may not have been shakable. probably not.) and checking the oil temperature (I had only the machine’s green light to go on; but I’ll buy a candy thermometer someday). Well, it gives me things to try for next time, I guess.

Oh, and my favourite item at the potluck? rum & eggnog jello shots. :D



{November 25, 2012}   Delicious Butternut Squash Soup

It’s been ages since I had squash soup, and I missed it a lot. The only thing stopping me from making it was the lack of proper tools. My old blender is great for smoothies, but not for much else, and the idea of transferring soup to it a few cups at a time and trying to get them somewhat decently blended was not appealing.
Then last week, I was reminded of the existence of Immersion Blenders. A perfect solution for me – small enough to fit in my tiny little kitchen, and I don’t even have to take the soup out of the pot. :) They were even on sale, so I went out last weekend and bought myself an early christmas present. :) (I went for the Smart Stick with attachments – it doesn’t come in pretty colours, but it does more than just blend, and the price is still decent.)

Blender in hand, I looked up some more squash soup recipes to get an idea of what works. I ended up merging this coconut squash soup with this curry squash soup and Pete’s “add in lots of roasted veggies” recipe. The result was amazing, if I do say so myself. ;)

I bought enough squash for a double recipe, but I ended up using less coconut (partly because it was really sweet already, partly because my biggest pot was almost full). I used less water, too, just so it would fit. :) I like thick soups anyways. The only sad part was that I couldn’t get fresh rosemary that day, but the dried stuff seemed to work well enough. All in all, the cooking took about four hours! It was worth it, though. :)

So, the ingredients I think I ended up using:

  • 2 medium butternut squash (probably ~4.5lbs)
  • a few pinches of rosemary
  • one bulb of garlic, plus a few leftover pieces
  • 2 small yams
  • 2 yellow/orange peppers
  • about a quarter of a red onion
  • assorted herbs (rosemary, basil, etc)
  • salt
  • oil
  • one large sweet white onion
  • 4 generous tsp of curry powder
  • about 2x2x1″ of ginger
  • one cube of veggie stock
  • 3 cups water
  • 2 apples
  • half a cup of coconut milk

 

The first thing, of course, was to preheat the oven to.. er.. it was either 350 or 375. (forgive me if a few things are forgotten; I was too tired to care about blogging by the time the soup was done). I found my two biggest baking pans and lined the bigger one with tinfoil, went after the squash. Cutting a squash in half lengthwise can be.. tricky. I had to start at the bottom, get the blade into the neck as much as I could, then flip it around and work the knife in from the top (after cutting hte stalk off of course). Eventually they do pop open, though, and then you just scoop out the seeds, and put in a pinch of rosemary. I was able to fit three halves face-down into the first pan (plus some garlic bulbs – one for the soup, the others for later), covered it with tinfoil, and the other half got wrapped up in its own piece of tinfoil in the second pan.

I put all the squash in the oven right away, then started on the other veggies. Yams, peppers, the red onion and some leftover garlic bits all got chopped up and tossed in a bowl with oil, salt, and whatever seasoning I grabbed. I know basil was in there, and probably more of the rosemary; I might have added a bit of spike too. They all went into the second pan. I had planned on them cooking quickly, but, the squash was on the bottom getting most of the heat, and since they had to share a pan with one piece of squash they were all squished together a bit much. Next time, I’ll let the squash have the oven all to itself, and do the other veggies on broil, alone (which would have only taken like 15 minutes anyways). That extra squash half in the top pan was a bit underdone, too; either I need a bigger oven, or to swap the two pans around halfway through.

Anyways, an hour after putting the squash in, the bottom pan of squash was perfect. it was so well done it was just mush, and I had trouble not breaking the shell apart too much as I scooped out the flesh. :) there was syrupy squash juice in the bottom of the pan, too, which I happily licked off the tinfoil once I had all the squash out. :)

I’ve gotten ahead of myself a little, though. After putting the veggies in the oven, there was still half an hour left on the oven timer. I cleaned up a bit and practiced with the immersion blender before starting the soup. It turns out immersion blenders aren’t hard once you know that the blade part has to be completely in the water before you turn it on, and turned off again before you try to lift it out. :)

Anyways, once I was confident I wasn’t going to splatter soup on the walls, I got out my biggest soup pot and chopped up the onion. in it went, with a bit of oil, on medium heat. Every once in a while I checked on the veggies and mixed them around, but they were in no danger of burning whatsoever. Then I grated ginger as long as I could stand (I love ginger but grating is kind of a hassle – oh, and I used the fine grater, not the cheese one). Once the onions were soft, I added curry powder, and a minute later, the ginger. Then in went two cups of water and the veggie stock (which had actually been sitting in the water for a while, but I don’t think that matttered, it needs hot water to dissolve). With that stirred up a bit, I had the base for my soup – and just in time, because the squash was done.

I scooped the squash directly into the pot, and then (a long then – it was a lot of squash to scoop) the veggies went in too, and the contents of one bulb of garlic (you just pop a clove offand pull or squeeze out the contents, if it’s fully cooked it’s no problem). I chopped up the apples and put them in too, and another cup of water. All the scooping had been tiring, and I figured it would be good to let the soup cook and soften up those apples, so I sat down at the computer for half an hour and tried not to check on the soup too often.

When I returned, it was blending time! :) The immersion blender worked really well, and so fast. It’s really cool to see the soup slowly change from a jumble of veggie lumps to a smooth orange.. well.. soup. :) I’d been worrying that I’d overdone the curry powder, too, but after blending it had just the right balance of squash and curry. :) After letting it simmer a bit longer while I washed up,  I added half a can of coconut milk, and lots of salt (which thankfully brought down the sweetness a bit). And then, finally, it was done! :)

I made my bowl of soup look pretty with a drizzle of coconut milk and a pinch of nutmeg, but pete wasn’t willing to wait for that ;) I’ll take that as a compliment.

Damn, now I wish I had soup. it only lasted, like, 3 days. I need a bigger soup pot!



{November 5, 2012}   my own sweet and sour sauce

Every time Pete brings home chinese food, I’m reminded how delicious sweet & sour sauce is… and how much I hate the “chicken” it’s on. In true chinese fashion, the meat gets the good sauce and the tofu gets.. well, it can barely be called a sauce at all. I think there might be some msg on it? :P
So, I finally got around to making my own damn sauce. :) I looked at a few recipes online, merged them, and made substitutions where I had to. It didn’t turn out exactly how I wanted it (mainly because I couldn’t get pineapple chunks) but I’m recording it anyways so I can tweak it next time.

 

The instructions (or my interpretation of them) are fairly simple: throw most of the ingredients in a pot, bring it to a boil, then add a mix of 2:1 water and cornstarch (mixing it beforehand gets the lumps out more easily).

I used:

  • one cup of water
  • 1/3 cup apple cider vinegar
  • 1/4 cup mixed go chu jang and tomato paste (because I didn’t have ketchup)
  • between 1/3 and 1/2 cup brown sugar (it was too lumpy to measure well, because it wasn’t stored properly)
  • 1/2 tsp soy sauce
  • around 1tbsp finely grated ginger (I just stopped when I was tired of grating)
  • 1/2 can (~9oz) shredded pineapple (it’s just not as good as the chunks, though…)

and for the cornstarch mix:

  • 2 tbsp corn starch
  • 4 tbsp water.

 
I think I’m happy with the level of sweetness, even with all that pineapple juice.. :) once it was on my tofu it looked like proper sweet&sour sauce, too – but in the pot it looks reddish-brown thanks to the ketchup-replacement and brown sugar.

 
I guess I should have taken a picture. oops. too late! :)



et cetera