Tag Archives: Programming

Moving printf into the modern age using C++17

Ever since c++11 introduce variadic templates, I started seeing people implement some "safe printf" examples. They are pretty cool, but none of them attempted to actually implement the printf fully with all of its quirks. Instead, they all pretty much do the same thing:

  1. Use variadic templates to verify the sanity of the parameters
  2. Delegate the actual formatting to the libc printf

I think we can do better...

Read More...

Portable BitFields Using C++11

There are lots of reasons to using C++'s bit field feature. Perhaps you need a more compact way to represent your data structures, maybe you need to use them interact with hardware, or if you're writing an emulator, maybe you want to use them to efficiently represent the hardware that you're emulating. The list goes on...

Read More...

A bit about fixed sized dialogs in Qt

Most of the time, it makes the most sense for our dialogs to be designed with layouts such that it looks good with just about any width or height. But there are a few cases where locking in the size makes sense. The most classic example I can think of is an "about this application" dialog box.

Read More...

Qt’s style system FTW (Adding Theme Support to a Qt Application)

A few years ago, I was asked to add "theme" to a Qt project of mine. I wasn't fully aware of the power of Qt's style system, so I did it the hard way. I created a configuration file which contained the theme-able attributes of just about everything I could think of. And when the application started, I parsed it, and applied the colors, fonts, etc. After a short bit, I noticed things I had overlooked and added them. It wasn't amazingly hard, but it sure could have been easier. Today I'd like to discuss the easy way :-).

Read More...

Getting The Look & Feel Of An Editor Right

As developers, we all have an editor of choice. We all have one that we consider to be "perfect for our way of working" and no others will do. Sure, in a bind we can make do with alternatives, but they never seem to "feel" right. For me, this editor is nedit. I guess it's because it was the graphical editor suggested by my professor in school. But I often feel crippled when I have to use something else. Unfortunately, nedit is showing its age. It was made in a time before Unicode was even a concept, using a widget toolkit that has simply not kept up with the times.

Read More...