Thoughts and tips for a daily coding life


Aligning widgets in layouts using Designer

July 27, 2012 Posted by Antanas No comments
If you want to align widgets inside, for example, QHBoxLayout or QVBoxLayout using Qt Creator designer, just right click on particular widget and choose Layout Alignment



Removing unique chars from string in C++

January 28, 2012 Posted by Antanas , , No comments
Needed to remove some duplicate char sequences from string and couldn't remember usage for unique function.
Basically got stuck with usage syntax =)

After half an hour of reading and searching got this:

std::string code = "some code wiiiiith dubbbblicate chaaaars";
code.erase(std::unique(code.begin(), code.end()), code.end());

Hope this will help other doomed soul.